Line data Source code
1 : #include "../../inc/parsingAnalysis/builder.h"
2 : #include <catch2/catch_test_macros.hpp>
3 : #include <memory>
4 :
5 : using namespace nicole;
6 :
7 9 : TEST_CASE("AST_UNARY class methods", "[AST_UNARY]") {
8 9 : Location loc{"file", 0, 0};
9 9 : Token token{TokenType::DECREMENT, "--", loc};
10 9 : auto astInt = *Builder::createInt(SourceLocation{token, token}, 42);
11 9 : AST_UNARY astDecrement{0, SourceLocation{token, token}, token, astInt};
12 :
13 9 : REQUIRE(astDecrement.op().raw() == "--");
14 9 : REQUIRE(astDecrement.value() == astInt);
15 9 : REQUIRE(std::dynamic_pointer_cast<AST_INT>(astDecrement.value())->value() ==
16 9 : 42);
17 9 : }
|