Index: binaries/data/mods/public/simulation/components/tests/test_StatisticsTracker.js =================================================================== --- /dev/null +++ binaries/data/mods/public/simulation/components/tests/test_StatisticsTracker.js @@ -0,0 +1,36 @@ +Engine.LoadComponentScript("interfaces/StatisticsTracker.js"); +Engine.LoadComponentScript("StatisticsTracker.js"); +Engine.LoadComponentScript("interfaces/Timer.js"); + +AddMock(SYSTEM_ENTITY, IID_Timer, { + "SetInterval": () => true +}); + +Resources = { + "GetCodes": () => ["food", "metal", "stone", "wood"] +}; + +let cmpStatisticsTracker = ConstructComponent(SYSTEM_ENTITY, "StatisticsTracker"); +let obj1 = { + "foo": 3, + "bar": { + "diz": 5, + "duz": 7 + } +}; +let obj2 = { + "foo": [11, 13, 17], + "bar": { + "diz": [19, 23], + "duz": 29 + } +}; + +cmpStatisticsTracker.PushValue(obj1, obj2); +TS_ASSERT_UNEVAL_EQUALS(obj2,{ + "foo": [11, 13, 17, 3], + "bar": { + "diz": [19, 23, 5], + "duz": [7] + } +});