mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
19df8040df
Initial commit of a basic test framework, see readme.md for more Most modules are covered with basic unit tests, and there's an example test for a graphics draw (rectangle) and object (File) - for object tests doing more scenario based so we can check multiple things together
45 lines
1.3 KiB
Lua
45 lines
1.3 KiB
Lua
-- love.timer
|
|
|
|
|
|
-- love.timer.getAverageDelta
|
|
-- @NOTE not sure if you could reliably get a specific delta?
|
|
love.test.timer.getAverageDelta = function(test)
|
|
test:assertNotEquals(nil, love.timer.getAverageDelta(), 'check not nil')
|
|
end
|
|
|
|
-- love.timer.getDelta
|
|
-- @NOTE not sure if you could reliably get a specific delta?
|
|
love.test.timer.getDelta = function(test)
|
|
test:assertNotEquals(nil, love.timer.getDelta(), 'check not nil')
|
|
end
|
|
|
|
|
|
-- love.timer.getFPS
|
|
-- @NOTE not sure if you could reliably get a specific FPS?
|
|
love.test.timer.getFPS = function(test)
|
|
test:assertNotEquals(nil, love.timer.getFPS(), 'check not nil')
|
|
end
|
|
|
|
|
|
-- love.timer.getTime
|
|
love.test.timer.getTime = function(test)
|
|
local starttime = love.timer.getTime()
|
|
love.timer.sleep(1)
|
|
local endtime = love.timer.getTime() - starttime
|
|
test:assertEquals(1, math.floor(endtime), 'check 1s passes')
|
|
end
|
|
|
|
|
|
-- love.timer.sleep
|
|
love.test.timer.sleep = function(test)
|
|
local starttime = love.timer.getTime()
|
|
love.timer.sleep(1)
|
|
test:assertEquals(1, math.floor(love.timer.getTime() - starttime), 'check 1s passes')
|
|
end
|
|
|
|
|
|
-- love.timer.step
|
|
-- @NOTE not sure if you could reliably get a specific step val?
|
|
love.test.timer.step = function(test)
|
|
test:assertNotEquals(nil, love.timer.step(), 'check not nil')
|
|
end |