Added google testing library

This commit is contained in:
Pasha Bibko
2025-07-22 19:13:09 +01:00
parent 9fb3816160
commit 829d4c224a
5 changed files with 32 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "external/googletest"]
path = external/googletest
url = https://github.com/google/googletest.git

View File

@@ -10,6 +10,11 @@ project(LXC_Project LANGUAGES CXX)
# Makes .exes be outputted within the root directory #
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
# Adds the G-Tests #
enable_testing()
add_subdirectory(external/googletest)
add_subdirectory(tests)
# Adds the sub-directories of all of the binaries #
add_subdirectory(Lexer)

1
external/googletest vendored Submodule

Submodule external/googletest added at 7e17b15f15

12
tests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,12 @@
# Creates the binary to run the tests #
file (GLOB TestSources src/*.cpp inc/*.h)
add_executable(LXC_Tests ${TestSources})
# Links with GoogleTest #
target_link_libraries(LXC_Tests
gtest
gtest_main
)
# Registers the test #
include(GoogleTest)

11
tests/src/LXC_Tests.cpp Normal file
View File

@@ -0,0 +1,11 @@
#include <gtest/gtest.h>
TEST(IWantSomeTestsToPass, BasicTest1)
{
EXPECT_EQ(1 + 1, 2);
}
TEST(IWantSomeTestsToPass, BasicTest2)
{
EXPECT_EQ(1 + 2, 2);
}