Added google testing library
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "external/googletest"]
|
||||||
|
path = external/googletest
|
||||||
|
url = https://github.com/google/googletest.git
|
||||||
@@ -10,6 +10,11 @@ project(LXC_Project LANGUAGES CXX)
|
|||||||
# Makes .exes be outputted within the root directory #
|
# Makes .exes be outputted within the root directory #
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
|
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 #
|
# Adds the sub-directories of all of the binaries #
|
||||||
add_subdirectory(Lexer)
|
add_subdirectory(Lexer)
|
||||||
|
|
||||||
|
|||||||
1
external/googletest
vendored
Submodule
1
external/googletest
vendored
Submodule
Submodule external/googletest added at 7e17b15f15
12
tests/CMakeLists.txt
Normal file
12
tests/CMakeLists.txt
Normal 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
11
tests/src/LXC_Tests.cpp
Normal 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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user