Skip to content

Commit 135e02c

Browse files
committed
Fix the tests to respect expected orderings
1 parent dd7934e commit 135e02c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

test/group.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@testset "group" begin
22
@test group(identity, 11:20)::Dictionary == Dictionary(11:20, (x->[x]).(11:20))
3-
@test group(iseven, 1:10)::Dictionary == dictionary(true => [2,4,6,8,10], false => [1,3,5,7,9])
3+
@test group(iseven, 1:10)::Dictionary == dictionary([false => [1,3,5,7,9], true => [2,4,6,8,10]])
44

5-
@test group(iseven, x -> x*2, 1:10)::Dictionary == dictionary(true => [4,8,12,16,20], false => [2,6,10,14,18])
5+
@test group(iseven, x -> x*2, 1:10)::Dictionary == dictionary([false => [2,6,10,14,18], true => [4,8,12,16,20]])
66

7-
@test group((x,y) -> iseven(x+y), (x,y) -> x, 1:10, [1,3,4,2,5,6,4,2,3,9])::Dictionary == dictionary(true => [1,4,5,6,8,9], false => [2,3,7,10])
7+
@test group((x,y) -> iseven(x+y), (x,y) -> x, 1:10, [1,3,4,2,5,6,4,2,3,9])::Dictionary == dictionary([true => [1,4,5,6,8,9], false => [2,3,7,10]])
88
end
99

1010
@testset "grouponly" begin
@@ -14,12 +14,12 @@ end
1414

1515
@testset "groupunique" begin
1616
@test groupunique(identity, 11:20)::Dictionary{Int, Indices{Int}} == Dictionary(11:20, map(x -> Indices([x]), 11:20))
17-
@test groupunique(iseven, 11:20)::Dictionary{Bool, Indices{Int}} == dictionary(true => Indices([12,14,16,18,20]), false => Indices([11,13,15,17,19]))
17+
@test groupunique(iseven, 11:20)::Dictionary{Bool, Indices{Int}} == dictionary([false => Indices([11,13,15,17,19]), true => Indices([12,14,16,18,20])])
1818
end
1919

2020
@testset "groupfind" begin
2121
@test groupfind(identity, 11:20) == Dictionary(11:20, (x->[x]).(1:10))
22-
@test groupfind(iseven, 11:20) == dictionary(true => [2,4,6,8,10], false => [1,3,5,7,9])
22+
@test groupfind(iseven, 11:20) == dictionary([false => [1,3,5,7,9], true => [2,4,6,8,10]])
2323
end
2424

2525
@testset "groupview" begin
@@ -29,18 +29,18 @@ end
2929

3030
@testset "groupreduce" begin
3131
@test groupreduce(identity, +, 1:10) == Dictionary(1:10, 1:10)
32-
@test groupreduce(iseven, +, 1:10) == dictionary(true => 30, false => 25)
32+
@test groupreduce(iseven, +, 1:10) == dictionary([false => 25, true => 30])
3333

34-
@test groupreduce(iseven, x -> x*2, +, 1:10) == dictionary(true => 60, false => 50)
34+
@test groupreduce(iseven, x -> x*2, +, 1:10) == dictionary([false => 50, true => 60])
3535

36-
@test groupreduce(iseven, x -> x*2, +, 1:10; init=10) == dictionary(true => 70, false => 60)
36+
@test groupreduce(iseven, x -> x*2, +, 1:10; init=10) == dictionary([false => 60, true => 70])
3737

38-
@test groupreduce((x,y) -> iseven(x+y), (x,y) -> x+y, +, 1:10, 1:10; init=10) == dictionary(true => 120)
39-
@test groupreduce((x,y) -> iseven(x+y), (x,y) -> x+y, +, 1:10, [1,3,4,2,5,6,4,2,3,9]; init=10) == dictionary(true => 62, false => 52)
38+
@test groupreduce((x,y) -> iseven(x+y), (x,y) -> x+y, +, 1:10, 1:10; init=10) == dictionary([true => 120])
39+
@test groupreduce((x,y) -> iseven(x+y), (x,y) -> x+y, +, 1:10, [1,3,4,2,5,6,4,2,3,9]; init=10) == dictionary([true => 62, false => 52])
4040

41-
@test groupcount(iseven, 1:10) == dictionary(true => 5, false => 5)
42-
@test groupsum(iseven, 1:10) == dictionary(true => 30, false => 25)
43-
@test groupprod(iseven, 1:10) == dictionary(true => 2*4*6*8*10, false => 1*3*5*7*9)
44-
@test groupfirst(iseven, 1:10) == dictionary(true => 2, false => 1)
45-
@test grouplast(iseven, 1:10) == dictionary(true => 10, false => 9)
41+
@test groupcount(iseven, 1:10) == dictionary([false => 5, true => 5])
42+
@test groupsum(iseven, 1:10) == dictionary([false => 25, true => 30])
43+
@test groupprod(iseven, 1:10) == dictionary([false => 1*3*5*7*9, true => 2*4*6*8*10])
44+
@test groupfirst(iseven, 1:10) == dictionary([false => 1, true => 2])
45+
@test grouplast(iseven, 1:10) == dictionary([false => 9, true => 10])
4646
end

0 commit comments

Comments
 (0)