@@ -4,62 +4,57 @@ using SciMLStructures: Tunable, Constants, Caches, Discrete, Initials, Input,
44using AllocCheck
55using Test
66
7- # AllocCheck has compatibility issues on macOS ARM
8- if ! Sys. isapple ()
9-
10- @testset " AllocCheck - Zero Allocations" begin
11- @testset " hasportion checks" begin
12- arr = rand (10 )
7+ @testset " AllocCheck - Zero Allocations" begin
8+ @testset " hasportion checks" begin
9+ arr = rand (10 )
10+
11+ @check_allocs check_hasportion_tunable (a) = hasportion (Tunable (), a)
12+ @check_allocs check_hasportion_constants (a) = hasportion (Constants (), a)
13+ @check_allocs check_hasportion_caches (a) = hasportion (Caches (), a)
14+ @check_allocs check_hasportion_discrete (a) = hasportion (Discrete (), a)
15+ @check_allocs check_hasportion_initials (a) = hasportion (Initials (), a)
16+
17+ @test check_hasportion_tunable (arr) == true
18+ @test check_hasportion_constants (arr) == false
19+ @test check_hasportion_caches (arr) == false
20+ @test check_hasportion_discrete (arr) == false
21+ @test check_hasportion_initials (arr) == false
22+ end
1323
14- @check_allocs check_hasportion_tunable (a) = hasportion (Tunable (), a)
15- @check_allocs check_hasportion_constants (a) = hasportion (Constants (), a)
16- @check_allocs check_hasportion_caches (a) = hasportion (Caches (), a)
17- @check_allocs check_hasportion_discrete (a) = hasportion (Discrete (), a)
18- @check_allocs check_hasportion_initials (a) = hasportion (Initials (), a)
24+ @testset " isscimlstructure checks" begin
25+ arr = rand (10 )
26+ arr_int = [1 , 2 , 3 ]
27+ arr_any = Any[1 , 2 , 3 ]
1928
20- @test check_hasportion_tunable (arr) == true
21- @test check_hasportion_constants (arr) == false
22- @test check_hasportion_caches (arr) == false
23- @test check_hasportion_discrete (arr) == false
24- @test check_hasportion_initials (arr) == false
25- end
29+ @check_allocs check_isscimlstructure (a:: Vector{Float64} ) = isscimlstructure (a)
30+ @check_allocs check_isscimlstructure_int (a:: Vector{Int} ) = isscimlstructure (a)
2631
27- @testset " isscimlstructure checks " begin
28- arr = rand ( 10 )
29- arr_int = [ 1 , 2 , 3 ]
30- arr_any = Any[ 1 , 2 , 3 ]
32+ @test check_isscimlstructure (arr) == true
33+ @test check_isscimlstructure_int (arr_int) == true
34+ @test isscimlstructure (arr_any) == false
35+ end
3136
32- @check_allocs check_isscimlstructure (a :: Vector{Float64} ) = isscimlstructure (a)
33- @check_allocs check_isscimlstructure_int (a :: Vector{Int} ) = isscimlstructure (a )
37+ @testset " canonicalize for Vector (aliased, zero alloc) " begin
38+ arr = rand ( 10 )
3439
35- @test check_isscimlstructure (arr) == true
36- @test check_isscimlstructure_int (arr_int) == true
37- @test isscimlstructure (arr_any) == false
40+ @check_allocs function check_canonicalize_vec (a:: Vector{Float64} )
41+ canonicalize (Tunable (), a)
3842 end
3943
40- @testset " canonicalize for Vector (aliased, zero alloc)" begin
41- arr = rand (10 )
42-
43- @check_allocs function check_canonicalize_vec (a:: Vector{Float64} )
44- canonicalize (Tunable (), a)
45- end
46-
47- vals, repack, aliases = check_canonicalize_vec (arr)
48- @test vals === arr
49- @test aliases == true
50- end
44+ vals, repack, aliases = check_canonicalize_vec (arr)
45+ @test vals === arr
46+ @test aliases == true
47+ end
5148
52- @testset " canonicalize returns for other portions" begin
53- arr = rand (10 )
49+ @testset " canonicalize returns for other portions" begin
50+ arr = rand (10 )
5451
55- @check_allocs check_canon_constants (a:: Vector{Float64} ) = canonicalize (Constants (), a)
56- @check_allocs check_canon_caches (a:: Vector{Float64} ) = canonicalize (Caches (), a)
57- @check_allocs check_canon_discrete (a:: Vector{Float64} ) = canonicalize (Discrete (), a)
52+ @check_allocs check_canon_constants (a:: Vector{Float64} ) = canonicalize (Constants (), a)
53+ @check_allocs check_canon_caches (a:: Vector{Float64} ) = canonicalize (Caches (), a)
54+ @check_allocs check_canon_discrete (a:: Vector{Float64} ) = canonicalize (Discrete (), a)
5855
59- @test check_canon_constants (arr) == (nothing , nothing , nothing )
60- @test check_canon_caches (arr) == (nothing , nothing , nothing )
61- @test check_canon_discrete (arr) == (nothing , nothing , nothing )
62- end
56+ @test check_canon_constants (arr) == (nothing , nothing , nothing )
57+ @test check_canon_caches (arr) == (nothing , nothing , nothing )
58+ @test check_canon_discrete (arr) == (nothing , nothing , nothing )
6359 end
64-
65- end # if !Sys.isapple()
60+ end
0 commit comments