LCOV - code coverage report
Current view: top level - test/parsingAnalysis - test_ast_pointers.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 26 26
Test Date: 2025-04-18 15:53:49 Functions: 100.0 % 3 3

            Line data    Source code
       1              : #include "../../inc/parsingAnalysis/builder.h"
       2              : #include <catch2/catch_test_macros.hpp>
       3              : #include <memory>
       4              : #include <string>
       5              : 
       6              : using namespace nicole;
       7              : 
       8            9 : TEST_CASE("AST_DELETE class methods", "[AST_DELETE]") {
       9            9 :   Location loc{"file", 0, 0};
      10            9 :   Token token{TokenType::OPERATOR_ADD, "+", loc};
      11            9 :   auto value = *Builder::createBool(SourceLocation{token, token}, true);
      12            9 :   AST_DELETE astDelete{0, SourceLocation{token, token}, value};
      13              : 
      14            9 :   REQUIRE(astDelete.value() == value);
      15            9 :   REQUIRE(std::dynamic_pointer_cast<AST_BOOL>(astDelete.value())->value() ==
      16            9 :           true);
      17            9 : }
      18              : 
      19            9 : TEST_CASE("AST_DEREF class methods", "[AST_DEREF]") {
      20            9 :   Location loc{"file", 0, 0};
      21            9 :   Token token{TokenType::OPERATOR_ADD, "+", loc};
      22            9 :   auto value = *Builder::createBool(SourceLocation{token, token}, false);
      23            9 :   AST_DEREF astDeref{0, SourceLocation{token, token}, value};
      24              : 
      25            9 :   REQUIRE(astDeref.value() == value);
      26            9 :   REQUIRE(std::dynamic_pointer_cast<AST_BOOL>(astDeref.value())->value() ==
      27            9 :           false);
      28            9 : }
      29              : 
      30            9 : TEST_CASE("AST_NEW class methods", "[AST_NEW]") {
      31            9 :   Location loc{"file", 0, 0};
      32            9 :   Token token{TokenType::OPERATOR_ADD, "+", loc};
      33            9 :   auto value = *Builder::createBool(SourceLocation{token, token}, true);
      34            9 :   AST_NEW astNew{0, SourceLocation{token, token}, value};
      35              : 
      36            9 :   REQUIRE(astNew.value() == value);
      37            9 :   REQUIRE(std::dynamic_pointer_cast<AST_BOOL>(astNew.value())->value() == true);
      38            9 : }
        

Generated by: LCOV version 2.0-1