FIX: fixed bug with unpacking sim track and updated the tests for several changed parts

This commit is contained in:
Henry Winkel
2023-09-28 10:13:26 +02:00
parent dae304baec
commit a27b73a841
9 changed files with 36 additions and 191 deletions

View File

@@ -15,7 +15,6 @@ SCENARIO("Testing the SimCore Track")
{
GIVEN("different Attributes for a Track in different forms")
{
auto OwnID = SimCore::Identifier();
Eigen::Vector3d GeocentPos1;
GeocentPos1(SimCore::GeocentricPosition::X) = 3784014.333;
@@ -44,7 +43,7 @@ SCENARIO("Testing the SimCore Track")
WHEN("constructing Track Object with data")
{
SimCore::Position pos( GeocentPos1(SimCore::GeocentricPosition::X), GeocentPos1(SimCore::GeocentricPosition::Y), GeocentPos1(SimCore::GeocentricPosition::Z));
SimCore::SimTrack track(WHISPER::SourceType::SHIP,SimCore::EntityKind::LAND);
SimCore::SimTrack track("TEST",SimCore::Kind::EntityKind::LAND, SimCore::Side::FRIEND);
track.Speed.setValue(speed);
track.Course.setValue(course);
track.setPosition(pos1);
@@ -57,16 +56,18 @@ SCENARIO("Testing the SimCore Track")
track.addEmission(emi1);
serializedMSG = track.buildMessage(OwnID).serialize();
serializedMSG = track.buildMessage().serialize();
msg = std::make_shared<WHISPER::Message>(serializedMSG);
if (msg.get()->msgType_ == WHISPER::GROUND_TRUTH_TRACK) {
if (msg.get()->msgType_ == WHISPER::SIM_TRACK) {
LOG_S(INFO)<< msg.get()->topic_;
trackPtr = std::make_shared<SimCore::SimTrack>(std::move(SimCore::SimTrack::unpack(*msg)));
}
auto tmp = SimCore::SimTrack::unpack(serializedMSG);
// std::string trackstring = track.buildMessage(parentID).serialize();
SimCore::SimTrack trackDeserialized = SimCore::SimTrack::unpack(*msg);
@@ -77,6 +78,8 @@ SCENARIO("Testing the SimCore Track")
THEN("check if Track attributes are correct")
{
REQUIRE(tmp->getIdentifier().getUUID() == track.getIdentifier().getUUID());
REQUIRE(testOperator == true);
REQUIRE(track.Course.getValue() == course);
REQUIRE(track.Speed.getValue() == speed);
@@ -84,7 +87,7 @@ SCENARIO("Testing the SimCore Track")
REQUIRE(track.coutEmissions() > 0);
REQUIRE(track.getEmission(emi1.getID()).get()->getID() == idEmi);
// REQUIRE(msg.get()->msgType_ == WHISPER::GROUND_TRUTH_TRACK);
REQUIRE(msg.get()->msgType_ == WHISPER::SIM_TRACK);
REQUIRE(trackPtr->Speed.getValue() == speed);
REQUIRE(trackPtr->getPosition().getGeocentricPos() == GeocentPos1);