|
1 | 1 | using RecursiveArrayTools, RecursiveArrayToolsArrayPartitionAnyAll, Test |
2 | 2 |
|
3 | | -@testset "Optimized any" begin |
4 | | - ap = ArrayPartition(collect(1:5), collect(6:10), collect(11:15)) |
5 | | - @test any(x -> x == 4, ap) |
6 | | - @test any(x -> x == 15, ap) |
7 | | - @test !any(x -> x == 17, ap) |
8 | | - @test any(ap .> 10) |
9 | | - @test !any(ap .> 20) |
10 | | -end |
| 3 | +const TEST_GROUP = get(ENV, "RECURSIVEARRAYTOOLS_TEST_GROUP", "Core") |
11 | 4 |
|
12 | | -@testset "Optimized all" begin |
13 | | - ap = ArrayPartition(ones(5), ones(5), ones(5)) |
14 | | - @test all(x -> x == 1.0, ap) |
15 | | - @test !all(x -> x == 2.0, ap) |
16 | | - @test all(ap .> 0) |
| 5 | +if TEST_GROUP == "Core" || TEST_GROUP == "ALL" |
| 6 | + @testset "Optimized any" begin |
| 7 | + ap = ArrayPartition(collect(1:5), collect(6:10), collect(11:15)) |
| 8 | + @test any(x -> x == 4, ap) |
| 9 | + @test any(x -> x == 15, ap) |
| 10 | + @test !any(x -> x == 17, ap) |
| 11 | + @test any(ap .> 10) |
| 12 | + @test !any(ap .> 20) |
| 13 | + end |
17 | 14 |
|
18 | | - ap2 = ArrayPartition(ones(5), [1.0, 1.0, 0.0, 1.0, 1.0], ones(5)) |
19 | | - @test !all(x -> x == 1.0, ap2) |
20 | | -end |
| 15 | + @testset "Optimized all" begin |
| 16 | + ap = ArrayPartition(ones(5), ones(5), ones(5)) |
| 17 | + @test all(x -> x == 1.0, ap) |
| 18 | + @test !all(x -> x == 2.0, ap) |
| 19 | + @test all(ap .> 0) |
| 20 | + |
| 21 | + ap2 = ArrayPartition(ones(5), [1.0, 1.0, 0.0, 1.0, 1.0], ones(5)) |
| 22 | + @test !all(x -> x == 1.0, ap2) |
| 23 | + end |
21 | 24 |
|
22 | | -@testset "Matches AbstractArray default results" begin |
23 | | - ap = ArrayPartition(rand(100), rand(100), rand(100)) |
24 | | - f = x -> x > 0.5 |
| 25 | + @testset "Matches AbstractArray default results" begin |
| 26 | + ap = ArrayPartition(rand(100), rand(100), rand(100)) |
| 27 | + f = x -> x > 0.5 |
25 | 28 |
|
26 | | - # Results must match |
27 | | - @test any(f, ap) == any(f, collect(ap)) |
28 | | - @test all(f, ap) == all(f, collect(ap)) |
| 29 | + # Results must match |
| 30 | + @test any(f, ap) == any(f, collect(ap)) |
| 31 | + @test all(f, ap) == all(f, collect(ap)) |
29 | 32 |
|
30 | | - # Edge case: empty |
31 | | - ap_empty = ArrayPartition(Float64[], Float64[]) |
32 | | - @test !any(x -> true, ap_empty) |
33 | | - @test all(x -> true, ap_empty) |
| 33 | + # Edge case: empty |
| 34 | + ap_empty = ArrayPartition(Float64[], Float64[]) |
| 35 | + @test !any(x -> true, ap_empty) |
| 36 | + @test all(x -> true, ap_empty) |
| 37 | + end |
34 | 38 | end |
0 commit comments