Skip to content

Commit eeb9695

Browse files
committed
UnitTestSuite: fix several numerical assertions
1 parent a8b29b0 commit eeb9695

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

modules/DependencyControl/UnitTestSuite.moon

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,28 +382,28 @@ class UnitTest
382382
-- @tparam number limit the lower limit (exclusive)
383383
assertLessThan: (actual, limit) =>
384384
@checkArgTypes actual: {actual, "number"}, limit: {limit, "number"}
385-
@assert actual < max, @@msgs.assert.compare, "<", limit, actual
385+
@assert actual < limit, @@msgs.assert.compare, "<", limit, actual
386386

387387
--- Fails the assertion if a number is not lower than or equal to the specified value.
388388
-- @tparam number actual the number to compare
389389
-- @tparam number limit the lower limit (inclusive)
390390
assertLessThanOrEquals: (actual, limit) =>
391391
@checkArgTypes actual: {actual, "number"}, limit: {limit, "number"}
392-
@assert actual <= max, @@msgs.assert.compare, "<=", limit, actual
392+
@assert actual <= limit, @@msgs.assert.compare, "<=", limit, actual
393393

394394
--- Fails the assertion if a number is not greater than the specified value.
395395
-- @tparam number actual the number to compare
396396
-- @tparam number limit the upper limit (exclusive)
397397
assertGreaterThan: (actual, limit) =>
398398
@checkArgTypes actual: {actual, "number"}, limit: {limit, "number"}
399-
@assert actual > max, @@msgs.assert.compare, ">", limit, actual
399+
@assert actual > limit, @@msgs.assert.compare, ">", limit, actual
400400

401401
--- Fails the assertion if a number is not greater than or equal to the specified value.
402402
-- @tparam number actual the number to compare
403403
-- @tparam number limit the upper limit (inclusive)
404404
assertGreaterThanOrEquals: (actual, limit) =>
405405
@checkArgTypes actual: {actual, "number"}, limit: {limit, "number"}
406-
@assert actual >= max, @@msgs.assert.compare, ">=", limit, actual
406+
@assert actual >= limit, @@msgs.assert.compare, ">=", limit, actual
407407

408408
--- Fails the assertion if a number is not in range of an expected value +/- a specified margin.
409409
-- @tparam number actual the actual value
@@ -425,8 +425,7 @@ class UnitTest
425425
@checkArgTypes actual: {actual, "number"}, value: {value, "number"}, max: {margin, "number"}
426426

427427
margin = math.abs margin
428-
@assert math.abs(actual-expected) > margin, @@msgs.assert.almostEquals,
429-
expected, margin, actual
428+
@assert math.abs(actual-value) > margin, @@msgs.assert.almostEquals, value, margin, actual
430429

431430
--- Fails the assertion if a number is not equal to 0 (zero).
432431
-- @tparam number actual the value

0 commit comments

Comments
 (0)