Skip to content

Commit f5e621f

Browse files
committed
(#2) Apply JuliaFormatter on test
1 parent d5c181a commit f5e621f

17 files changed

+224
-224
lines changed

test/runtests.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ include("testpert.jl")
2121
include("testlatex.jl")
2222
include("testknapsack.jl")
2323
include("testsimplex.jl")
24-
25-

test/testassignment.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@test isbalanced(a) == false
2020
end
2121

22-
@testset "balance (2x3)" begin
22+
@testset "balance (2x3)" begin
2323
mat = [
2424
4 8 1
2525
3 1 9
@@ -34,9 +34,9 @@
3434
3 1 9
3535
0 0 0
3636
]
37-
end
37+
end
3838

39-
@testset "balance (2x4)" begin
39+
@testset "balance (2x4)" begin
4040
mat = [
4141
4 8 1 2
4242
3 1 9 5
@@ -54,7 +54,7 @@
5454
]
5555
end
5656

57-
@testset "balance (3x2)" begin
57+
@testset "balance (3x2)" begin
5858
mat = [
5959
4 8
6060
3 1
@@ -72,7 +72,7 @@
7272
]
7373
end
7474

75-
@testset "balance (4x2)" begin
75+
@testset "balance (4x2)" begin
7676
mat = [
7777
4 8
7878
3 1
@@ -124,7 +124,7 @@
124124
mat = rand(10:1000, n, n)
125125

126126
# Ensure that the ith row has a 1 in the ith column
127-
for i in 1:n
127+
for i = 1:n
128128
mat[i, i] = 1
129129
end
130130

@@ -133,10 +133,10 @@
133133

134134
@test result.problem isa AssignmentProblem
135135
@test result.cost == n
136-
137-
for i in 1:n
136+
137+
for i = 1:n
138138
@test result.solution[i, i] == 1
139-
end
139+
end
140140

141141
end
142142

@@ -170,7 +170,7 @@
170170
@test result.problem isa AssignmentProblem
171171
@test result.cost == 2.0
172172
@test size(result.solution) == (4, 4)
173-
173+
174174
# Problem has alternative solutions.
175175
@test result.solution[1, 3] == 1
176176
@test result.solution[2, 2] == 1
@@ -190,7 +190,7 @@
190190
@test size(result.solution) == (3, 3)
191191
@test result.solution == [
192192
0 0 1
193-
0 1 0
193+
0 1 0
194194
1 0 0
195195
]
196196
end
@@ -207,7 +207,7 @@
207207

208208
@test result.problem isa AssignmentProblem
209209
@test result.cost == 2.0
210-
210+
211211

212212
@test size(result.solution) == (4, 4)
213213

test/testcpm.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@testset "CPM" verbose = true begin
22

3-
@testset "Mini CPM Problem" begin
3+
@testset "Mini CPM Problem" begin
44
A = CpmActivity("A", 5)
55
B = CpmActivity("B", 10)
66
C = CpmActivity("C", 8, [A, B])
@@ -15,7 +15,7 @@
1515
@test earliestfinishtime(A) == 5
1616
@test earliestfinishtime(B) == 10
1717
@test earliestfinishtime(C) == 18
18-
end
18+
end
1919

2020
@testset "earliest finishing times of activities" begin
2121
A = CpmActivity("A", 3)

test/testgame.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
@test isa(result, Vector{GameResult})
1616
@test length(result) == 2
1717

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

2020
@test isapprox(
2121
result[1].probabilities,
2222
[0.4666667, 0.5333333, 0.0000000],
23-
atol=tol,
23+
atol = tol,
2424
)
2525
end
2626

@@ -43,18 +43,18 @@
4343

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

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

4848
@test result[2].value == 0.0
4949

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

5252
end
5353

5454
@testset "Simple Game" begin
5555

5656
mat = [
57-
3 7;
57+
3 7
5858
5 4
5959
]
6060

@@ -70,8 +70,8 @@
7070

7171
@test result[2].value == -4.6
7272

73-
@test isapprox(result[1].probabilities, [0.2, 0.8], atol=0.00001)
73+
@test isapprox(result[1].probabilities, [0.2, 0.8], atol = 0.00001)
7474

75-
@test isapprox(result[2].probabilities, [0.6, 0.4], atol=0.00001)
75+
@test isapprox(result[2].probabilities, [0.6, 0.4], atol = 0.00001)
7676
end
7777
end

test/testjohnsons.jl

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
@testset "Example 1 with 2-machines" begin
66
times = Float64[
7-
3.2 4.2;
8-
4.7 1.5;
9-
2.2 5.0;
10-
5.8 4.0;
7+
3.2 4.2
8+
4.7 1.5
9+
2.2 5.0
10+
5.8 4.0
1111
3.1 2.8
1212
]
1313

@@ -21,11 +21,11 @@
2121

2222
@testset "Example 2 with 2-machines" begin
2323
times = Float64[
24-
4 7;
25-
8 3;
26-
5 8;
27-
6 4;
28-
8 5;
24+
4 7
25+
8 3
26+
5 8
27+
6 4
28+
8 5
2929
7 4
3030
]
3131

@@ -47,10 +47,10 @@
4747
@testset "Example 1 for 3-machines" begin
4848

4949
times = Float64[
50-
3 3 5;
51-
8 4 8;
52-
7 2 10;
53-
5 1 7;
50+
3 3 5
51+
8 4 8
52+
7 2 10
53+
5 1 7
5454
2 5 6
5555
]
5656

@@ -72,9 +72,9 @@
7272
@testset "Example 1 for 5-machines" begin
7373

7474
times = Float64[
75-
7 5 2 3 9;
76-
6 6 4 5 10;
77-
5 4 5 6 8;
75+
7 5 2 3 9
76+
6 6 4 5 10
77+
5 4 5 6 8
7878
8 3 3 2 6
7979
]
8080

@@ -94,10 +94,10 @@
9494
@testset "Cannot reduce to 2-machines" begin
9595

9696
times = Float64[
97-
3 3 5 2;
98-
8 4 8 3;
99-
7 2 10 4;
100-
5 1 7 5;
97+
3 3 5 2
98+
8 4 8 3
99+
7 2 10 4
100+
5 1 7 5
101101
2 5 6 6
102102
]
103103

@@ -136,10 +136,10 @@
136136

137137

138138
times = Float64[
139-
3 3 5;
140-
8 4 8;
141-
7 2 10;
142-
5 1 7;
139+
3 3 5
140+
8 4 8
141+
7 2 10
142+
5 1 7
143143
2 5 6
144144
]
145145

@@ -164,7 +164,7 @@
164164
makespan(problem, [1, 4, 3, 2, 5]),
165165
makespan(problem, [1, 4, 3, 5, 2]),
166166
makespan(problem, [1, 4, 5, 2, 3]),
167-
makespan(problem, [1, 4, 5, 3, 2])
167+
makespan(problem, [1, 4, 5, 3, 2]),
168168
]
169169

170170
@test minimum(ms) == best_makespan
@@ -178,10 +178,10 @@
178178

179179
@testset "Example 1 with 2-machines with ga" begin
180180
times = Float64[
181-
3.2 4.2;
182-
4.7 1.5;
183-
2.2 5.0;
184-
5.8 4.0;
181+
3.2 4.2
182+
4.7 1.5
183+
2.2 5.0
184+
5.8 4.0
185185
3.1 2.8
186186
]
187187

@@ -195,11 +195,11 @@
195195

196196
@testset "Example 2 with 2-machines with ga" begin
197197
times = Float64[
198-
4 7;
199-
8 3;
200-
5 8;
201-
6 4;
202-
8 5;
198+
4 7
199+
8 3
200+
5 8
201+
6 4
202+
8 5
203203
7 4
204204
]
205205

@@ -220,10 +220,10 @@
220220
@testset "Example 1 for 3-machines with ga" begin
221221

222222
times = Float64[
223-
3 3 5;
224-
8 4 8;
225-
7 2 10;
226-
5 1 7;
223+
3 3 5
224+
8 4 8
225+
7 2 10
226+
5 1 7
227227
2 5 6
228228
]
229229

@@ -242,9 +242,9 @@
242242
@testset "Example 1 for 5-machines - with ga " begin
243243

244244
times = Float64[
245-
7 5 2 3 9;
246-
6 6 4 5 10;
247-
5 4 5 6 8;
245+
7 5 2 3 9
246+
6 6 4 5 10
247+
5 4 5 6 8
248248
8 3 3 2 6
249249
]
250250

@@ -261,10 +261,10 @@
261261
@testset "Cannot reduce to 2-machine - but solvable with GA" begin
262262

263263
times = Float64[
264-
3 3 5 2;
265-
8 4 8 3;
266-
7 2 10 4;
267-
5 1 7 5;
264+
3 3 5 2
265+
8 4 8 3
266+
7 2 10 4
267+
5 1 7 5
268268
2 5 6 6
269269
]
270270

@@ -279,4 +279,4 @@
279279

280280
end # end of GA testset
281281

282-
end # end of Johnson's algorithm testset
282+
end # end of Johnson's algorithm testset

test/testjump.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testset "JuMP and HiGHS" verbose = true begin
1+
@testset "JuMP and HiGHS" verbose = true begin
22

33
eps = 0.001
44

@@ -21,4 +21,4 @@
2121
@test isapprox(JuMP.value(y), 1.0, atol = eps)
2222

2323
@test isapprox(JuMP.objective_value(m), 2.0, atol = eps)
24-
end
24+
end

test/testknapsack.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
values = [1, 2, 3, 4, 5]
55
weights = [1, 2, 3, 4, 5]
66
capacity = 10
7-
7+
88
problem = KnapsackProblem(values, weights, capacity)
99

1010
result = solve(problem)
@@ -18,13 +18,13 @@
1818
values = [1, 2, 3, 4, 5]
1919
weights = [1, 2, 3, 4, 5]
2020
capacity = 5
21-
21+
2222

2323
problem = KnapsackProblem(values, weights, capacity)
2424

2525
result = solve(problem)
26-
26+
2727
@test result.objective == 5.0
2828
@test result.selected == [0, 0, 0, 0, 1]
2929
end
30-
end
30+
end

test/testmaximumflow.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@
3838
result = solve(problem)
3939

4040
@test result isa MaximumFlowResult
41-
41+
4242
@test result.flow == 60.0
4343

4444
for element in result.path
4545
@test element in maxflowresult
4646
end
4747
end
4848
end
49-
50-

0 commit comments

Comments
 (0)