Merged from development, added unit test for config file handler, removed obsolete stuff from handler
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
target_sources(${UNITTEST_NAME} PRIVATE
|
||||
testThermalController.cpp
|
||||
)
|
||||
testAcsController.cpp
|
||||
testConfigFileHandler.cpp
|
||||
)
|
||||
|
41
unittest/controller/testAcsController.cpp
Normal file
41
unittest/controller/testAcsController.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <mission/controller/ThermalController.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "../testEnvironment.h"
|
||||
#include "rapidcsv.h"
|
||||
|
||||
TEST_CASE("ACS Controller", "[AcsController]") {
|
||||
SECTION("SectionTest") {
|
||||
// acsCtrl.performOperation();
|
||||
CHECK(1 == 1);
|
||||
|
||||
try {
|
||||
{
|
||||
std::ifstream file("unittest/meineTestDaten.txt");
|
||||
if (file.good()) {
|
||||
std::string line;
|
||||
while (std::getline(file, line)) {
|
||||
std::cout << "ACS CTRL Test test file: " << line << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
rapidcsv::Document doc("unittest/meineTestDaten.txt");
|
||||
std::vector<int> col = doc.GetColumn<int>("test0");
|
||||
std::cout << "Read " << col.size() << " values: " << col[0] << ", " << col[1] << std::endl;
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
sif::warning << "CSV file test exception occured: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
REQUIRE(2 == 2);
|
||||
}
|
||||
|
||||
SECTION("SectionTest2") {}
|
||||
}
|
19
unittest/controller/testConfigFileHandler.cpp
Normal file
19
unittest/controller/testConfigFileHandler.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
#include <mission/utility/GlobalConfigHandler.h>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "../testEnvironment.h"
|
||||
#include <objects/systemObjectList.h>
|
||||
|
||||
TEST_CASE("Configfile Handler", "[ConfigHandler]") {
|
||||
|
||||
GlobalConfigHandler confighandler= GlobalConfigHandler(objects::CONFIG_TEST,"JSON.config");
|
||||
sif::debug<<"Testcase config file handler"<<std::endl;
|
||||
|
||||
REQUIRE(confighandler.initialize() == HasReturnvaluesIF::RETURN_OK);
|
||||
|
||||
}
|
@ -42,4 +42,4 @@ TEST_CASE("Thermal Controller", "[ThermalController]") {
|
||||
componentTemperatures.commit();
|
||||
|
||||
QueueFactory::instance()->deleteMessageQueue(commandQueue);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user