Skip to content

Commit 2f16df2

Browse files
committed
Add tests
1 parent add89bd commit 2f16df2

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/interval_tests/trig.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
using Test
22
using IntervalArithmetic
33

4+
@testset "rad2deg/deg2rad" begin
5+
@test rad2deg.. 2π) interval(180, 360)
6+
@test deg2rad(180 .. 360) interval(π, 2interval(π))
7+
end
8+
49
@testset "sin" begin
510
@test sin(interval(0.5)) interval(0.47942553860420295, 0.47942553860420301)
611
@test sin(interval(0.5, 1.67)) interval(4.7942553860420295e-01, 1.0)
@@ -37,8 +42,8 @@ end
3742

3843
@testset "sinpi" begin
3944
@test sinpi(∅)
40-
@test sinpi(0.5 .. 1.5) interval(-1 , 1)
4145
@test sinpi(1 .. 2) interval(-1 , 0)
46+
@test sinpi(0.5 .. 1.5) interval(-1 , 1)
4247
@test sinpi(0.25 .. 0.75) interval(1/sqrt(2) , 1)
4348
@test sinpi(-0.25 .. 0.25) interval(-1/sqrt(2) , 1/sqrt(2))
4449
end
@@ -51,6 +56,19 @@ end
5156
@test cospi(-0.25 .. 0.25) interval(1/sqrt(2) , 1)
5257
end
5358

59+
@testset "sincospi" begin
60+
x = sincospi(∅)
61+
@test (x[1] == ∅) & (x[2] == ∅)
62+
x = sincospi(1 .. 2)
63+
@test (x[1] interval(-1 , 0)) & (x[2] interval(-1 , 1))
64+
x = sincospi(0.5 .. 1.5)
65+
@test (x[1] interval(-1 , 1)) & (x[2] interval(-1 , 0))
66+
x = sincospi(0.25 .. 0.75)
67+
@test (x[1] interval(1/sqrt(2) , 1)) & (x[2] interval(-1/sqrt(2) , 1/sqrt(2)))
68+
x = sincospi(-0.25 .. 0.25)
69+
@test (x[1] interval(-1/sqrt(2) , 1/sqrt(2))) & (x[2] interval(1/sqrt(2) , 1))
70+
end
71+
5472
@testset "tan" begin
5573
@test tan(interval(0.5)) interval(0.54630248984379048, 0.5463024898437906)
5674
@test tan(interval(0.5, 1.67)) entireinterval()

0 commit comments

Comments
 (0)