OpenTTD Source 20250911-master-gfe9093df96
history_func.cpp File Reference

Test functionality for misc/history_func. More...

#include "../stdafx.h"
#include "../3rdparty/catch2/catch.hpp"
#include "../misc/history_type.hpp"
#include "../misc/history_func.hpp"
#include "../safeguards.h"

Go to the source code of this file.

Functions

template<>
uint16_t SumHistory (std::span< const uint16_t > history)
 
template<typename T >
GetHistory (const HistoryData< T > &history, const HistoryRange &hr, uint age)
 Helper to get history records and return the value, instead returning its validity.
 
 TEST_CASE ("History Rotation and Reporting tests")
 

Detailed Description

Test functionality for misc/history_func.

Definition in file history_func.cpp.

Function Documentation

◆ GetHistory()

template<typename T >
T GetHistory ( const HistoryData< T > &  history,
const HistoryRange hr,
uint  age 
)

Helper to get history records and return the value, instead returning its validity.

Parameters
historyHistory data to extract from.
hrHistory range to get.
ageAge of data to get.
Returns
Historical value for the period and age.

Definition at line 34 of file history_func.cpp.

References GetHistory().

Referenced by GetHistory().

◆ SumHistory()

template<>
uint16_t SumHistory ( std::span< const uint16_t >  history)

Definition at line 20 of file history_func.cpp.

◆ TEST_CASE()

TEST_CASE ( "History Rotation and Reporting tests"  )

Definition at line 41 of file history_func.cpp.