blob: 14305736eefe1ceeba95cc1e1911f19cfade690e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <gtest/gtest.h>
#include <Clock.h>
#include <SimEvent.h>
TEST(StarsEx, EffectivePoints)
{
Clock::Init();
ShipStats::Initialize();
auto* first = ShipStats::Find("first");
ASSERT_NE(nullptr, first);
EXPECT_EQ(0, first->EffectivePoints());
first->SetFlightTime(590.0l);
EXPECT_EQ(0, first->EffectivePoints());
first->SetFlightTime(610.0l);
EXPECT_EQ(10, first->EffectivePoints());
first->SetFlightTime(1210.0l);
EXPECT_EQ(20, first->EffectivePoints());
const auto* destroyed = first->AddEvent(SimEvent::DESTROYED);
first->Summarize();
EXPECT_EQ(0, first->EffectivePoints());
auto* second = ShipStats::Find("second");
ASSERT_NE(nullptr, second);
const auto* docked = second->AddEvent(SimEvent::DOCK);
EXPECT_EQ(100, second->EffectivePoints());
ShipStats::Close();
Clock::Close();
}
|