Adapts shared tests and common code to generated rtiddsgen API
Updates test suites and Lts/Common consumers to plain member access.
This commit is contained in:
41 files changed
+1076
-235
No files matched your search
@@ -1,16 +1,79 @@
|
||||
/**
|
||||
* @file test_ppm_dtc.cpp
|
||||
* @brief Compilation test for ParticipantManagement/ppm_dtc.h
|
||||
* @brief Verhaltenstests für die generierte ParticipantManagement Dtc/Ftc-Schnittstelle
|
||||
*
|
||||
* This test verifies that the migrated header compiles correctly with Qt6/C++23.
|
||||
* Diese Tests prüfen den von CODEGEN_CLIENT_TOPICS_IFC aus ppm_service.xml
|
||||
* generierten Header (Lts/Services/ParticipantManagement/ppm_dtc.h bzw.
|
||||
* ppm_ftc.h) aus dem Build-Tree. Es darf keinen Stub-Header im Quellbaum geben.
|
||||
* Zusätzlich werden die plainen DDS-Typ-Member aus ppm.hpp verifiziert, auf die
|
||||
* der migrierte ParticipantManagement-Code zugreift.
|
||||
*/
|
||||
|
||||
#include "ParticipantManagement/ppm_dtc.h"
|
||||
#include "ParticipantManagement/ppm_ftc.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <QObject>
|
||||
#include <type_traits>
|
||||
|
||||
TEST(ppm_dtc_Compilation, HeaderCompiles)
|
||||
/**
|
||||
* @test Der generierte Dtc muss von QObject abgeleitet sein (Signale für Topic-Updates);
|
||||
* beide Schnittstellen sind abstrakt.
|
||||
*/
|
||||
TEST(ppm_dtc_Generated, DtcIsQObjectDerived)
|
||||
{
|
||||
// This test verifies that the header compiles without errors
|
||||
static_assert(std::is_base_of<QObject, ParticipantManagement::Interface::Dtc>::value,
|
||||
"generierter Dtc muss von QObject abgeleitet sein");
|
||||
static_assert(std::is_abstract<ParticipantManagement::Interface::Dtc>::value,
|
||||
"Dtc muss abstrakt sein");
|
||||
static_assert(std::is_abstract<ParticipantManagement::Interface::Ftc>::value,
|
||||
"Ftc muss abstrakt sein");
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Die generierten Identifier müssen dem Service-Namensschema folgen.
|
||||
*/
|
||||
TEST(ppm_dtc_Generated, IdentifiersMatchService)
|
||||
{
|
||||
EXPECT_STREQ(ParticipantManagement::Interface::Dtc::identifier(), "ParticipantManagement.Interface.Dtc");
|
||||
EXPECT_STREQ(ParticipantManagement::Interface::Ftc::identifier(), "ParticipantManagement.Interface.Ftc");
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Die DDS-Typen aus ppm.hpp müssen plain-Member bereitstellen (rtiddsgen 7.7):
|
||||
* ParticipantBase (id, name, equipmentNumber als optional) und Participant
|
||||
* (inferiorIds als sequence), die der migrierte Code direkt als Felder nutzt.
|
||||
*/
|
||||
TEST(ppm_dtc_Generated, ParticipantTypesHavePlainMembers)
|
||||
{
|
||||
using ParticipantBase = ParticipantManagement::ParticipantBase;
|
||||
using Participant = ParticipantManagement::Participant;
|
||||
|
||||
static_assert(std::is_same<decltype(ParticipantBase{}.id), int32_t>::value,
|
||||
"id muss ein plain int32_t-Member sein");
|
||||
static_assert(std::is_same<decltype(ParticipantBase{}.name), std::string>::value,
|
||||
"name muss ein plain std::string-Member sein");
|
||||
static_assert(std::is_same<decltype(ParticipantBase{}.equipmentNumber),
|
||||
::omg::types::optional<int32_t>>::value,
|
||||
"equipmentNumber muss ein omg::types::optional<int32_t>-Member sein");
|
||||
|
||||
static_assert(std::is_base_of<ParticipantBase, Participant>::value,
|
||||
"Participant muss von ParticipantBase abgeleitet sein");
|
||||
static_assert(std::is_same<decltype(Participant{}.inferiorIds),
|
||||
::omg::types::sequence<int32_t>>::value,
|
||||
"inferiorIds muss eine omg::types::sequence<int32_t> sein");
|
||||
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Include-Guard: mehrfaches Einbinden der generierten Header ist erlaubt.
|
||||
*/
|
||||
TEST(ppm_dtc_Generated, MultipleIncludeGuard)
|
||||
{
|
||||
// Including the header multiple times should not cause errors
|
||||
#include "ParticipantManagement/ppm_dtc.h"
|
||||
#include "ParticipantManagement/ppm_ftc.h"
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
Reference in new issue
Block a user