Skip to content

Commit

Permalink
Added failing tests for #26 and #29
Browse files Browse the repository at this point in the history
  • Loading branch information
avighnac committed Jun 17, 2023
1 parent 90cf468 commit 77f9215
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a.out
libarithmetica-tui-lib.a
16 changes: 16 additions & 0 deletions tests/eval_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,20 @@ TEST(EvalTests, Test15) {
ASSERT_EQ(result, "arithmetica> eval (2*8+9)^(1/2)-(8-4)^(1/2)\\n \\n3\\n \\narithmetica> exit\\n");
result = call_arithmetica_tui("showsteps\neval (2*8+9)^(1/2)-(8-4)^(1/2)");
ASSERT_EQ(result, "arithmetica> showsteps\\nshowsteps is now true\\narithmetica> eval (2*8+9)^(1/2)-(8-4)^(1/2)\\n\\n 1 1 \\n==> (2 \xC3\x97 8 + 9)^(-) - (8 - 4)^(-)\\n 2 2 \\n ==> 2 \xC3\x97 8 + 9\\n ==> 16 + 9\\n ==> 25\\n 1 1 \\n==> (25)^(-) - (8 - 4)^(-)\\n 2 2 \\n ==> 8 - 4\\n ==> 4\\n 1 \\n==> (25)^(-) - (4)^(1/2)\\n 2 \\n 1 \\n==> (25)^(-) - 2\\n 2 \\n==> 5 - 2\\n==> 3\\n\\narithmetica> exit\\n");
}

TEST(EvalTests, Test16) {
std::string result;
result = call_arithmetica_tui("eval -(1)^(1/1)");
ASSERT_EQ(result, "arithmetica> eval -(1)^(1/1)\\n \\n-1\\n \\narithmetica> exit\\n");
result = call_arithmetica_tui("showsteps\neval -(1)^(1/1)");
ASSERT_EQ(result, "this test fails");
}

TEST(EvalTests, Test) {
std::string result;
result = call_arithmetica_tui("eval -1^(1/1)");
ASSERT_EQ(result, "arithmetica> eval -1^(1/1)\\n \\n-1\\n \\narithmetica> exit\\n");
result = call_arithmetica_tui("showsteps\neval -1^(1/1)");
ASSERT_EQ(result, "this test fails");
}

0 comments on commit 77f9215

Please sign in to comment.