30 lines
746 B
C++
30 lines
746 B
C++
#ifdef TESTS_BUILD
|
|
#include <doctest.h>
|
|
#include "../../src/Library/EffectParameter.hpp"
|
|
|
|
using namespace CreatureLib::Library;
|
|
TEST_CASE("Bool EffectParameter") {
|
|
auto p = EffectParameter(true);
|
|
REQUIRE(p.AsBool());
|
|
auto p2 = EffectParameter(false);
|
|
REQUIRE_FALSE(p2.AsBool());
|
|
}
|
|
|
|
TEST_CASE("Int EffectParameter") {
|
|
auto p = EffectParameter((i64)684);
|
|
REQUIRE(p.AsInt() == 684);
|
|
REQUIRE(p.AsFloat() == 684);
|
|
}
|
|
|
|
TEST_CASE("String EffectParameter") {
|
|
auto p = EffectParameter((ArbUt::StringView) "foobar"_cnc);
|
|
REQUIRE(p.AsString() == "foobar");
|
|
}
|
|
|
|
TEST_CASE("Float EffectParameter") {
|
|
auto p = EffectParameter(1.5f);
|
|
REQUIRE(p.AsFloat() == doctest::Approx(1.5f));
|
|
REQUIRE(p.AsInt() == 1);
|
|
}
|
|
|
|
#endif |