Add expect.* functions for other binary comparisons

develop
lethosor 2020-03-27 02:01:03 -04:00
parent bb02c9f639
commit 4fde096009
2 changed files with 13 additions and 1 deletions

@ -18,7 +18,7 @@ function test.overlappingGlobals()
local prev = globals[i - 1] local prev = globals[i - 1]
local cur = globals[i] local cur = globals[i]
expect.true_(prev.last < cur.first, "global variable " .. prev.name .. " overlaps global variable " .. cur.name) expect.lt(prev.last, cur.first, "global variable " .. prev.name .. " overlaps global variable " .. cur.name)
end end
end end

@ -27,6 +27,18 @@ end
function expect.ne(a, b, comment) function expect.ne(a, b, comment)
return a ~= b, comment, ('%s == %s'):format(a, b) return a ~= b, comment, ('%s == %s'):format(a, b)
end end
function expect.lt(a, b, comment)
return a < b, comment, ('%s >= %s'):format(a, b)
end
function expect.le(a, b, comment)
return a <= b, comment, ('%s > %s'):format(a, b)
end
function expect.gt(a, b, comment)
return a > b, comment, ('%s <= %s'):format(a, b)
end
function expect.ge(a, b, comment)
return a >= b, comment, ('%s < %s'):format(a, b)
end
function expect.table_eq(a, b, comment) function expect.table_eq(a, b, comment)
local checked = {} local checked = {}
for k, v in pairs(a) do for k, v in pairs(a) do