ADD: added tracklist update and systemstate update messages with tests and some improvements of simtrack
This commit is contained in:
59
tests/test_TracklistUpdate.cpp
Normal file
59
tests/test_TracklistUpdate.cpp
Normal 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
|
||||
Reference in New Issue
Block a user