hoolang/tests/literal_tests.cpp
2024-11-28 01:42:58 +05:30

16 lines
483 B
C++

#include "Compiler.hpp"
#include "Node.hpp"
#include <gtest/gtest.h>
TEST(IntegerTest, Literal)
{
auto compiler = new Compiler("1;", "main");
auto result = compiler->compile();
auto integer = std::any_cast<Node>(result);
ASSERT_EQ(integer.getNodeType(), NODE_LITERAL);
ASSERT_EQ(integer.getDataType(), DATATYPE_INTEGER);
ASSERT_EQ(integer.getValue(), llvm::ConstantInt::get(llvm::Type::getInt64Ty(*compiler->getContext()), 1, true));
delete compiler;
}