Skip to content

Commit 7d6042f

Browse files
authored
Add methods for and (#90)
* add methods for ⊊ and ⊋ * add tests for ⊊ and ⊋
1 parent 0bbf497 commit 7d6042f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/IntervalSets.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module IntervalSets
22

33
using Base: @pure
44
import Base: eltype, convert, show, in, length, isempty, isequal, issubset, ==, hash,
5-
union, intersect, minimum, maximum, extrema, range, clamp,
5+
union, intersect, minimum, maximum, extrema, range, clamp, , ,
66

77
using Statistics
88
import Statistics: mean
@@ -212,6 +212,8 @@ function issubset(A::TypedEndpointsInterval{:closed,:closed}, B::TypedEndpointsI
212212
end
213213

214214
(A::AbstractInterval, B::AbstractInterval) = issubset(B, A)
215+
(A::AbstractInterval, B::AbstractInterval) = (A B) & (A B)
216+
(A::AbstractInterval, B::AbstractInterval) = (A B) & (A B)
215217
if VERSION < v"1.1.0-DEV.123"
216218
issubset(x, B::AbstractInterval) = issubset(convert(AbstractInterval, x), B)
217219
end

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ struct IncompleteInterval <: AbstractInterval{Int} end
115115
@test (ClosedInterval(7, 9) I) == false
116116
@test I I
117117
@test I ClosedInterval(1, 2)
118+
@test !(I I)
119+
@test !(I I)
120+
@test !(I J)
121+
@test !(J I)
122+
@test J I
123+
@test I J
118124

119125
@test hash(1..3) == hash(1.0..3.0)
120126

0 commit comments

Comments
 (0)