ADD: added Sensor virtual PArent class
This commit is contained in:
67
tests/test_SensorClass.cpp
Normal file
67
tests/test_SensorClass.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include <SimCore/SimCore.hpp>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
#include <SimCore/Sensor.hpp>
|
||||
|
||||
// SimCore::Identifier OwnID, SimCore::Identifier ParentID, SimCore::SensorKinds SensorKind,std::uint32_t GroundTruthPort, std::uint32_t ParentPort,std::string ParentIPAddress
|
||||
class Radar : public SimCore::Sensor
|
||||
{
|
||||
public:
|
||||
Radar(SimCore::Identifier OwnID,
|
||||
SimCore::Identifier ParentID,
|
||||
SimCore::SensorKinds SensorKind,
|
||||
std::uint32_t GroundTruthPort,
|
||||
std::uint32_t ParentPort,
|
||||
std::string ParentIPAddress,
|
||||
std::string radarType):SimCore::Sensor(OwnID, ParentID, SensorKind, GroundTruthPort, ParentPort, ParentIPAddress),radarType_(radarType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
std::string radarType_;
|
||||
|
||||
void specificSensorCalculations() override
|
||||
{
|
||||
LOG_S(INFO)<<"calculating";
|
||||
};
|
||||
|
||||
void specificReloadCharacteristicts() override
|
||||
{
|
||||
LOG_S(INFO)<<"loading specifications";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
SCENARIO("Testing the SimCore Sensor")
|
||||
{
|
||||
GIVEN("different Attributes for a Track in different forms")
|
||||
{
|
||||
SimCore::Identifier IDParent(0,1,false);
|
||||
SimCore::Identifier IDRadar(1,1,false);
|
||||
|
||||
Radar Radar(IDRadar,IDParent,SimCore::SensorKinds::RADAR,8000,8001,"127.0.0.1","APAR");
|
||||
Radar.start();
|
||||
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
// REQUIRE(testOperator == true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <string>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
#include <loguru.hpp>
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +15,14 @@ SCENARIO("Testing the SimCorePositionClass")
|
||||
std::string s1 = "hello.world.guy";
|
||||
std::string s2 = "my;Name;is;henry";
|
||||
|
||||
std::string ownIP = SimCore::UtilFunctions::getOwnIP();
|
||||
LOG_S(INFO)<<ownIP;
|
||||
auto ip = SimCore::UtilFunctions::explode(ownIP, '.');
|
||||
ip[3] = "255";
|
||||
LOG_S(INFO)<< ip[0]+"."+ip[1]+"."+ip[2]+"."+ip[3];
|
||||
|
||||
LOG_S(INFO)<<SimCore::UtilFunctions::implode(ip, '.');
|
||||
|
||||
|
||||
WHEN("constructing Position Object with data")
|
||||
{
|
||||
@@ -27,8 +36,10 @@ SCENARIO("Testing the SimCorePositionClass")
|
||||
REQUIRE(v1.size() == 3);
|
||||
REQUIRE(v1.begin()->compare("hello") == 0);
|
||||
|
||||
REQUIRE(v2.size() == 4);
|
||||
REQUIRE(v2.size() == 4);
|
||||
REQUIRE(v2[1].compare("Name") == 0);
|
||||
REQUIRE(ownIP.size() > 0);
|
||||
REQUIRE(ip.size() == 4);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user