Skip to content

Commit

Permalink
Add test project stub
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingcitaldo125 committed Jun 26, 2021
1 parent c06795d commit 6c9ca33
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.10)

project(CppEarleyTest VERSION 1.0)

set(CMAKE_CXX_STANDARD 11)

find_package(GTest REQUIRED)

#[[
# Possible override for current test solution - requires hitting the internet each time ?
include(FetchContent)
FetchContent_Declare(
googletest
# Specify the commit you depend on and update it regularly.
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
]]

# Now simply link against gtest or gtest_main as needed. Eg
add_executable(app-test main.cpp)

#target_link_libraries(app-test gtest_main)
target_link_libraries(app-test ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)

add_test(NAME example_test COMMAND app-test)

12 changes: 12 additions & 0 deletions test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <limits.h>

#include "gtest/gtest.h"

namespace {

TEST(SampleTests, Sample) {
EXPECT_EQ(1, 1);
}

}

0 comments on commit 6c9ca33

Please sign in to comment.