diff options
Diffstat (limited to 'universe/tests')
-rw-r--r-- | universe/tests/TurretType.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/universe/tests/TurretType.cpp b/universe/tests/TurretType.cpp new file mode 100644 index 0000000..7ce70c0 --- /dev/null +++ b/universe/tests/TurretType.cpp @@ -0,0 +1,49 @@ +#include <gtest/gtest.h> + +#include <kurator/universe/TurretType.h> + + +namespace kurator +{ +namespace tests +{ + + +const universe::TurretType LOW { + "", + 1, + 10.0, + 1.0, + 0.0, + 1000.0, + 0.05, + 0.2, +}; + + +const universe::TurretType HIGH { + "", + 1, + 1000.0, + 1.0, + 0.0, + 1000.0, + 0.05, + 0.2, +}; + + + +TEST(TurretType, effective_range) +{ + const auto low = LOW.effective_range(); + EXPECT_LE(1.0, LOW.range_modifier(low - 1.0) * LOW.base_damage); + EXPECT_GE(1.0, LOW.range_modifier(low + 1.0) * LOW.base_damage); + const auto high = HIGH.effective_range(); + EXPECT_LE(1.0, HIGH.range_modifier(high - 1.0) * HIGH.base_damage); + EXPECT_GE(1.0, HIGH.range_modifier(high + 1.0) * HIGH.base_damage); +} + + +} // namespace tests +} // namespace kurator |