|
| 1 | +using Statistics |
| 2 | + |
| 3 | +@testsuite "statistics" AT->begin |
| 4 | + @testset "std" begin |
| 5 | + @test compare(std, AT, rand(10)) |
| 6 | + @test compare(std, AT, rand(10,1,2)) |
| 7 | + @test compare(std, AT, rand(10,1,2); corrected=true) |
| 8 | + @test compare(std, AT, rand(10,1,2); dims=1) |
| 9 | + end |
| 10 | + |
| 11 | + @testset "var" begin |
| 12 | + @test compare(var, AT, rand(10)) |
| 13 | + @test compare(var, AT, rand(10,1,2)) |
| 14 | + @test compare(var, AT, rand(10,1,2); corrected=true) |
| 15 | + @test compare(var, AT, rand(10,1,2); dims=1) |
| 16 | + @test compare(var, AT, rand(10,1,2); dims=[1]) |
| 17 | + @test compare(var, AT, rand(10,1,2); dims=(1,)) |
| 18 | + @test compare(var, AT, rand(10,1,2); dims=[2,3]) |
| 19 | + @test compare(var, AT, rand(10,1,2); dims=(2,3)) |
| 20 | + end |
| 21 | + |
| 22 | + @testset "mean" begin |
| 23 | + @test compare(mean, AT, rand(2,2)) |
| 24 | + @test compare(mean, AT, rand(2,2); dims=2) |
| 25 | + @test compare(mean, AT, rand(2,2,2); dims=[1,3]) |
| 26 | + @test compare(x->mean(sin, x), AT, rand(2,2)) |
| 27 | + @test compare(x->mean(sin, x; dims=2), AT, rand(2,2)) |
| 28 | + @test compare(x->mean(sin, x; dims=[1,3]), AT, rand(2,2,2)) |
| 29 | + end |
| 30 | + |
| 31 | + @testset "cov" begin |
| 32 | + s = 100 |
| 33 | + @test compare(cov, AT, rand(s)) |
| 34 | + @test compare(cov, AT, rand(Complex{Float64}, s)) |
| 35 | + @test compare(cov, AT, rand(s, 2)) |
| 36 | + @test compare(cov, AT, rand(Complex{Float64}, s, 2)) |
| 37 | + @test compare(cov, AT, rand(s, 2); dims=2) |
| 38 | + @test compare(cov, AT, rand(Complex{Float64}, s, 2); dims=2) |
| 39 | + @test compare(cov, AT, rand(1:100, s)) |
| 40 | + end |
| 41 | + |
| 42 | + @testset "cor" begin |
| 43 | + s = 100 |
| 44 | + @test compare(cor, AT, rand(s)) |
| 45 | + @test compare(cor, AT, rand(Complex{Float64}, s)) |
| 46 | + @test compare(cor, AT, rand(s, 2)) |
| 47 | + @test compare(cor, AT, rand(Complex{Float64}, s, 2)) |
| 48 | + @test compare(cor, AT, rand(s, 2); dims=2) |
| 49 | + @test compare(cor, AT, rand(Complex{Float64}, s, 2); dims=2) |
| 50 | + @test compare(cor, AT, rand(1:100, s)) |
| 51 | + end |
| 52 | +end |
0 commit comments