Skip to content

Commit bc108d5

Browse files
inoaslpil
authored andcommitted
consistency
1 parent bf48655 commit bc108d5

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

test/gleam/float_test.gleam

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,7 @@ pub fn random_test() {
337337
|> iterator.from_list()
338338
|> iterator.fold(Nil, test_boundaries)
339339

340-
let run_mean_tests = fn(
341-
iterations: Int,
342-
min: Float,
343-
max: Float,
344-
tolerance: Float,
345-
) {
340+
let test_mean = fn(iterations: Int, min: Float, max: Float, tolerance: Float) {
346341
let expected_average = float.sum([min, max]) /. 2.0
347342
list.range(0, iterations)
348343
|> iterator.from_list()
@@ -354,9 +349,9 @@ pub fn random_test() {
354349
|> float.loosely_compare(expected_average, tolerance)
355350
|> should.equal(order.Eq)
356351
}
357-
run_mean_tests(100, 0.0, 0.0, 5.0)
358-
run_mean_tests(1_000, 0.0, 100.0, 5.0)
359-
run_mean_tests(1_000, -100.0, 100.0, 5.0)
360-
run_mean_tests(1_000, -100.0, 0.0, 5.0)
361-
run_mean_tests(1_000, 0.0, -100.0, 5.0)
352+
test_mean(100, 0.0, 0.0, 5.0)
353+
test_mean(1_000, 0.0, 100.0, 5.0)
354+
test_mean(1_000, -100.0, 100.0, 5.0)
355+
test_mean(1_000, -100.0, 0.0, 5.0)
356+
test_mean(1_000, 0.0, -100.0, 5.0)
362357
}

test/gleam/int_test.gleam

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub fn random_test() {
340340
|> iterator.from_list
341341
|> iterator.fold(Nil, test_boundaries)
342342

343-
let run_mean_tests = fn(iterations: Int, min: Int, max: Int, tolerance: Int) {
343+
let test_average = fn(iterations: Int, min: Int, max: Int, tolerance: Int) {
344344
let expected_average = int.sum([min, max]) / 2
345345
list.range(0, iterations)
346346
|> iterator.from_list
@@ -354,9 +354,9 @@ pub fn random_test() {
354354
}
355355
|> should.be_true
356356
}
357-
run_mean_tests(100, 0, 0, 5)
358-
run_mean_tests(1_000, 0, 100, 5)
359-
run_mean_tests(1_000, -100, 100, 5)
360-
run_mean_tests(1_000, -100, 0, 5)
361-
run_mean_tests(1_000, 0, -100, 5)
357+
test_average(100, 0, 0, 5)
358+
test_average(1_000, 0, 100, 5)
359+
test_average(1_000, -100, 100, 5)
360+
test_average(1_000, -100, 0, 5)
361+
test_average(1_000, 0, -100, 5)
362362
}

0 commit comments

Comments
 (0)