mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-29 03:36:40 +00:00
Add iteration global tests
This commit is contained in:
parent
d6241dd1c5
commit
4634c7dba9
2 changed files with 25 additions and 0 deletions
1
example-suite
Submodule
1
example-suite
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit f0c62b7e4637badb324e782c97169560e8171032
|
|
@ -2,6 +2,7 @@ local testing = require('testing_util')
|
||||||
local core = require('openmw.core')
|
local core = require('openmw.core')
|
||||||
local async = require('openmw.async')
|
local async = require('openmw.async')
|
||||||
local util = require('openmw.util')
|
local util = require('openmw.util')
|
||||||
|
local world = require('openmw.world')
|
||||||
|
|
||||||
local function testTimers()
|
local function testTimers()
|
||||||
testing.expectAlmostEqual(core.getGameTimeScale(), 30, 'incorrect getGameTimeScale() result')
|
testing.expectAlmostEqual(core.getGameTimeScale(), 30, 'incorrect getGameTimeScale() result')
|
||||||
|
@ -64,6 +65,28 @@ local function testGetGMST()
|
||||||
testing.expectEqual(core.getGMST('Level_Up_Level2'), 'something')
|
testing.expectEqual(core.getGMST('Level_Up_Level2'), 'something')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function testMWScript()
|
||||||
|
local variableStoreCount = 18
|
||||||
|
local variableStore = world.mwscript.getGlobalVariables(player)
|
||||||
|
testing.expectEqual(variableStoreCount,#variableStore)
|
||||||
|
|
||||||
|
variableStore.year = variableStoreCount
|
||||||
|
testing.expectEqual(variableStoreCount,variableStore.year)
|
||||||
|
variableStore.year = 1
|
||||||
|
local indexCheck = 0
|
||||||
|
for index, value in ipairs(variableStore) do
|
||||||
|
testing.expectEqual(variableStore[index],value)
|
||||||
|
indexCheck = indexCheck + 1
|
||||||
|
end
|
||||||
|
testing.expectEqual(variableStoreCount,indexCheck)
|
||||||
|
indexCheck = 0
|
||||||
|
for index, value in pairs(variableStore) do
|
||||||
|
testing.expectEqual(variableStore[index],value)
|
||||||
|
indexCheck = indexCheck + 1
|
||||||
|
end
|
||||||
|
testing.expectEqual(variableStoreCount,indexCheck)
|
||||||
|
end
|
||||||
|
|
||||||
local function initPlayer()
|
local function initPlayer()
|
||||||
player:teleport('', util.vector3(4096, 4096, 867.237), util.transform.identity)
|
player:teleport('', util.vector3(4096, 4096, 867.237), util.transform.identity)
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
|
@ -101,6 +124,7 @@ tests = {
|
||||||
end},
|
end},
|
||||||
{'teleport', testTeleport},
|
{'teleport', testTeleport},
|
||||||
{'getGMST', testGetGMST},
|
{'getGMST', testGetGMST},
|
||||||
|
{'mwscript', testMWScript},
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue