FIX: fixed bug with unpacking sim track and updated the tests for several changed parts
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/IdentifierMaker.hpp"
|
||||
#include <SimCore/Messages/GroundThruthTrack.hpp>
|
||||
#include "SimCore/Messages/SimTrack.hpp"
|
||||
#include <WHISPER/Messages/Message.hpp>
|
||||
#include <SimCore/SimCore.hpp>
|
||||
#include <algorithm>
|
||||
@@ -31,8 +31,7 @@ SCENARIO("Testing the SimCore Track")
|
||||
|
||||
std::shared_ptr<WHISPER::Message> msg = NULL;
|
||||
|
||||
std::shared_ptr<SimCore::GroundTruthTrack> trackPtr = NULL;
|
||||
SimCore::Identifier parentID(0,1,false);
|
||||
std::shared_ptr<SimCore::SimTrack> trackPtr = NULL;
|
||||
SimCore::IdentifierMaker IDMaker;
|
||||
auto ID = IDMaker.getNewIdentifier(1,SimCore::ObjectSource::EXTERNAL);
|
||||
|
||||
@@ -42,40 +41,37 @@ 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::GroundTruthTrack track(WHISPER::SourceType::SHIP,*ID.get(),SimCore::TrackKind::GROUND_TRUTH_TRACK);
|
||||
track.setCourse(course);
|
||||
track.setSpeed(speed);
|
||||
SimCore::SimTrack track("TEST",SimCore::Kind::SURFACE,SimCore::Side::FRIEND);
|
||||
track.Course.setValue(course);
|
||||
track.Speed.setValue(speed);
|
||||
track.setPosition(GeocentPos1(SimCore::X),GeocentPos1(SimCore::Y),GeocentPos1(SimCore::Z));
|
||||
|
||||
if (track.getPostion() == pos) {
|
||||
if (track.getPosition() == pos) {
|
||||
testOperator = true;
|
||||
}
|
||||
serializedMSG = track.buildMessage(parentID).serialize();
|
||||
serializedMSG = track.buildMessage().serialize();
|
||||
msg = std::make_shared<WHISPER::Message>(serializedMSG);
|
||||
|
||||
if (msg.get()->msgType_ == WHISPER::GROUND_TRUTH_TRACK) {
|
||||
|
||||
trackPtr = std::make_shared<SimCore::GroundTruthTrack>(std::move(SimCore::GroundTruthTrack::unpack(*msg)));
|
||||
trackPtr = std::make_shared<SimCore::SimTrack>(std::move(SimCore::SimTrack::unpack(*msg)));
|
||||
}
|
||||
|
||||
std::string trackstring = track.buildMessage(parentID).serialize();
|
||||
std::string trackstring = track.buildMessage().serialize();
|
||||
|
||||
SimCore::GroundTruthTrack trackDeserialized = SimCore::GroundTruthTrack::unpack(*msg);
|
||||
SimCore::SimTrack trackDeserialized = SimCore::SimTrack::unpack(*msg);
|
||||
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
REQUIRE(testOperator == true);
|
||||
REQUIRE(track.getCourse() == course);
|
||||
REQUIRE(track.getSpeed() == speed);
|
||||
REQUIRE(track.getSpeedinKnots() == knots);
|
||||
REQUIRE(track.getPostion().getGeocentricPos() == pos.getGeocentricPos());
|
||||
REQUIRE(track.Course.getValue() == course);
|
||||
REQUIRE(track.Speed.getValue() == speed);
|
||||
REQUIRE(track.getPosition().getGeocentricPos() == pos.getGeocentricPos());
|
||||
|
||||
REQUIRE(msg.get()->msgType_ == WHISPER::GROUND_TRUTH_TRACK);
|
||||
REQUIRE(trackPtr->getSpeed() == speed);
|
||||
REQUIRE(trackPtr->getPostion().getGeocentricPos() == GeocentPos1);
|
||||
REQUIRE(trackPtr->getIdentifier().getNumber() > 0);
|
||||
REQUIRE(trackDeserialized.getIdentifier().getNumber() > 0);
|
||||
REQUIRE(trackPtr->Speed.getValue() == speed);
|
||||
REQUIRE(trackPtr->getPosition().getGeocentricPos() == GeocentPos1);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user