@@ -3,7 +3,7 @@ using Test: @test, @test_throws
33using BlockArrays: Block, blocklength, blocklengths, blockedrange, blockisequal, blocks
44using TestExtras: @constinferred
55
6- using TensorAlgebra: BlockedTuple
6+ using TensorAlgebra: BlockedTuple, tuplemortar
77
88@testset " BlockedTuple" begin
99 flat = (true , ' a' , 2 , " b" , 3.0 )
@@ -12,7 +12,8 @@ using TensorAlgebra: BlockedTuple
1212 bt = BlockedTuple {divs} (flat)
1313
1414 @test (@constinferred Tuple (bt)) == flat
15- @test bt == BlockedTuple ((true ,), (' a' , 2 ), (" b" , 3.0 ))
15+ @test bt == tuplemortar ((true ,), (' a' , 2 ), (" b" , 3.0 ))
16+ @test bt == BlockedTuple (flat, divs)
1617 @test BlockedTuple (bt) == bt
1718 @test blocklength (bt) == 3
1819 @test blocklengths (bt) == (1 , 2 , 2 )
@@ -38,17 +39,17 @@ using TensorAlgebra: BlockedTuple
3839
3940 @test_throws DimensionMismatch BlockedTuple {(1, 2, 3)} (flat)
4041
41- bt = BlockedTuple ((1 ,), (4 , 2 ), (5 , 3 ))
42+ bt = tuplemortar ((1 ,), (4 , 2 ), (5 , 3 ))
4243 @test Tuple (bt) == (1 , 4 , 2 , 5 , 3 )
4344 @test blocklengths (bt) == (1 , 2 , 2 )
4445 @test deepcopy (bt) == bt
4546
4647 @test (@constinferred map (n -> n + 1 , bt)) ==
4748 BlockedTuple {blocklengths(bt)} (Tuple (bt) .+ 1 )
48- @test bt .+ BlockedTuple ((1 ,), (1 , 1 ), (1 , 1 )) ==
49+ @test bt .+ tuplemortar ((1 ,), (1 , 1 ), (1 , 1 )) ==
4950 BlockedTuple {blocklengths(bt)} (Tuple (bt) .+ 1 )
50- @test_throws DimensionMismatch bt .+ BlockedTuple ((1 , 1 ), (1 , 1 ), (1 ,))
51+ @test_throws DimensionMismatch bt .+ tuplemortar ((1 , 1 ), (1 , 1 ), (1 ,))
5152
52- bt = BlockedTuple ((1 : 2 , 1 : 2 ), (1 : 3 ,))
53- @test length .(bt) == BlockedTuple ((2 , 2 ), (3 ,))
53+ bt = tuplemortar ((1 : 2 , 1 : 2 ), (1 : 3 ,))
54+ @test length .(bt) == tuplemortar ((2 , 2 ), (3 ,))
5455end
0 commit comments