CreatureLib/tests/LibraryTests/EffectParameterTests.cpp

30 lines
822 B
C++
Raw Normal View History

2020-04-10 18:09:15 +00:00
#ifdef TESTS_BUILD
#include "../../extern/catch.hpp"
#include "../../src/Library/EffectParameter.hpp"
using namespace CreatureLib::Library;
TEST_CASE("Bool EffectParameter", "[Library]") {
auto p = EffectParameter(true);
REQUIRE(p.AsBool());
auto p2 = EffectParameter(false);
REQUIRE_FALSE(p2.AsBool());
}
TEST_CASE("Int EffectParameter", "[Library]") {
auto p = EffectParameter((int64_t)684);
REQUIRE(p.AsInt() == 684);
REQUIRE(p.AsFloat() == 684);
2020-04-10 18:09:15 +00:00
}
TEST_CASE("String EffectParameter", "[Library]") {
2020-05-26 16:31:06 +00:00
auto p = EffectParameter((ArbUt::CaseInsensitiveConstString) "foobar"_cnc);
REQUIRE(p.AsString() == "foobar");
}
TEST_CASE("Float EffectParameter", "[Library]") {
auto p = EffectParameter(1.5f);
REQUIRE(p.AsFloat() == Approx(1.5f));
REQUIRE(p.AsInt() == 1);
2020-04-10 18:09:15 +00:00
}
#endif