#include "SimCore/Messages/Track.hpp" #include "WHISPER/Messages/Message.hpp" #include #include #define CATCH_CONFIG_MAIN #include #include SCENARIO("Testing the SimCore Track") { GIVEN("different Attributes for a Track in different forms") { Eigen::Vector3d GeocentPos1; GeocentPos1(SimCore::GeocentricPosition::X) = 3784014.333; GeocentPos1(SimCore::GeocentricPosition::Y) = 899869.779; GeocentPos1(SimCore::GeocentricPosition::Z) = 5037960.502; Eigen::Vector3d GeodesPos1; GeodesPos1(SimCore::GeodesicPosition::LATITUDE) = 52.516181; GeodesPos1(SimCore::GeodesicPosition::LONGITUDE) = 13.376935; GeodesPos1(SimCore::GeodesicPosition::HEIGHT) = 0; double course = 90; double speed = 10; double knots = speed * SimCore::MsKt; bool testOperator = false; std::shared_ptr msg = NULL; std::shared_ptr trackPtr = NULL; std::string serializedMSG; WHEN("constructing Track Object with data") { SimCore::Position pos( GeocentPos1(SimCore::GeocentricPosition::X), GeocentPos1(SimCore::GeocentricPosition::Y), GeocentPos1(SimCore::GeocentricPosition::Z)); SimCore::Track track(1,WHISPER::SourceType::SHIP,10,pos,false); track.setCourse(course); track.setSpeed(speed); if (track.getPostion() == pos) { testOperator = true; } serializedMSG = track.serialize(); msg = std::make_shared(serializedMSG); if (msg.get()->msgType_ == WHISPER::RAW_TRACK) { trackPtr = std::make_shared(serializedMSG); LOG_S(INFO)<< trackPtr->getSpeed(); } 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(msg.get()->msgType_ == WHISPER::RAW_TRACK); REQUIRE(trackPtr->getSpeed() == speed); } //THEN } // WHEN } // GIVEN } //SCENARIO