mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 13:04:10 +00:00
Small StatisticsTracker test
Reviewed by: elexis Differential Revision: https://code.wildfiregames.com/D1305 This was SVN commit r21250.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
Engine.LoadComponentScript("StatisticsTracker.js");
|
||||
Engine.LoadComponentScript("interfaces/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 = {
|
||||
"successfulBribes": 3,
|
||||
"unitsTrained": {
|
||||
"Infantry": 5,
|
||||
"Worker": 7
|
||||
}
|
||||
};
|
||||
let obj2 = {
|
||||
"successfulBribes": [11, 13, 17],
|
||||
"unitsTrained": {
|
||||
"Infantry": [19, 23],
|
||||
"Worker": 29
|
||||
}
|
||||
};
|
||||
|
||||
cmpStatisticsTracker.PushValue(obj1, obj2);
|
||||
TS_ASSERT_UNEVAL_EQUALS(obj2, {
|
||||
"successfulBribes": [11, 13, 17, 3],
|
||||
"unitsTrained": {
|
||||
"Infantry": [19, 23, 5],
|
||||
"Worker": [7]
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user