print error if extract_setting() uses unknown setting string.

This commit is contained in:
Axel Kohlmeyer
2022-08-27 07:02:19 -04:00
parent 25ca4317be
commit b31b20f336
2 changed files with 15 additions and 1 deletions

View File

@ -380,6 +380,7 @@ TEST_F(VariableTest, Functions)
command("variable ten1 equal tan(v_eight/2.0)");
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)");
END_HIDE_OUTPUT();
ASSERT_GT(variable->compute_equal(variable->find("two")), 0.99);
@ -393,9 +394,18 @@ TEST_F(VariableTest, Functions)
ASSERT_FLOAT_EQ(variable->compute_equal(variable->find("ten1")), 1);
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);
TEST_FAILURE(".*ERROR: Variable four: Invalid syntax in variable formula.*",
command("print \"${four}\""););
TEST_FAILURE(".*ERROR on proc 0: Invalid immediate variable.*",
command("print \"$(extract_setting()\""););
TEST_FAILURE(".*ERROR on proc 0: Invalid immediate variable.*",
command("print \"$(extract_setting()\""););
TEST_FAILURE(".*ERROR: Invalid extract_setting.. function syntax in variable formula.*",
command("print \"$(extract_setting(one,two))\""););
TEST_FAILURE(".*ERROR: Unknown setting nprocs for extract_setting.. function in variable formula.*",
command("print \"$(extract_setting(nprocs))\""););
}
TEST_F(VariableTest, IfCommand)