80 lines
2.1 KiB
C++
80 lines
2.1 KiB
C++
|
|
#include "Entities/Tracklist/Tracklist.hpp"
|
|
#include "Entities/Tracklist/TracklistItem.hpp"
|
|
#include "SimCore/IdentifierMaker.hpp"
|
|
#include "SimCore/Messages/SimTrack.hpp"
|
|
#include "SimCore/Position.hpp"
|
|
#include "WHISPER/Messages/Message.hpp"
|
|
#include <SimCore/Identifier.hpp>
|
|
#include <SimCore/SimCore.hpp>
|
|
#include <memory>
|
|
#include <thread>
|
|
#define CATCH_CONFIG_MAIN
|
|
#include <catch2/catch.hpp>
|
|
#include <loguru.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCENARIO("Testing the SimCore Sensor")
|
|
{
|
|
GIVEN("different Attributes for a Track in different forms")
|
|
{
|
|
SimCore::Identifier OwnID;
|
|
TrackList::TrackList List(OwnID);
|
|
List.setTrackTimeout(5000);
|
|
|
|
double speed = 10;
|
|
double course = 90;
|
|
SimCore::Identifier id;
|
|
auto track = std::make_shared<SimCore::SimTrack>(id,"Hamburg", SimCore::Kind::EntityKind::SURFACE,SimCore::Side::FRIEND);
|
|
SimCore::Position pos;
|
|
pos.setGeodesicPos(55, 8, 0);
|
|
track->setPosition(pos);
|
|
track->Speed.setValue(speed);
|
|
track->Course.setValue(course);
|
|
|
|
|
|
TrackList::SensorData Sensor1 =
|
|
{
|
|
.sensorID = SimCore::Identifier(),
|
|
.Sensorname = "ARPA"
|
|
};
|
|
|
|
TrackList::SensorData Sensor2 =
|
|
{
|
|
.sensorID = SimCore::Identifier(),
|
|
.Sensorname = "SMART-L"
|
|
};
|
|
|
|
|
|
|
|
|
|
WHEN("constructing Track Object with data")
|
|
{
|
|
List.addTrack(track,Sensor1);
|
|
THEN("check if Track attributes are correct")
|
|
{
|
|
|
|
REQUIRE(List.size() == 1);
|
|
REQUIRE(List.getTrack(id)->getPosition().getGeocentricPos() == pos.getGeocentricPos());
|
|
REQUIRE(List.getTrack(id)->Speed.getValue() == speed);
|
|
REQUIRE(List.getTrack(id)->Course.getValue() == course);
|
|
REQUIRE(List.getTrack(id)->getSensorCount() == 1);
|
|
track->Course.setValue(270);
|
|
List.addTrack(track,Sensor2);
|
|
// REQUIRE(List.getTrack(id)->Course.getValue() == 270);
|
|
REQUIRE(List.getTrack(id)->getSensorCount() == 2);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(5500));
|
|
REQUIRE(List.size() == 0);
|
|
|
|
List.stopSanitizer();
|
|
|
|
|
|
|
|
} //THEN
|
|
} // WHEN
|
|
} // GIVEN
|
|
} //SCENARIO
|