add more unit tests for boolean expressions
This commit is contained in:
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user