Skip to content

Commit 871617a

Browse files
committed
approx for float comparison
1 parent 4e514e1 commit 871617a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/runtests.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ w = [
2626
]
2727
match = maximum_weight_matching(g, CbcSolver(), w)
2828
@test match.mate[1] == 3
29-
@test match.weight == 3
29+
@test match.weight 3
3030

3131
g = CompleteBipartiteGraph(2,2)
3232
w = zeros(4,4)
@@ -35,7 +35,7 @@ w[1,4] = 1.
3535
w[2,3] = 2.
3636
w[2,4] = 11.
3737
match = maximum_weight_maximal_matching(g, CbcSolver(), w)
38-
@test match.weight == 21
38+
@test match.weight 21
3939
@test match.mate[1] == 3
4040
@test match.mate[3] == 1
4141
@test match.mate[2] == 4
@@ -48,7 +48,7 @@ w[1,4] = 0.5
4848
w[2,3] = 11
4949
w[2,4] = 1
5050
match = maximum_weight_maximal_matching(g, CbcSolver(), w)
51-
@test match.weight == 11.5
51+
@test match.weight 11.5
5252
@test match.mate[1] == 4
5353
@test match.mate[4] == 1
5454
@test match.mate[2] == 3
@@ -63,7 +63,7 @@ w[2,4] = 1
6363
w[2,5] = -1
6464
w[2,6] = -1
6565
match = maximum_weight_maximal_matching(g,CbcSolver(),w,0)
66-
@test match.weight == 11.5
66+
@test match.weight 11.5
6767
@test match.mate[1] == 4
6868
@test match.mate[4] == 1
6969
@test match.mate[2] == 3
@@ -78,7 +78,7 @@ w[1,6] = 1
7878
w[1,5] = -1
7979

8080
match = maximum_weight_maximal_matching(g,CbcSolver(),w,0)
81-
@test match.weight == 12
81+
@test match.weight 12
8282
@test match.mate[1] == 6
8383
@test match.mate[2] == 5
8484
@test match.mate[3] == -1
@@ -92,7 +92,7 @@ w[1,2] = 1
9292
w[3,2] = 1
9393
w[1,3] = 1
9494
match = maximum_weight_matching(g,CbcSolver(),w)
95-
@test match.weight == 1
95+
@test match.weight 1
9696

9797

9898
g = Graph(4)
@@ -106,7 +106,7 @@ w[1,4] = 3
106106
w[2,4] = 1
107107

108108
match = maximum_weight_matching(g,CbcSolver(),w)
109-
@test match.weight == 3
109+
@test match.weight 3
110110
@test match.mate[1] == 4
111111
@test match.mate[2] == -1
112112
@test match.mate[3] == -1
@@ -118,7 +118,7 @@ add_edge!(g, 2,3)
118118
add_edge!(g, 3,1)
119119
add_edge!(g, 3,4)
120120
match = maximum_weight_matching(g,CbcSolver())
121-
@test match.weight == 2
121+
@test match.weight 2
122122
@test match.mate[1] == 2
123123
@test match.mate[2] == 1
124124
@test match.mate[3] == 4
@@ -131,7 +131,7 @@ w[1,3] = 1
131131
w[3,4] = 1
132132

133133
match = maximum_weight_matching(g,CbcSolver(), w)
134-
@test match.weight == 2
134+
@test match.weight 2
135135
@test match.mate[1] == 2
136136
@test match.mate[2] == 1
137137
@test match.mate[3] == 4
@@ -144,7 +144,7 @@ w[1,3] = 5
144144
w[3,4] = 1
145145

146146
match = maximum_weight_matching(g,CbcSolver(),w)
147-
@test match.weight == 5
147+
@test match.weight 5
148148
@test match.mate[1] == 3
149149
@test match.mate[2] == -1
150150
@test match.mate[3] == 1
@@ -169,7 +169,7 @@ match = minimum_weight_perfect_matching(g, w)
169169
@test match.mate[2] == 1
170170
@test match.mate[3] == 4
171171
@test match.mate[4] == 3
172-
@test match.weight == 600
172+
@test match.weight 600
173173

174174
w = Dict(
175175
Edge(1, 2) => 500,
@@ -184,7 +184,7 @@ match = minimum_weight_perfect_matching(g, w)
184184
@test match.mate[2] == 4
185185
@test match.mate[3] == 1
186186
@test match.mate[4] == 2
187-
@test match.weight == 1400
187+
@test match.weight 1400
188188

189189
g =CompleteBipartiteGraph(2,2)
190190
w =Dict{Edge,Float64}()
@@ -198,7 +198,7 @@ match = minimum_weight_perfect_matching(g, w)
198198
@test match.mate[4] == 1
199199
@test match.mate[2] == 3
200200
@test match.mate[3] == 2
201-
@test match.weight == -11.5
201+
@test match.weight -11.5
202202

203203

204204
g =CompleteGraph(4)
@@ -214,4 +214,4 @@ match = minimum_weight_perfect_matching(g, w, 50)
214214
@test match.mate[4] == 1
215215
@test match.mate[2] == 3
216216
@test match.mate[3] == 2
217-
@test match.weight == 11.5
217+
@test match.weight 11.5

0 commit comments

Comments
 (0)