mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
2 Commits
0972d3373f
...
b24ceb27f5
Author | SHA1 | Date |
---|---|---|
|
b24ceb27f5 | |
|
7feaac5391 |
|
@ -46,13 +46,14 @@ T GetHistory(const HistoryData<T> &history, uint period, uint age)
|
||||||
TEST_CASE("History Rotation and Reporting tests")
|
TEST_CASE("History Rotation and Reporting tests")
|
||||||
{
|
{
|
||||||
HistoryData<uint16_t> history{};
|
HistoryData<uint16_t> history{};
|
||||||
uint64_t valid_history = 0;
|
ValidHistoryMask valid_history = 0;
|
||||||
|
|
||||||
/* Fill the history with decreasing data points for 24 years of history. This ensures that no data period should
|
/* Fill the history with decreasing data points for 24 years of history. This ensures that no data period should
|
||||||
* contain the same value as another period. */
|
* contain the same value as another period. */
|
||||||
uint16_t i = 12 * HISTORY_PERIODS;
|
uint16_t i = 12 * HISTORY_PERIODS;
|
||||||
for (uint date = 1; date <= 12 * HISTORY_PERIODS; ++date, --i) {
|
for (uint date = 1; date <= 12 * HISTORY_PERIODS; ++date, --i) {
|
||||||
history[THIS_MONTH] = i;
|
history[THIS_MONTH] = i;
|
||||||
|
UpdateValidHistory(valid_history, date % 12);
|
||||||
RotateHistory(history, valid_history, date % 12);
|
RotateHistory(history, valid_history, date % 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue