diff --git a/.gitmodules b/.gitmodules index 2a78fe4..4a484ef 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "linklist-lib"] path = linklist-lib url = https://git.shimatta.de/mhu/linklist-lib.git +[submodule "test/catch2"] + path = test/catch2 + url = https://git.shimatta.de/3rd-party/catch2.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 4679b61..02aa016 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,3 +91,5 @@ else (DOXYGEN_FOUND) message("${BoldMagenta}Doxygen needs to be installed to generate the doxygen documentation${ColorReset}") message("${BoldMagenta}doxygen target will not be available${ColorReset}") endif (DOXYGEN_FOUND) + +add_subdirectory(test) diff --git a/bash-completion/patchelfcrc b/bash-completion/patchelfcrc new file mode 100644 index 0000000..8e1d388 --- /dev/null +++ b/bash-completion/patchelfcrc @@ -0,0 +1,9 @@ +#!/bin/bash + +function _patchelfcrc() { + echo "Cursor index: $COMP_CWORD" + echo "line as array: $COMP_WORDS" + echo "line as string: $COMP_LINE" +} + +complete -F _patchelfcrc patchelfcrc diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..9c26a15 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.5) + +project(patchelfcrc-test LANGUAGES CXX C) +add_subdirectory(catch2 EXCLUDE_FROM_ALL) + +add_custom_target(test "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}" "-r compact" "-s" DEPENDS ${PROJECT_NAME}) +aux_source_directory("src" TEST_SOURCES) +set(DUT_SOURCES ${CMAKE_CURRENT_LIST_DIR}/../src/crc.c) + +add_executable(${PROJECT_NAME} EXCLUDE_FROM_ALL ${TEST_SOURCES} ${DUT_SOURCES}) +target_link_libraries(${PROJECT_NAME} PRIVATE Catch2::Catch2WithMain) diff --git a/test/catch2 b/test/catch2 new file mode 160000 index 0000000..0631b60 --- /dev/null +++ b/test/catch2 @@ -0,0 +1 @@ +Subproject commit 0631b607ee2bbc07c7c238f0b15b23ef21926960