mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-18 06:13:55 -07:00
Amongst other issues encountered in the lobby ranking session statistics
reporting, refs #5387, D2385, bffe917914.
Correct test case from 59e7320a49/D1305.
Differential Revision: https://code.wildfiregames.com/D2384
Comments By: Freagarach
This was SVN commit r23086.
42 lines
973 B
JavaScript
42 lines
973 B
JavaScript
Engine.LoadComponentScript("interfaces/Timer.js");
|
|
Engine.LoadComponentScript("interfaces/StatisticsTracker.js");
|
|
Engine.LoadComponentScript("StatisticsTracker.js");
|
|
|
|
AddMock(SYSTEM_ENTITY, IID_Timer, {
|
|
"SetInterval": () => true
|
|
});
|
|
|
|
Resources = {
|
|
"GetCodes": () => ["food", "metal", "stone", "wood"]
|
|
};
|
|
|
|
let cmpStatisticsTracker = ConstructComponent(SYSTEM_ENTITY, "StatisticsTracker", {
|
|
"UnitClasses": { "_string": "Infantry FishingBoat" },
|
|
"StructureClasses": { "_string": "House Wonder" }
|
|
});
|
|
|
|
let fromData = {
|
|
"successfulBribes": 3,
|
|
"unitsTrained": {
|
|
"Infantry": 5,
|
|
"Worker": 7
|
|
}
|
|
};
|
|
|
|
let toData = {
|
|
"successfulBribes": [11, 13, 17],
|
|
"unitsTrained": {
|
|
"Infantry": [19, 23],
|
|
"Worker": [29]
|
|
}
|
|
};
|
|
|
|
// This function pushes without testing for Identity classes
|
|
cmpStatisticsTracker.PushValue(fromData, toData);
|
|
TS_ASSERT_UNEVAL_EQUALS(toData, {
|
|
"successfulBribes": [11, 13, 17, 3],
|
|
"unitsTrained": {
|
|
"Infantry": [19, 23, 5],
|
|
"Worker": [29, 7]
|
|
}
|
|
});
|