Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bkueng committed Aug 2, 2023
1 parent cae825a commit 0fb7667
Show file tree
Hide file tree
Showing 6 changed files with 403 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@


include(FetchContent)
FetchContent_Declare(
DocTest
GIT_REPOSITORY "https://github.com/doctest/doctest.git"
GIT_TAG "v2.4.11"
SYSTEM
)

FetchContent_MakeAvailable(DocTest)


add_executable(tests
main.cpp
ulog_parsing_test.cpp
)

target_link_libraries(tests PUBLIC
doctest::doctest
ulog_cpp::ulog_cpp
)

add_custom_target(
run-unit-tests
COMMAND $<TARGET_FILE:tests>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
USES_TERMINAL
)
Binary file added test/log_files/sample.ulg
Binary file not shown.
Binary file added test/log_files/sample_log_small.ulg
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/****************************************************************************
* Copyright (c) 2023 PX4 Development Team.
* SPDX-License-Identifier: BSD-3-Clause
****************************************************************************/

#define DOCTEST_CONFIG_IMPLEMENT
#include <doctest/doctest.h>

int main(int argc, char** argv)
{
doctest::Context context;
context.applyCommandLine(argc, argv);
return context.run();
}
Loading

0 comments on commit 0fb7667

Please sign in to comment.