16 lines
483 B
C++
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;
|
|
}
|