Skip to content

Commit

Permalink
A pass on warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-dejoue committed Aug 7, 2023
1 parent 0ae7bf5 commit fb40aab
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:

- name: Test stdutils
working-directory: ${{github.workspace}}/build
run: cmake --build . --target stdutils_run_utests --config ${{env.BUILD_TYPE}}
run: cmake --build . --target run_utests_stdutils --config ${{env.BUILD_TYPE}}

- name: Test picross
working-directory: ${{github.workspace}}/build
run: cmake --build . --target picross_run_utests --config ${{env.BUILD_TYPE}}
run: cmake --build . --target run_utests_picross --config ${{env.BUILD_TYPE}}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Build and run unit tests:

```
cmake -G "Visual Studio 17 2022" -DPICROSS_BUILD_TESTS=ON ..
cmake --build . --target picross_run_utests --config Debug
cmake --build . --target run_utests_picross --config Debug
```

### Install
Expand Down Expand Up @@ -193,7 +193,7 @@ Run the CLI on the example file:
Use the validation mode to test multiple files at once and check the uniqueness of the solution.
- Output one line per puzzle, in a comma-separated format.
- Validation is `OK` if the puzzle is valid and has a unique solution
- Difficulty hint: `LINE` for puzzles that are line solvable, `BRANCH` for puzzles that have a unique solution but are not line solvable, and `MULT` for grids with multiple solutions.
- Difficulty hint: `LINE` for puzzles that are line solvable, `BRANCH` for puzzles that have a unique solution but are not line solvable, and `MULT` for grids with multiple solutions.
- Performance timing

For example:
Expand Down
14 changes: 8 additions & 6 deletions src/tests/picross/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@ set(UTESTS_SOURCES

file(GLOB UTESTS_HEADERS src/*.h)

add_executable(picross_utests ${UTESTS_SOURCES} ${UTESTS_HEADERS})
add_executable(utests_picross ${UTESTS_SOURCES} ${UTESTS_HEADERS})

target_include_directories(picross_utests
set_target_warnings(utests_picross ON)

target_include_directories(utests_picross
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../picross/src
)

target_link_libraries(picross_utests
target_link_libraries(utests_picross
PRIVATE
Catch2::Catch2WithMain
picross::picross
picross::utils
)

set_property(TARGET picross_utests PROPERTY FOLDER "tests")
set_property(TARGET utests_picross PROPERTY FOLDER "tests")

add_custom_target(picross_run_utests
$<TARGET_FILE:picross_utests> --skip-benchmarks
add_custom_target(run_utests_picross
$<TARGET_FILE:utests_picross> --skip-benchmarks
COMMENT "Run Picross library UTests:"
)
2 changes: 1 addition & 1 deletion src/tests/picross/src/bench_line_alternatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ TEST_CASE("Bench linear vs full reduction", "[line_alternatives]")
const auto min_line_length = constraint.min_line_size();
CHECK(min_line_length == 11);
constexpr unsigned int max_extra_zeros = 16;
FullReductionBuffers buffers(constraint.nb_segments(), min_line_length + max_extra_zeros);
FullReductionBuffers buffers(static_cast<unsigned int>(constraint.nb_segments()), min_line_length + max_extra_zeros);
for (unsigned int extra_zeros = 2; extra_zeros <= max_extra_zeros; extra_zeros += 2)
{
const unsigned int nb_alt = ((extra_zeros + 1) * (extra_zeros + 2) * (extra_zeros + 3)) / 6;
Expand Down
4 changes: 0 additions & 4 deletions src/tests/picross/src/test_line_alternatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ TEST_CASE("full_reduction_of_a_trivially_solvable_line", "[line_alternatives]")
// Test based on the puzzle webpbn-10810.non "Centerpiece"
TEST_CASE("centerpiece-webpbn-10810-row-8", "[line_alternatives]")
{
constexpr auto MAX = BinomialCoefficients::overflowValue();

const LineConstraint constraint(Line::ROW, { 2,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,2 });
const auto min_line_size = constraint.min_line_size();
CHECK(min_line_size == 51);
Expand All @@ -263,8 +261,6 @@ TEST_CASE("centerpiece-webpbn-10810-row-8", "[line_alternatives]")
// Test based on the puzzle webpbn-10810.non "Centerpiece"
TEST_CASE("centerpiece-webpbn-10810-row-9", "[line_alternatives]")
{
constexpr auto MAX = BinomialCoefficients::overflowValue();

const LineConstraint constraint(Line::ROW, { 1,1,1,2,2,2,2,2,2,2,2,2,1,1,1 });
const auto min_line_size = constraint.min_line_size();
CHECK(min_line_size == 38);
Expand Down
12 changes: 7 additions & 5 deletions src/tests/stdutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ set(UTESTS_SOURCES

file(GLOB UTESTS_HEADERS src/*.h)

add_executable(stdutils_utests ${UTESTS_SOURCES} ${UTESTS_HEADERS})
add_executable(utests_stdutils ${UTESTS_SOURCES} ${UTESTS_HEADERS})

target_link_libraries(stdutils_utests
set_target_warnings(utests_stdutils ON)

target_link_libraries(utests_stdutils
PRIVATE
Catch2::Catch2WithMain
stdutils
)

set_property(TARGET stdutils_utests PROPERTY FOLDER "tests")
set_property(TARGET utests_stdutils PROPERTY FOLDER "tests")

add_custom_target(stdutils_run_utests
$<TARGET_FILE:stdutils_utests> --skip-benchmarks
add_custom_target(run_utests_stdutils
$<TARGET_FILE:utests_stdutils> --skip-benchmarks
COMMENT "Run stdutils library UTests:"
)

0 comments on commit fb40aab

Please sign in to comment.