@@ -10,14 +10,18 @@ ip = invperm(p)
1010
1111t = (p... ,)
1212
13+ @test @inferred (TupleTools. argtail2 (1 , 2 , 3 , 4 )) == (3 , 4 )
1314@test @inferred (TupleTools. tail2 (t)) == t[3 : n]
1415@test @inferred (TupleTools. unsafe_tail (t)) == t[2 : n]
1516@test @inferred (TupleTools. unsafe_front (t)) == t[1 : n- 1 ]
1617@test @inferred (TupleTools. unsafe_tail (())) == ()
1718@test @inferred (TupleTools. unsafe_front (())) == ()
18-
19+ @test @inferred (TupleTools. vcat ()) == ()
20+ @test @inferred (TupleTools. vcat ((1 , 2 ))) == (1 , 2 )
21+ @test @inferred (TupleTools. getindices (t, ())) == ()
1922@test @inferred (TupleTools. getindices (t, (1 ,2 ,3 ))) == t[1 : 3 ]
2023
24+ @test @inferred (TupleTools. deleteat ((1 , 2 ), (1 , ))) == (2 , )
2125for i = 1 : n
2226 @test @inferred (TupleTools. deleteat (t, i)) == (deleteat! (copy (p), i)... ,)
2327 @test @inferred (TupleTools. insertat (t, i, (1 ,2 ,3 ))) == (vcat (p[1 : i- 1 ], [1 ,2 ,3 ], p[i+ 1 : n])... ,)
@@ -28,23 +32,40 @@ for i = 0:n
2832end
2933@test @inferred (TupleTools. vcat ((1 ,2 ,3 ),4 ,(5 ,),(),(6 ,7 ,8 ))) == (1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 )
3034
35+ @test @inferred (TupleTools. sum (())) == 0
36+ @test @inferred (TupleTools. sum ((1 , ))) == 1
3137@test @inferred (TupleTools. sum (t)) == sum (t)
38+ @test @inferred (TupleTools. cumsum (())) == ()
39+ @test @inferred (TupleTools. cumsum ((1 , ))) == (1 , )
3240@test @inferred (TupleTools. cumsum (t)) == (cumsum (p)... ,)
41+ @test @inferred (TupleTools. prod (())) == 1
42+ @test @inferred (TupleTools. prod ((2 , ))) == 2
3343@test @inferred (TupleTools. prod (t)) == prod (t)
44+ @test @inferred (TupleTools. cumprod (())) == ()
45+ @test @inferred (TupleTools. cumprod ((1 , ))) == (1 , )
3446@test @inferred (TupleTools. cumprod (t)) == (cumprod (p)... ,)
3547
36- @test @inferred (TupleTools. findmin (t)) == findmin (t)
37- @test @inferred (TupleTools. findmax (t)) == findmax (t)
38- @test @inferred (TupleTools. minimum (t)) == minimum (t)
39- @test @inferred (TupleTools. maximum (t)) == maximum (t)
40- @test @inferred (TupleTools. argmin (t)) == argmin (t)
41- @test @inferred (TupleTools. argmax (t)) == argmax (t)
48+ for a in (t, (1 , ))
49+ @test @inferred (TupleTools. findmin (a)) == findmin (a)
50+ @test @inferred (TupleTools. findmax (a)) == findmax (a)
51+ @test @inferred (TupleTools. minimum (a)) == minimum (a)
52+ @test @inferred (TupleTools. maximum (a)) == maximum (a)
53+ @test @inferred (TupleTools. argmin (a)) == argmin (a)
54+ @test @inferred (TupleTools. argmax (a)) == argmax (a)
55+ end
4256
57+ @test @inferred (TupleTools. sort ((1 , ))) == (1 , )
58+ @test @inferred (TupleTools. sort (())) == ()
4359@test @inferred (TupleTools. sort (t; rev = true )) == (sort (p; rev = true )... ,)
60+ @test @inferred (TupleTools. sort (t; rev = false )) == (sort (p; rev = false )... , )
4461@test @inferred (TupleTools. sortperm (t)) == (sortperm (p)... ,)
62+ @test @inferred (TupleTools. sortperm (t; rev= true )) == (sortperm (p; rev= true )... , )
4563@test @inferred (TupleTools. invperm (t)) == (ip... ,)
4664@test @inferred (TupleTools. isperm (t)) == true
4765@test @inferred (TupleTools. isperm ((1 ,2 ,1 ))) == false
4866@test @inferred (TupleTools. permute (t, t)) == (p[p]. .. ,)
4967
68+ @test @inferred (TupleTools. vcat ()) == ()
69+ @test @inferred (TupleTools. diff (())) == ()
70+ @test @inferred (TupleTools. diff ((1 , ))) == ()
5071@test @inferred (TupleTools. diff ((1 , 2 , 3 ))) == (1 , 1 )
0 commit comments