ADD: added tracklist update and systemstate update messages with tests and some improvements of simtrack

This commit is contained in:
Henry Winkel
2023-12-19 13:30:35 +01:00
parent d345fd5bc3
commit f83852bf6b
25 changed files with 4509 additions and 147 deletions

View File

@@ -0,0 +1,59 @@
#include "SimCore/Identifier.hpp"
#include "SimCore/Messages/SimTrack.hpp"
#include "SimCore/Position.hpp"
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <string>
#include <SimCore/Messages/TracklistUpdate.hpp>
SCENARIO("Testing the SimCore Sensor")
{
GIVEN("different Attributes for a Track in different forms")
{
SimCore::Identifier OwnID;
SimCore::TracklistUpdate update(OwnID);
SimCore::SimTrack track1;
track1.Course.setValue(273);
track1.Speed.setValue(11);
track1.Pitch.setValue(45);
SimCore::Position pos1;
pos1.setGeodesicPos(55, 10, 0);
track1.setPosition(pos1);
update.addTrack(track1);
WHEN("constructing Track Object with data")
{
auto msg = update.buildMessage().serialize();
auto resMess = WHISPER::Message(msg);
auto resUpdate = SimCore::TracklistUpdate::unpack(resMess);
THEN("check if Track attributes are correct")
{
REQUIRE(update.getOwnID() == OwnID);
REQUIRE(update.getTracks().size() == 1);
REQUIRE(resMess.msgType_ == WHISPER::MsgType::TRACKLIST_UPDATE);
REQUIRE(resUpdate->getOwnID() == OwnID);
REQUIRE(resUpdate->getTracks().size() == 1);
REQUIRE(resUpdate->getTracks()[0].getIdentifier() == track1.getIdentifier());
REQUIRE(resUpdate->getTracks()[0].Course.getValue() == 273);
REQUIRE(resUpdate->getTracks()[0].Speed.getValue() == 11);
REQUIRE(resUpdate->getTracks()[0].Pitch.getValue() == 45);
REQUIRE(resUpdate->getTracks()[0].getPosition() == pos1);
} //THEN
} // WHEN
} // GIVEN
} //SCENARIO