@@ -616,7 +616,12 @@ ta = TrackedArray(varr, darr, tp)
616
616
617
617
@test isa (similar (ta), Matrix{eltype (ta)})
618
618
619
- @test samefields (ta[2 ], TrackedReal (varr[2 ], darr[2 ], tp, 2 , ta))
619
+ for T in (UInt, Int)
620
+ @test samefields (ta[T (2 )], TrackedReal (varr[2 ], darr[2 ], tp, 2 , ta))
621
+ @test samefields (ta[T (2 ), T (3 )], TrackedReal (varr[2 , 3 ], darr[2 , 3 ], tp, 8 , ta))
622
+ S = T === UInt ? Int : UInt
623
+ @test samefields (ta[S (2 ), T (3 )], TrackedReal (varr[2 , 3 ], darr[2 , 3 ], tp, 8 , ta))
624
+ end
620
625
621
626
ta_sub = ta[:,:]
622
627
idx = ReverseDiff. index_iterable (axes (ta), (:, :))
@@ -630,53 +635,58 @@ instr = tp[1]
630
635
@test instr. cache === nothing
631
636
empty! (tp)
632
637
633
- ta_sub = ta[:,1 : 2 ]
634
- idx = ReverseDiff. index_iterable (axes (ta), (:, 1 : 2 ))
635
- @test collect (idx) == [(i, j) for i in 1 : 3 , j in 1 : 2 ]
636
- @test samefields (ta_sub, TrackedArray (varr[:,1 : 2 ], darr[:,1 : 2 ], tp))
637
- @test length (tp) == 1
638
- instr = tp[1 ]
639
- @test instr. func === getindex
640
- @test instr. input === (ta, idx)
641
- @test samefields (instr. output, TrackedArray (varr[:,1 : 2 ], darr[:,1 : 2 ], tp))
642
- @test instr. cache === nothing
643
- empty! (tp)
644
-
645
- ta_sub = ta[2 : 3 ,:]
646
- idx = ReverseDiff. index_iterable (axes (ta), (2 : 3 , :))
647
- @test collect (idx) == [(i, j) for i in 2 : 3 , j in 1 : 3 ]
648
- @test samefields (ta_sub, TrackedArray (varr[2 : 3 ,:], darr[2 : 3 ,:], tp))
649
- @test length (tp) == 1
650
- instr = tp[1 ]
651
- @test instr. func === getindex
652
- @test instr. input === (ta, idx)
653
- @test samefields (instr. output, TrackedArray (varr[2 : 3 ,:], darr[2 : 3 ,:], tp))
654
- @test instr. cache === nothing
655
- empty! (tp)
656
-
657
- ta_sub = ta[1 : 2 ,2 : 3 ]
658
- idx = ReverseDiff. index_iterable (axes (ta), (1 : 2 , 2 : 3 ))
659
- @test collect (idx) == [(i, j) for i in 1 : 2 , j in 2 : 3 ]
660
- @test samefields (ta_sub, TrackedArray (varr[1 : 2 ,2 : 3 ], darr[1 : 2 ,2 : 3 ], tp))
661
- @test length (tp) == 1
662
- instr = tp[1 ]
663
- @test instr. func === getindex
664
- @test instr. input === (ta, idx)
665
- @test samefields (instr. output, TrackedArray (varr[1 : 2 ,2 : 3 ], darr[1 : 2 ,2 : 3 ], tp))
666
- @test instr. cache === nothing
667
- empty! (tp)
638
+ for T in (UInt, Int)
639
+ ta_sub = ta[:,T (1 ): T (2 )]
640
+ idx = ReverseDiff. index_iterable (axes (ta), (:, T (1 ): T (2 )))
641
+ @test collect (idx) == [(i, j) for i in 1 : 3 , j in 1 : 2 ]
642
+ @test samefields (ta_sub, TrackedArray (varr[:,1 : 2 ], darr[:,1 : 2 ], tp))
643
+ @test length (tp) == 1
644
+ instr = tp[1 ]
645
+ @test instr. func === getindex
646
+ @test instr. input === (ta, idx)
647
+ @test samefields (instr. output, TrackedArray (varr[:,1 : 2 ], darr[:,1 : 2 ], tp))
648
+ @test instr. cache === nothing
649
+ empty! (tp)
650
+
651
+ ta_sub = ta[T (2 ): T (3 ),:]
652
+ idx = ReverseDiff. index_iterable (axes (ta), (T (2 ): T (3 ), :))
653
+ @test collect (idx) == [(i, j) for i in 2 : 3 , j in 1 : 3 ]
654
+ @test samefields (ta_sub, TrackedArray (varr[2 : 3 ,:], darr[2 : 3 ,:], tp))
655
+ @test length (tp) == 1
656
+ instr = tp[1 ]
657
+ @test instr. func === getindex
658
+ @test instr. input === (ta, idx)
659
+ @test samefields (instr. output, TrackedArray (varr[2 : 3 ,:], darr[2 : 3 ,:], tp))
660
+ @test instr. cache === nothing
661
+ empty! (tp)
662
+
663
+ S = T === UInt ? Int : UInt
664
+ for U in (S, T)
665
+ ta_sub = ta[S (1 ): S (2 ),T (2 ): T (3 )]
666
+ idx = ReverseDiff. index_iterable (axes (ta), (S (1 ): S (2 ), T (2 ): T (3 )))
667
+ @test collect (idx) == [(i, j) for i in 1 : 2 , j in 2 : 3 ]
668
+ @test samefields (ta_sub, TrackedArray (varr[1 : 2 ,2 : 3 ], darr[1 : 2 ,2 : 3 ], tp))
669
+ @test length (tp) == 1
670
+ instr = tp[1 ]
671
+ @test instr. func === getindex
672
+ @test instr. input === (ta, idx)
673
+ @test samefields (instr. output, TrackedArray (varr[1 : 2 ,2 : 3 ], darr[1 : 2 ,2 : 3 ], tp))
674
+ @test instr. cache === nothing
675
+ empty! (tp)
676
+ end
668
677
669
- ta_sub = ta[2 : 6 ]
670
- idx = ReverseDiff. index_iterable (axes (ta), (2 : 6 ,))
671
- @test collect (idx) == [(i,) for i in 2 : 6 ]
672
- @test samefields (ta_sub, TrackedArray (varr[2 : 6 ], darr[2 : 6 ], tp))
673
- @test length (tp) == 1
674
- instr = tp[1 ]
675
- @test instr. func === getindex
676
- @test instr. input === (ta, idx)
677
- @test samefields (instr. output, TrackedArray (varr[2 : 6 ], darr[2 : 6 ], tp))
678
- @test instr. cache === nothing
679
- empty! (tp)
678
+ ta_sub = ta[T (2 ): T (6 )]
679
+ idx = ReverseDiff. index_iterable (axes (ta), (T (2 ): T (6 ),))
680
+ @test collect (idx) == [(i,) for i in 2 : 6 ]
681
+ @test samefields (ta_sub, TrackedArray (varr[2 : 6 ], darr[2 : 6 ], tp))
682
+ @test length (tp) == 1
683
+ instr = tp[1 ]
684
+ @test instr. func === getindex
685
+ @test instr. input === (ta, idx)
686
+ @test samefields (instr. output, TrackedArray (varr[2 : 6 ], darr[2 : 6 ], tp))
687
+ @test instr. cache === nothing
688
+ empty! (tp)
689
+ end
680
690
681
691
ta_sub = ta[:]
682
692
idx = ReverseDiff. index_iterable (axes (ta), (:,))
0 commit comments