diff options
Diffstat (limited to 'StarsEx/test')
-rw-r--r-- | StarsEx/test/ShipStats.cpp | 29 | ||||
-rw-r--r-- | StarsEx/test/dump_missions.cpp | 1 |
2 files changed, 30 insertions, 0 deletions
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 <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(); +} diff --git a/StarsEx/test/dump_missions.cpp b/StarsEx/test/dump_missions.cpp new file mode 100644 index 0000000..a0e5ffc --- /dev/null +++ b/StarsEx/test/dump_missions.cpp @@ -0,0 +1 @@ +int dump_missions = 0; |