From 8b7f2869b3461448a68a9516c4aa25d70b6f9579 Mon Sep 17 00:00:00 2001 From: Grigoris Pavlakis <grigpavl@ece.auth.gr> Date: Mon, 12 Aug 2019 01:11:22 +0300 Subject: [PATCH] Add TODOs --- inc/Services/ParameterService.hpp | 5 +++++ src/Services/ParameterService.cpp | 4 ++-- test/Services/ParameterService.cpp | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/inc/Services/ParameterService.hpp b/inc/Services/ParameterService.hpp index 19b3d89f..f214f764 100644 --- a/inc/Services/ParameterService.hpp +++ b/inc/Services/ParameterService.hpp @@ -8,6 +8,11 @@ // Number of stored parameters. MAX_PARAMS is just a dummy number for now. #define MAX_PARAMS 5 +// TODO: 1) Rework the parameter setting and report functions +// TODO: 2) Implement flags and use them above +// TODO: 3) Write more and better tests +// TODO: 4) Make sure that docs are up to date +// TODO: 5) Optimize stuff if possible /** * Implementation of the ST[20] parameter management service, diff --git a/src/Services/ParameterService.cpp b/src/Services/ParameterService.cpp index 86dbbcb1..c7dd1192 100644 --- a/src/Services/ParameterService.cpp +++ b/src/Services/ParameterService.cpp @@ -3,8 +3,8 @@ ParameterService::ParameterService() { // test addings - addNewParameter(3, 14); - addNewParameter(3, 14); +// addNewParameter(3, 14); +// addNewParameter(3, 14); } bool ParameterService::addNewParameter(uint8_t ptc, uint8_t pfc, uint32_t initialValue, UpdatePtr ptr) { diff --git a/test/Services/ParameterService.cpp b/test/Services/ParameterService.cpp index d21f32bd..da2e5294 100644 --- a/test/Services/ParameterService.cpp +++ b/test/Services/ParameterService.cpp @@ -5,7 +5,26 @@ ParameterService& pserv = Services.parameterManagement; +void foo(ValueType* bar) { // sample function + *bar = 0xDEADBEEF; +} + TEST_CASE("Parameter Report Subservice") { + + SECTION("Insertion test") { + pserv.addNewParameter(3, 14); // this one has ID 0 + pserv.addNewParameter(1, 7, 12); // this one has 1 + pserv.addNewParameter(4, 12, 3, nullptr); // this one has 2 + pserv.addNewParameter(12, 3, 6, &foo); // this one has 3 + } + + SECTION("ID checking") { + Message request(20, 1, Message::TC, 1); + Message report(20, 2, Message::TM, 1); + + request.appendUint16(2) + } + SECTION("Faulty Instruction Handling Test") { Message request(20, 1, Message::TC, 1); Message report(20, 2, Message::TM, 1); -- GitLab