From e0f9f411056c235947b809cb21c477aa5acca1b4 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 3 Apr 2024 01:31:01 +0200 Subject: Fixed mission points reward calculation --- StarsEx/test/ShipStats.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 StarsEx/test/ShipStats.cpp (limited to 'StarsEx/test/ShipStats.cpp') diff --git a/StarsEx/test/ShipStats.cpp b/StarsEx/test/ShipStats.cpp new file mode 100644 index 0000000..1430573 --- /dev/null +++ b/StarsEx/test/ShipStats.cpp @@ -0,0 +1,29 @@ +#include + +#include +#include + + +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(); +} -- cgit v1.1