@@ -2,15 +2,27 @@ using FiniteDifferences: Forward, Backward, Central, Nonstandard
2
2
3
3
@testset " Methods" begin
4
4
for f in [:forward_fdm , :backward_fdm , :central_fdm ]
5
+ @eval @test $ f (1 , 0 ; bound= 1 )(sin, 1 ) == sin (1 )
6
+ @eval @test $ f (2 , 0 ; bound= 1 )(sin, 1 ) == sin (1 )
7
+ @eval @test $ f (3 , 0 ; bound= 1 )(sin, 1 ) == sin (1 )
5
8
@eval @test $ f (10 , 1 ; bound= 1 )(sin, 1 ) ≈ cos (1 )
6
9
@eval @test $ f (10 , 2 ; bound= 1 )(sin, 1 ) ≈ - sin (1 )
7
10
11
+ @eval @test $ f (1 , 0 ; bound= 1 )(exp, 1 ) == exp (1 )
12
+ @eval @test $ f (2 , 0 ; bound= 1 )(exp, 1 ) == exp (1 )
13
+ @eval @test $ f (3 , 0 ; bound= 1 )(exp, 1 ) == exp (1 )
8
14
@eval @test $ f (10 , 1 ; bound= 1 )(exp, 1 ) ≈ exp (1 )
9
15
@eval @test $ f (10 , 2 ; bound= 1 )(exp, 1 ) ≈ exp (1 )
10
16
17
+ @eval @test $ f (1 , 0 ; bound= 1 )(abs2, 1 ) == 1
18
+ @eval @test $ f (2 , 0 ; bound= 1 )(abs2, 1 ) == 1
19
+ @eval @test $ f (3 , 0 ; bound= 1 )(abs2, 1 ) == 1
11
20
@eval @test $ f (10 , 1 ; bound= 1 )(abs2, 1 ) ≈ 2
12
21
@eval @test $ f (10 , 2 ; bound= 1 )(abs2, 1 ) ≈ 2
13
22
23
+ @eval @test $ f (1 , 0 ; bound= 1 )(sqrt, 1 ) == 1
24
+ @eval @test $ f (2 , 0 ; bound= 1 )(sqrt, 1 ) == 1
25
+ @eval @test $ f (3 , 0 ; bound= 1 )(sqrt, 1 ) == 1
14
26
@eval @test $ f (10 , 1 ; bound= 1 )(sqrt, 1 ) ≈ .5
15
27
@eval @test $ f (10 , 2 ; bound= 1 )(sqrt, 1 ) ≈ - .25
16
28
end
@@ -64,6 +76,7 @@ using FiniteDifferences: Forward, Backward, Central, Nonstandard
64
76
@testset " Types" begin
65
77
@testset " $T " for T in (Forward, Backward, Central)
66
78
@test T (5 , 1 )(sin, 1 ; adapt= 4 ) ≈ cos (1 )
79
+ @test_throws ArgumentError T (3 , 3 )
67
80
@test_throws ArgumentError T (3 , 4 )
68
81
@test_throws ArgumentError T (40 , 5 )
69
82
@test_throws ArgumentError T (5 , 1 )(sin, 1 ; adapt= 200 )
0 commit comments