@@ -16,14 +16,14 @@ using Test: @test, @testset
1616 # Test the shorthand for creating an Implementation by calling a Style with a
1717 # function.
1818 @test FI. style ([1 , 2 , 3 ])(getindex) ≡
19- FI. Implementation (getindex, FI. DefaultArrayStyle {1} ())
19+ FI. Implementation (getindex, FI. DefaultArrayStyle ())
2020 end
2121 @testset " Style" begin
2222 # Test basic Style trait for different array types
23- @test FI. Style (typeof ([1 , 2 , 3 ])) isa FI. DefaultArrayStyle{ 1 }
24- @test FI. style ([1 , 2 , 3 ]) isa FI. DefaultArrayStyle{ 1 }
25- @test FI. Style (typeof ([1 2 ; 3 4 ])) isa FI. DefaultArrayStyle{ 2 }
26- @test FI. Style (typeof (rand (2 , 3 , 4 ))) isa FI. DefaultArrayStyle{ 3 }
23+ @test FI. Style (typeof ([1 , 2 , 3 ])) ≡ FI. DefaultArrayStyle ()
24+ @test FI. style ([1 , 2 , 3 ]) ≡ FI. DefaultArrayStyle ()
25+ @test FI. Style (typeof ([1 2 ; 3 4 ])) ≡ FI. DefaultArrayStyle ()
26+ @test FI. Style (typeof (rand (2 , 3 , 4 ))) ≡ FI. DefaultArrayStyle ()
2727
2828 # Test custom Style definition
2929 struct CustomStyle <: FI.Style end
@@ -35,91 +35,56 @@ using Test: @test, @testset
3535 struct MyArray{T, N} <: AbstractArray{T, N}
3636 data:: Array{T, N}
3737 end
38- struct MyArrayStyle <: FI.AbstractArrayStyle{Any} end
38+ struct MyArrayStyle <: FI.AbstractArrayStyle end
3939 FI. Style (:: Type{<:MyArray} ) = MyArrayStyle ()
4040 @test FI. Style (MyArray) isa MyArrayStyle
4141
4242 # Test style homogeneity rule (same type returns preserved)
43- s1 = FI. DefaultArrayStyle {1} ()
44- s2 = FI. DefaultArrayStyle {1} ()
45- @test FI. Style (s1, s2) ≡ s1
43+ s1 = FI. DefaultArrayStyle ()
44+ s2 = FI. DefaultArrayStyle ()
45+ @test FI. Style (s1, s2) ≡ FI . DefaultArrayStyle ()
4646
4747 # Test UnknownStyle precedence
4848 unknown = FI. UnknownStyle ()
49- known = FI. DefaultArrayStyle {1} ()
49+ known = FI. DefaultArrayStyle ()
5050 @test FI. Style (known, unknown) ≡ known
5151 @test FI. Style (unknown, unknown) ≡ unknown
5252
53- # Test AbstractArrayStyle with different dimensions uses max
54- @test FI. Style (
55- FI. DefaultArrayStyle {1} (),
56- FI. DefaultArrayStyle {2} ()
57- ) isa FI. DefaultArrayStyle{Any}
58-
59- # Test DefaultArrayStyle Val constructor preserves type when dimension matches
60- default_style = FI. DefaultArrayStyle {1} (Val (1 ))
61- @test FI. DefaultArrayStyle {1} (Val (1 )) isa FI. DefaultArrayStyle{1 }
62-
63- # Test DefaultArrayStyle Val constructor changes dimension
64- @test FI. DefaultArrayStyle {1} (Val (2 )) isa FI. DefaultArrayStyle{2 }
65-
66- # Test DefaultArrayStyle constructor defaults to Any dimension
67- @test FI. DefaultArrayStyle () isa FI. DefaultArrayStyle{Any}
68-
69- # Test const aliases
70- @test FI. DefaultVectorStyle ≡ FI. DefaultArrayStyle{1 }
71- @test FI. DefaultMatrixStyle ≡ FI. DefaultArrayStyle{2 }
72-
7353 # Test ArrayConflict
7454 conflict = FI. ArrayConflict ()
7555 @test conflict isa FI. ArrayConflict
76- @test conflict isa FI. AbstractArrayStyle{Any}
77-
78- # Test ArrayConflict Val constructor
79- conflict_val = FI. ArrayConflict (Val (3 ))
80- @test conflict_val isa FI. ArrayConflict
56+ @test conflict isa FI. AbstractArrayStyle
8157
8258 # Test style with no arguments
83- @test FI. style () isa FI. DefaultArrayStyle{ 0 }
59+ @test FI. style () ≡ FI. DefaultArrayStyle ()
8460
8561 # Test style with single argument
86- @test FI. style ([1 , 2 ]) isa FI. DefaultArrayStyle{ 1 }
87- @test FI. style ([1 2 ; 3 4 ]) isa FI. DefaultArrayStyle{ 2 }
62+ @test FI. style ([1 , 2 ]) ≡ FI. DefaultArrayStyle ()
63+ @test FI. style ([1 2 ; 3 4 ]) ≡ FI. DefaultArrayStyle ()
8864
8965 # Test style with two arguments
9066 result = FI. style ([1 , 2 ], [1 2 ; 3 4 ])
91- @test result isa FI. DefaultArrayStyle{Any}
67+ @test result ≡ FI. DefaultArrayStyle ()
9268
9369 # Test style with same dimensions
9470 result = FI. style ([1 ], [2 ])
95- @test result isa FI. DefaultArrayStyle{ 1 }
71+ @test result ≡ FI. DefaultArrayStyle ()
9672
9773 # Test style with multiple arguments
9874 result = FI. style ([1 ], [1 2 ], rand (2 , 3 , 4 ))
99- @test result isa FI. DefaultArrayStyle{Any}
75+ @test result ≡ FI. DefaultArrayStyle ()
10076
10177 # Test result_style with single argument
102- @test FI. result_style (FI. DefaultArrayStyle {1} ()) isa FI. DefaultArrayStyle{ 1 }
78+ @test FI. result_style (FI. DefaultArrayStyle ()) isa FI. DefaultArrayStyle
10379
10480 # Test result_style with two identical styles
105- s = FI. DefaultArrayStyle {2} ()
81+ s = FI. DefaultArrayStyle ()
10682 @test FI. result_style (s, s) ≡ s
10783
10884 # Test result_style with UnknownStyle
109- known = FI. DefaultArrayStyle {1} ()
85+ known = FI. DefaultArrayStyle ()
11086 unknown = FI. UnknownStyle ()
11187 @test FI. result_style (known, unknown) ≡ known
11288 @test FI. result_style (unknown, known) ≡ known
113-
114- # Test result_style with different dimension DefaultArrayStyle uses max
115- result = FI. result_style (
116- FI. DefaultArrayStyle {1} (),
117- FI. DefaultArrayStyle {2} ()
118- )
119- @test result isa FI. DefaultArrayStyle{Any}
120-
121- # Test result_style with same shape behaves consistently
122- same_style = FI. DefaultArrayStyle {2} ()
123- @test FI. result_style (same_style, same_style) ≡ same_style
12489 end
12590end
0 commit comments