@@ -4,30 +4,23 @@ using StaticArrays
44sys = SymbolCache ([:x , :y , :z ], [:a , :b , :c ], :t )
55
66for (buf, newbuf, newvals) in [
7- # standard operation
8- ([1.0 , 2.0 , 3.0 ], [2.0 , 3.0 , 4.0 ],
9- Dict (:x => 2.0 , :y => 3.0 , :z => 4.0 ))
10- # buffer type "demotion"
11- ([1.0 , 2.0 , 3.0 ], [2 , 3 , 4 ],
12- Dict (:x => 2 , :y => 3 , :z => 4 ))
13- # buffer type promotion
14- ([1 , 2 , 3 ], [2.0 , 3.0 , 4.0 ],
15- Dict (:x => 2.0 , :y => 3.0 , :z => 4.0 ))
16- # value type promotion
17- ([1 , 2 , 3 ], [2.0 , 3.0 , 4.0 ],
18- Dict (:x => 2 , :y => 3.0 , :z => 4.0 ))
19- # standard operation
20- ([1.0 , 2.0 , 3.0 ], [2.0 , 3.0 , 4.0 ],
21- Dict (:a => 2.0 , :b => 3.0 , :c => 4.0 ))
22- # buffer type "demotion"
23- ([1.0 , 2.0 , 3.0 ], [2 , 3 , 4 ],
24- Dict (:a => 2 , :b => 3 , :c => 4 ))
25- # buffer type promotion
26- ([1 , 2 , 3 ], [2.0 , 3.0 , 4.0 ],
27- Dict (:a => 2.0 , :b => 3.0 , :c => 4.0 ))
28- # value type promotion
29- ([1 , 2 , 3 ], [2 , 3.0 , 4.0 ],
30- Dict (:a => 2 , :b => 3.0 , :c => 4.0 ))]
7+ # standard operation
8+ ([1.0 , 2.0 , 3.0 ], [2.0 , 3.0 , 4.0 ], Dict (:x => 2.0 , :y => 3.0 , :z => 4.0 )),
9+ # buffer type "demotion"
10+ ([1.0 , 2.0 , 3.0 ], [2 , 3 , 4 ], Dict (:x => 2 , :y => 3 , :z => 4 )),
11+ # buffer type promotion
12+ ([1 , 2 , 3 ], [2.0 , 3.0 , 4.0 ], Dict (:x => 2.0 , :y => 3.0 , :z => 4.0 )),
13+ # value type promotion
14+ ([1 , 2 , 3 ], [2.0 , 3.0 , 4.0 ], Dict (:x => 2 , :y => 3.0 , :z => 4.0 )),
15+ # standard operation
16+ ([1.0 , 2.0 , 3.0 ], [2.0 , 3.0 , 4.0 ], Dict (:a => 2.0 , :b => 3.0 , :c => 4.0 )),
17+ # buffer type "demotion"
18+ ([1.0 , 2.0 , 3.0 ], [2 , 3 , 4 ], Dict (:a => 2 , :b => 3 , :c => 4 )),
19+ # buffer type promotion
20+ ([1 , 2 , 3 ], [2.0 , 3.0 , 4.0 ], Dict (:a => 2.0 , :b => 3.0 , :c => 4.0 )),
21+ # value type promotion
22+ ([1 , 2 , 3 ], [2 , 3.0 , 4.0 ], Dict (:a => 2 , :b => 3.0 , :c => 4.0 ))
23+ ]
3124 for arrType in [Vector, SVector{3 }, MVector{3 }, SizedVector{3 }]
3225 buf = arrType (buf)
3326 newbuf = arrType (newbuf)
@@ -38,3 +31,19 @@ for (buf, newbuf, newvals) in [
3831 @test typeof (newbuf) == typeof (_newbuf) # ensure appropriate type
3932 end
4033end
34+
35+ # Tuples not allowed for state
36+ for (buf, newbuf, newvals) in [
37+ # standard operation
38+ ((1.0 , 2.0 , 3.0 ), (2.0 , 3.0 , 4.0 ), Dict (:a => 2.0 , :b => 3.0 , :c => 4.0 )),
39+ # buffer type "demotion"
40+ ((1.0 , 2.0 , 3.0 ), (2 , 3 , 4 ), Dict (:a => 2 , :b => 3 , :c => 4 )),
41+ # buffer type promotion
42+ ((1 , 2 , 3 ), (2.0 , 3.0 , 4.0 ), Dict (:a => 2.0 , :b => 3.0 , :c => 4.0 )),
43+ # value type promotion
44+ ((1 , 2 , 3 ), (2 , 3.0 , 4.0 ), Dict (:a => 2 , :b => 3.0 , :c => 4.0 ))
45+ ]
46+ _newbuf = remake_buffer (sys, buf, newvals)
47+ @test newbuf == _newbuf # test values
48+ @test typeof (newbuf) == typeof (_newbuf) # ensure appropriate type
49+ end
0 commit comments