Skip to content

Commit

Permalink
more unit tests (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mast3rwaf1z authored Nov 28, 2024
1 parent 6d66517 commit 205915e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ target_link_libraries(sender

# Tests
enable_testing()
foreach(test ffmpeg utils hyperwall)
foreach(test ffmpeg utils hyperwall settings)
add_executable(test_${test} src/test/${test}.cpp ${PROJECT_IMPLEMENTATIONS})
target_link_libraries(test_${test}
${OpenCV_LIBS}
Expand Down
2 changes: 1 addition & 1 deletion scripts/tmux-ffplay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

for ((x=0;x<$2;x++)); do
for ((y=0;y<$3;y++)); do
tmux new-session -d ffplay rtsp://$1:8554/frame/$x/$y
tmux new-session -d ffplay rtsp://$1:8554/frame/$x/$y -window_title "frame-$x-$y"
done
done
9 changes: 9 additions & 0 deletions src/test/ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ TEST_CASE("test ffmpeg constructors") {
REQUIRE(y1 == y2);
}
}

TEST_CASE("test ffmpeg constexpr") {
if constexpr (Hyperwall::FFmpeg().framerate) {
REQUIRE(true);
}
else {
REQUIRE(false);
}
}
12 changes: 12 additions & 0 deletions src/test/settings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <catch2/catch_test_macros.hpp>

#include "Settings.hpp"

TEST_CASE("Test settings constexpr") {
if constexpr (Hyperwall::Settings().framerate) {
REQUIRE(true);
}
else {
REQUIRE(false);
}
}
9 changes: 9 additions & 0 deletions src/test/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ TEST_CASE("test utility functions: range") {
}
REQUIRE(r1 == r2);
}

TEST_CASE("test utility functions: range constexpr") {
if constexpr (Util::range(10) == Util::range(10)) {
REQUIRE(true);
}
else {
REQUIRE(false);
}
}

0 comments on commit 205915e

Please sign in to comment.