Started adding unit tests
This commit is contained in:
2
test/src/format.cpp
Normal file
2
test/src/format.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#include <format.h>
|
||||
#include <gtest/gtest.h>
|
||||
18
test/src/parse.cpp
Normal file
18
test/src/parse.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <parse.h>
|
||||
|
||||
TEST(Parse, ast_node) {
|
||||
ast_node_t ast_node1{'a'};
|
||||
ast_node_t ast_node2{'a'};
|
||||
ast_node_t ast_node3{'b'};
|
||||
|
||||
EXPECT_EQ(ast_node1 == ast_node2, true);
|
||||
EXPECT_EQ(ast_node1 == ast_node3, false);
|
||||
}
|
||||
|
||||
TEST(Parse, chars_only) {
|
||||
constexpr std::array<ast_node_t, 8> control = {'a', 'b', 'c', 'd',
|
||||
'e', 'f', 'g', 'h'};
|
||||
|
||||
EXPECT_EQ(detail::parse_string<"abcdefgh">().value, control);
|
||||
}
|
||||
9
test/src/utility.cpp
Normal file
9
test/src/utility.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <utility.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Utility, const_pow) {
|
||||
EXPECT_EQ(detail::const_pow(10, 0), 1);
|
||||
EXPECT_EQ(detail::const_pow(0, 1), 0);
|
||||
EXPECT_EQ(detail::const_pow(2, 8), 0b1'0000'0000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user