diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 35bab69c7d..29b985927d 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -403,11 +403,36 @@ TEST_F(VariableTest, IfCommand) text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, ContainsRegex(".*nope\?.*")); + BEGIN_CAPTURE_OUTPUT(); + command("if 0<1 then 'print \"bingo!\"'"); + text = END_CAPTURE_OUTPUT(); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); + + BEGIN_CAPTURE_OUTPUT(); + command("if 2<1 then 'print \"bingo!\"' else 'print \"nope?\"'"); + text = END_CAPTURE_OUTPUT(); + ASSERT_THAT(text, ContainsRegex(".*nope\?.*")); + BEGIN_CAPTURE_OUTPUT(); command("if (1<=0) then 'print \"bingo!\"' else 'print \"nope?\"'"); text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, ContainsRegex(".*nope\?.*")); + BEGIN_CAPTURE_OUTPUT(); + command("if (0<=0) then 'print \"bingo!\"' else 'print \"nope?\"'"); + text = END_CAPTURE_OUTPUT(); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); + + BEGIN_CAPTURE_OUTPUT(); + command("if (0>=1) then 'print \"bingo!\"' else 'print \"nope?\"'"); + text = END_CAPTURE_OUTPUT(); + ASSERT_THAT(text, ContainsRegex(".*nope\?.*")); + + BEGIN_CAPTURE_OUTPUT(); + command("if (1>=1) then 'print \"bingo!\"' else 'print \"nope?\"'"); + text = END_CAPTURE_OUTPUT(); + ASSERT_THAT(text, ContainsRegex(".*bingo!.*")); + BEGIN_CAPTURE_OUTPUT(); command("if (-1.0e-1<0.0E+0)|^(1<0) then 'print \"bingo!\"'"); text = END_CAPTURE_OUTPUT();