-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor test project to exist inside parent project
- Loading branch information
1 parent
fd8c477
commit 5bacbff
Showing
3 changed files
with
40 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
# Base64_Cpp | ||
Very basic [Base64](https://en.wikipedia.org/wiki/Base64) encoding/decoding solution in C++ | ||
|
||
Very basic [Base64](https://en.wikipedia.org/wiki/Base64) encoding/decoding solution in C++. | ||
|
||
## Dependencies | ||
|
||
- Google Test for the Unit Tests | ||
|
||
## Building | ||
|
||
To build the solution, navigate to the cloned GitHub directory and run: | ||
|
||
``` | ||
mkdir -p build | ||
cd build | ||
cmake .. | ||
make | ||
``` | ||
|
||
To build the application with tests: | ||
|
||
``` | ||
cmake -S . -B build -DBUILD_TESTS=true | ||
RUN cmake --build bin | ||
``` | ||
|
||
Google Test must be installed & configured to build & run unit tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,17 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
project(CppEarleyTest VERSION 1.1) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
# Test coverage flags | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") | ||
|
||
option(debug "Print out the locations of different things relative to source directory" OFF) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test) | ||
|
||
enable_testing() | ||
|
||
find_package(GTest REQUIRED) | ||
|
||
set(GRAMMAR_DIRECTORY "test_grammars") | ||
|
||
set(PROJECT_ROOT_DIRECTORY "${CMAKE_SOURCE_DIR}/../") | ||
set(TEST_DIRECTORY "${CMAKE_SOURCE_DIR}") | ||
|
||
if(${debug}) | ||
message("PROJECT_ROOT_DIRECTORY: ${PROJECT_ROOT_DIRECTORY}") | ||
message("TEST_DIRECTORY: ${TEST_DIRECTORY}") | ||
message("TEST_GRAMMAR_DIRECTORY: ${TEST_GRAMMAR_DIRECTORY}") | ||
endif() | ||
|
||
find_library(BASE_LIB base64 base64_shared | ||
HINTS ${PROJECT_ROOT_DIRECTORY} | ||
PATH_SUFFIXES /bin /bin/lib /build /build/lib | ||
REQUIRED) | ||
|
||
add_executable(app-test test.cpp) | ||
|
||
target_link_libraries(app-test ${CPP_EARLEY} ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) | ||
|
||
target_include_directories(app-test PUBLIC ${PROJECT_ROOT_DIRECTORY}/include ${PROJECT_ROOT_DIRECTORY}/src) | ||
target_link_libraries(app-test ${LIBRARY_NAME} ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) | ||
|
||
add_test(NAME app-test-test COMMAND app-test ${TEST_GRAMMAR_DIRECTORY}) | ||
target_include_directories(app-test PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) | ||
|
||
add_test(NAME app-test-test COMMAND app-test) |