From 8ebad95509bcdb9b04518c59577f4a3a41a580dd Mon Sep 17 00:00:00 2001 From: 30hours Date: Fri, 29 Dec 2023 01:08:49 +0000 Subject: [PATCH] Add missing file in CMakeLists (cheers Dan) --- test/README.md | 22 ++++++++--- test/unit/process/tracker/TestTracker.cpp | 47 +++++++++++++++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 test/unit/process/tracker/TestTracker.cpp diff --git a/test/README.md b/test/README.md index ac03fce..9767541 100644 --- a/test/README.md +++ b/test/README.md @@ -1,6 +1,6 @@ # blah2 Test -**TODO: Tests not implemented yet. Describing desired behaviour for the time being.** +A set of tests are provided for development/debugging. ## Framework @@ -18,14 +18,26 @@ The test files are split across directories defined by the type of test. All tests are compiled when building, however tests be run manually. -- Run a single test case for "TestClass". +- Run a single unit test for "TestClass". ``` -sudo docker compose run blah2-test TestClass +sudo docker exec -it blah2 /blah2/bin/test/unit/testClass ``` -- Run all test cases. +- Run a single functional test for "TestFunctional". ``` -sudo docker compose run blah2-test * +sudo docker exec -it blah2 /blah2/bin/test/functional/testFunctional +``` + +- Run a single comparison test for "TestComparison". + +``` +sudo docker exec -it blah2 /blah2/bin/test/comparison/testComparison +``` + +- *TODO:* Run all test cases. + +``` +sudo docker exec -it blah2 /blah2/bin/test/runall.sh ``` \ No newline at end of file diff --git a/test/unit/process/tracker/TestTracker.cpp b/test/unit/process/tracker/TestTracker.cpp new file mode 100644 index 0000000..95fb28f --- /dev/null +++ b/test/unit/process/tracker/TestTracker.cpp @@ -0,0 +1,47 @@ +/// @file TestTracker.cpp +/// @brief Unit test for Tracker.cpp +/// @author 30hours + +#define CATCH_CONFIG_MAIN +#include "catch_amalgamated.hpp" + +#include "Detection.h" +#include "Tracker.h" +#include "Track.h" +#include +#include +#include +#include + +/// @brief Test constructor. +/// @details Check constructor parameters created correctly. +TEST_CASE("Constructor", "[constructor]") +{ + uint32_t m = 3; + uint32_t n = 5; + uint32_t nDelete = 5; + double cpi = 0.5; + double maxAccInit = 10; + double rangeRes = 100; + Tracker tracker = Tracker(m, n, nDelete, cpi, maxAccInit, rangeRes); +} + +/// @brief Test process for an ACTIVE track. +TEST_CASE("Process ACTIVE track constant acc", "[process]") +{ + uint32_t m = 3; + uint32_t n = 5; + uint32_t nDelete = 5; + double cpi = 0.5; + double maxAccInit = 10; + double rangeRes = 100; + Tracker tracker = Tracker(m, n, nDelete, + cpi, maxAccInit, rangeRes); + + + // create detections with constant acc 5 Hz/s + std::vector delay = {10}; + std::vector doppler = {-20}; + + std::string state = "ACTIVE"; +} \ No newline at end of file