Skip to content

Commit

Permalink
add tests directory
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Feb 12, 2024
1 parent b73fc38 commit fb21318
Show file tree
Hide file tree
Showing 6 changed files with 6,642 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
build_test
.vscode
.vimspector.json
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,13 @@ $ cmake --build build
$ ./build/Debug/fluent-tray-demo.exe
```

## Test

```sh
$ cmake -B build_test test
$ cmake --build build_test
$ ctest -C Debug --test-dir build_test --output-on-failure
```

## License
This library is provided by pit-ray under the [MIT License](./LICENSE.txt).
2 changes: 1 addition & 1 deletion demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(fluent-tray-demo VERSION 1.0)

add_compile_options(
/W4
/std:c++17
/std:c11
# /MT
/D_UNICODE
/DUNICODE
Expand Down
49 changes: 49 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 3.0.0)
project(fluent-tray-test VERSION 0.0.1)

enable_testing()

set(CMAKE_BUILD_TYPE Debug)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_compile_options(
/W4
/std:c11
/D_UNICODE
/DUNICODE
/DEBUG
/DDEBUG
/utf-8
)

include(ProcessorCount)
ProcessorCount(PROC_N)
set(
CMAKE_MAKE_PROGRAM
"${CMAKE_MAKE_PROGRAM} -j ${PROC_N}"
)

include_directories(../include)
add_library(doctest STATIC test.cpp)

file(
GLOB TEST_FILES
LIST_DIRECTORIES false
${CMAKE_CURRENT_SOURCE_DIR}/*test.cpp
)

add_executable(${PROJECT_NAME} ${TEST_FILES})
add_test(
NAME ${PROJECT_NAME}
COMMAND $<TARGET_FILE:${PROJECT_NAME}>
WORKING_DIRECTORY ..
)

set(
CMAKE_CTEST_ARGUMENTS
"${CMAKE_CTEST_ARGUMENTS} --verbose --no-label-summary --parallel ${PROC_N}"
)
Loading

0 comments on commit fb21318

Please sign in to comment.