Skip to content

Commit

Permalink
fix(tests): added compatibility support for multiple types
Browse files Browse the repository at this point in the history
Signed-off-by: Rohith-Raju <rohithraju488@gmail.com>
  • Loading branch information
Rohith-Raju committed Mar 13, 2024
1 parent d65ca2d commit 7110ab9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Interpreter {

bool checkCompatibility(Token *op, Object left, Object right) {
if ((left.type == string_type && right.type == num_type) ||
right.type == num_type && left.type == string_type) {
left.type == num_type && right.type == string_type) {
return true;
} else {
return false;
Expand Down
1 change: 0 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "AstPrinter.h"
#include "Error.h"
#include "Interpreter.h"
#include "Scanner.h"
Expand Down
3 changes: 1 addition & 2 deletions test/TestInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,5 @@ TEST(IntrepreterTest, TestStringNumExpressions) {
Expr *expression2 = p2.parse();

ASSERT_EQ(Interpreter{}.interpret(expression1), "test8.000000");
// todo: test not passing ASSERT_EQ(Interpreter{}.interpret(expression2),
// "8.000000test");
ASSERT_EQ(Interpreter{}.interpret(expression2), "8.000000test");
}

0 comments on commit 7110ab9

Please sign in to comment.