Skip to content

Commit 47d66a7

Browse files
committed
add test for 2-players zero-sum game
1 parent e9ee0f2 commit 47d66a7

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

test/testgame.jl

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
@test isa(result, Array{GameResult,1})
1414
@test length(result) == 2
1515

16-
@test isapprox(result[1].value, 0.6666666666666661, atol = tol)
16+
@test isapprox(result[1].value, 0.6666666666666661, atol=tol)
1717

1818
@test isapprox(
1919
result[1].probabilities,
2020
[0.4666667, 0.5333333, 0.0000000],
21-
atol = tol,
21+
atol=tol,
2222
)
2323
end
2424

@@ -39,11 +39,33 @@
3939

4040
@test result[1].value == 0.0
4141

42-
@test isapprox(result[1].probabilities, [0.333333, 0.333333, 0.33333], atol = tol)
42+
@test isapprox(result[1].probabilities, [0.333333, 0.333333, 0.33333], atol=tol)
4343

4444
@test result[2].value == 0.0
4545

46-
@test isapprox(result[2].probabilities, [0.333333, 0.333333, 0.33333], atol = tol)
46+
@test isapprox(result[2].probabilities, [0.333333, 0.333333, 0.33333], atol=tol)
4747

4848
end
49+
50+
@testset "Simple Game" begin
51+
52+
mat = [
53+
3 7;
54+
5 4
55+
]
56+
57+
result = game(mat)
58+
59+
@test isa(result, Array{GameResult,1})
60+
61+
@test length(result) == 2
62+
63+
@test result[1].value == 4.6
64+
65+
@test result[2].value == -4.6
66+
67+
@test isapprox(result[1].probabilities, [0.2, 0.8], atol=0.00001)
68+
69+
@test isapprox(result[2].probabilities, [0.6, 0.4], atol=0.00001)
70+
end
4971
end

0 commit comments

Comments
 (0)