2020-04-10 18:09:15 +00:00
|
|
|
#ifdef TESTS_BUILD
|
2022-02-05 12:59:15 +00:00
|
|
|
#include <doctest.h>
|
2020-04-10 18:09:15 +00:00
|
|
|
#include "../../src/Library/EffectParameter.hpp"
|
|
|
|
|
|
|
|
using namespace CreatureLib::Library;
|
2020-09-25 10:43:08 +00:00
|
|
|
TEST_CASE("Bool EffectParameter") {
|
2020-04-10 18:09:15 +00:00
|
|
|
auto p = EffectParameter(true);
|
|
|
|
REQUIRE(p.AsBool());
|
|
|
|
auto p2 = EffectParameter(false);
|
|
|
|
REQUIRE_FALSE(p2.AsBool());
|
|
|
|
}
|
|
|
|
|
2020-09-25 10:43:08 +00:00
|
|
|
TEST_CASE("Int EffectParameter") {
|
2022-03-23 12:56:45 +00:00
|
|
|
auto p = EffectParameter((i64)684);
|
2020-04-10 18:09:15 +00:00
|
|
|
REQUIRE(p.AsInt() == 684);
|
2020-05-03 19:08:27 +00:00
|
|
|
REQUIRE(p.AsFloat() == 684);
|
2020-04-10 18:09:15 +00:00
|
|
|
}
|
|
|
|
|
2020-09-25 10:43:08 +00:00
|
|
|
TEST_CASE("String EffectParameter") {
|
2020-06-26 15:08:23 +00:00
|
|
|
auto p = EffectParameter((ArbUt::StringView) "foobar"_cnc);
|
2020-04-10 19:05:44 +00:00
|
|
|
REQUIRE(p.AsString() == "foobar");
|
|
|
|
}
|
|
|
|
|
2020-09-25 10:43:08 +00:00
|
|
|
TEST_CASE("Float EffectParameter") {
|
2020-04-10 19:05:44 +00:00
|
|
|
auto p = EffectParameter(1.5f);
|
2020-09-25 10:43:08 +00:00
|
|
|
REQUIRE(p.AsFloat() == doctest::Approx(1.5f));
|
2020-05-03 19:08:27 +00:00
|
|
|
REQUIRE(p.AsInt() == 1);
|
2020-04-10 18:09:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|