Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

==(DecoratedInterval,Interval) == false, hotfix for #219 #220

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/decorations/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ end

in(x::T, a::DecoratedInterval) where T<:Real = in(x, interval_part(a))

@inline Base.:(==)(xx::DecoratedInterval, yy::Interval) = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

== should already be imported, so you can just write ==. Inlining should be automatic for a simple function like this I guess.

@inline Base.:(==)(y::Interval, xx::DecoratedInterval) = false


## scalar functions: mig, mag and friends
scalar_functions = (
Expand Down
6 changes: 6 additions & 0 deletions test/decoration_tests/decoration_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ let b
# @test_throws ArgumentError DecoratedInterval(BigInt(1), 1//10)
# @test_throws ArgumentError @decorated(BigInt(1), 1//10)

#Issue 219
@test ==(DecoratedInterval(2,3),Interval(1,2)) == false
@test ==(Interval(-1,5), DecoratedInterval(4,5)) == false
@test ==(nai(), DecoratedInterval(-1,∞)) == false
@test ==(DecoratedInterval(3,4),nai()) == false

# Tests related to powers of decorated Intervals
@test @decorated(2,3) ^ 2 == DecoratedInterval(4, 9)
@test @decorated(2,3) ^ -2 == DecoratedInterval(1/9,1/4)
Expand Down