chore(compiler): skeleton of unittest with gtest

This commit is contained in:
youben11
2021-08-18 16:23:32 +01:00
committed by Quentin Bourgerie
parent 6ac882fc65
commit 7850b359f3
4 changed files with 32 additions and 0 deletions

View File

@@ -58,11 +58,17 @@ else()
message(STATUS "ZamaLang Python bindings are disabled.")
endif()
#-------------------------------------------------------------------------------
# Unit tests
#-------------------------------------------------------------------------------
option(ZAMALANG_UNIT_TESTS "Enables the build of unittests" ON)
add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(src)
add_subdirectory(tests)
if (ZAMALANG_BINDINGS_PYTHON_ENABLED)
add_subdirectory(python)

View File

@@ -0,0 +1,3 @@
if (ZAMALANG_UNIT_TESTS)
add_subdirectory(unittest)
endif()

View File

@@ -0,0 +1,14 @@
enable_testing()
add_executable(
hello_test
hello_test.cc
)
target_link_libraries(
hello_test
gtest_main
)
include(GoogleTest)
gtest_discover_tests(hello_test)

View File

@@ -0,0 +1,9 @@
#include <gtest/gtest.h>
// Demonstrate some basic assertions.
TEST(HelloTest, BasicAssertions) {
// Expect two strings not to be equal.
EXPECT_STRNE("hello", "world");
// Expect equality.
EXPECT_EQ(7 * 6, 42);
}