add unit tests for new variable function

This commit is contained in:
Axel Kohlmeyer
2023-11-22 19:47:51 -05:00
parent 0db826ae77
commit 64573b7b32

View File

@ -400,6 +400,8 @@ TEST_F(VariableTest, Functions)
command("variable ten2 equal asin(-1.0)+acos(0.0)");
command("variable ten3 equal floor(100*random(0.2,0.8,v_seed)+1)");
command("variable ten4 equal extract_setting(world_size)");
command("variable ten5 equal ternary(v_one,1.1,-2.2)");
command("variable ten6 equal ternary(${one}==2.0,v_nine,v_ten)");
END_HIDE_OUTPUT();
ASSERT_GT(variable->compute_equal(variable->find("two")), 0.99);
@ -414,6 +416,8 @@ TEST_F(VariableTest, Functions)
ASSERT_GT(variable->compute_equal(variable->find("ten3")), 19);
ASSERT_LT(variable->compute_equal(variable->find("ten3")), 81);
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("ten4")), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("ten5")), 1.1);
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("ten6")), 3);
TEST_FAILURE(".*ERROR: Variable four: Invalid syntax in variable formula.*",
command("print \"${four}\""););