79 lines
1.8 KiB
C++
79 lines
1.8 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")
|
|
{
|
|
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::TracklistItem item(track);
|
|
|
|
TrackList::SensorData Sensor1 =
|
|
{
|
|
.sensorID = SimCore::Identifier(),
|
|
.Sensorname = "ARPA"
|
|
};
|
|
|
|
TrackList::SensorData Sensor2 =
|
|
{
|
|
.sensorID = SimCore::Identifier(),
|
|
.Sensorname = "SMART-L"
|
|
};
|
|
|
|
item.addSensorDataToSensorList(Sensor1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WHEN("constructing Track Object with data")
|
|
{
|
|
track->Course.setValue(270);
|
|
|
|
item.updateTrack(track,Sensor2);
|
|
|
|
THEN("check if Track attributes are correct")
|
|
{
|
|
|
|
REQUIRE(item.getPosition().getGeocentricPos() == pos.getGeocentricPos());
|
|
REQUIRE(item.Speed.getValue() == speed);
|
|
REQUIRE(item.Course.getValue() != course);
|
|
REQUIRE(item.isSensorIDKnown(Sensor1.sensorID) == true);
|
|
|
|
REQUIRE(item.getSensorCount() == 2);
|
|
REQUIRE(item.getLastUpdateTimestamp() < std::chrono::steady_clock::now());
|
|
|
|
|
|
|
|
} //THEN
|
|
} // WHEN
|
|
} // GIVEN
|
|
} //SCENARIO
|