From d960d239898084153bdc2a4b51d102d25a575fe0 Mon Sep 17 00:00:00 2001 From: martin dobrev Date: Fri, 5 Oct 2018 09:31:34 +0300 Subject: Enhance test system usability --- JSImpl/src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'JSImpl/src/main.cpp') diff --git a/JSImpl/src/main.cpp b/JSImpl/src/main.cpp index 221ec52..4263bfa 100644 --- a/JSImpl/src/main.cpp +++ b/JSImpl/src/main.cpp @@ -5,18 +5,19 @@ #define EXECUTE_TEST(test) std::cout << #test << " "; test(); #define CHECK(cond) if (cond) {LOG("PASS");} else {LOG(#cond " FAIL");} +#define CHECK(cond) cond ? LOG("PASS") : LOG("FAIL") + // Lexer Tests void TestLess() { auto tokens = Tokenize("<"); CHECK(tokens.size() == 2 && tokens[0].Type == TokenType::Less); - } void TestNumber() { auto tokens = Tokenize("213434.24"); - CHECK(tokens.size() == 2 && tokens[0].Type == TokenType::Number && tokens[0].Number == 213434.24) + CHECK(tokens.size() == 2 && tokens[0].Type == TokenType::Number && tokens[0].Number == 213434.24); } void TestNumberStartWithNine() @@ -73,7 +74,6 @@ void TestParseUnaryExpr() { // TODO make actual test :D auto expr = Parse(Tokenize("function pesho() { var a = 0; return a; }")); - expr->Print(std::cout); } int main() -- cgit v1.3.1-23-gd82d