mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-10 04:35:03 -05:00
chore(compiler): skeleton of unittest with gtest
This commit is contained in:
committed by
Quentin Bourgerie
parent
6ac882fc65
commit
7850b359f3
@@ -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)
|
||||
|
||||
3
compiler/tests/CMakeLists.txt
Normal file
3
compiler/tests/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
if (ZAMALANG_UNIT_TESTS)
|
||||
add_subdirectory(unittest)
|
||||
endif()
|
||||
14
compiler/tests/unittest/CMakeLists.txt
Normal file
14
compiler/tests/unittest/CMakeLists.txt
Normal 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)
|
||||
|
||||
9
compiler/tests/unittest/hello_test.cc
Normal file
9
compiler/tests/unittest/hello_test.cc
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user