Differential D2384 Diff 10186 binaries/data/mods/public/simulation/components/tests/test_StatisticsTracker.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_StatisticsTracker.js
Engine.LoadComponentScript("interfaces/Timer.js"); | Engine.LoadComponentScript("interfaces/Timer.js"); | ||||
Engine.LoadComponentScript("interfaces/StatisticsTracker.js"); | Engine.LoadComponentScript("interfaces/StatisticsTracker.js"); | ||||
Engine.LoadComponentScript("StatisticsTracker.js"); | Engine.LoadComponentScript("StatisticsTracker.js"); | ||||
AddMock(SYSTEM_ENTITY, IID_Timer, { | AddMock(SYSTEM_ENTITY, IID_Timer, { | ||||
"SetInterval": () => true | "SetInterval": () => true | ||||
}); | }); | ||||
Resources = { | Resources = { | ||||
"GetCodes": () => ["food", "metal", "stone", "wood"] | "GetCodes": () => ["food", "metal", "stone", "wood"] | ||||
}; | }; | ||||
let cmpStatisticsTracker = ConstructComponent(SYSTEM_ENTITY, "StatisticsTracker"); | let cmpStatisticsTracker = ConstructComponent(SYSTEM_ENTITY, "StatisticsTracker", { | ||||
"UnitClasses": { "_string": "Infantry Worker FishingBoat" }, | |||||
"StructureClasses": { "_string": "House Wonder" } | |||||
}); | |||||
let obj1 = { | let obj1 = { | ||||
"successfulBribes": 3, | "successfulBribes": 3, | ||||
"unitsTrained": { | "unitsTrained": { | ||||
"Infantry": 5, | "Infantry": 5, | ||||
"Worker": 7 | "Worker": 7 | ||||
} | } | ||||
}; | }; | ||||
let obj2 = { | let obj2 = { | ||||
"successfulBribes": [11, 13, 17], | "successfulBribes": [11, 13, 17], | ||||
"unitsTrained": { | "unitsTrained": { | ||||
"Infantry": [19, 23], | "Infantry": [19, 23], | ||||
"Worker": 29 | "Worker": 29 | ||||
elexis: should be [29], see rP21250 | |||||
} | } | ||||
}; | }; | ||||
cmpStatisticsTracker.PushValue(obj1, obj2); | cmpStatisticsTracker.PushValue(obj1, obj2); | ||||
TS_ASSERT_UNEVAL_EQUALS(obj2, { | TS_ASSERT_UNEVAL_EQUALS(obj2, { | ||||
"successfulBribes": [11, 13, 17, 3], | "successfulBribes": [11, 13, 17, 3], | ||||
"unitsTrained": { | "unitsTrained": { | ||||
"Infantry": [19, 23, 5], | "Infantry": [19, 23, 5], | ||||
"Worker": [7] | "Worker": [7] | ||||
} | } | ||||
}); | }); | ||||
elexisAuthorUnsubmitted Done Inline ActionsNotice that PushValue just pushes everything as is, i.e. also Worker and Infantry even if this is not part of the so called tracked classes. elexis: Notice that `PushValue` just pushes everything as is, i.e. also Worker and Infantry even if… |
Wildfire Games · Phabricator
should be [29], see rP21250