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,80 @@
|
||||
/**
|
||||
* @file test_tab_dtc.cpp
|
||||
* @brief Compilation test for include/TrainingAreaBase/tab_dtc.h
|
||||
* @brief Verhaltenstests für die generierte TrainingAreaBase 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 der tab-XML
|
||||
* generierten Header (Lts/Proxies/TrainingAreaBase/tab_dtc.h bzw. tab_ftc.h)
|
||||
* aus dem Build-Tree. Der OFF-Stub include/TrainingAreaBase/tab_dtc.h wurde
|
||||
* entfernt, da er den generierten Header verschattet hat. Zusätzlich werden
|
||||
* die plainen DDS-Typ-Member aus tab.hpp verifiziert (EquipmentBase/BatteryAlarm),
|
||||
* auf die die migrierten Proxy-Consumer zugreifen.
|
||||
*/
|
||||
|
||||
#include "include/TrainingAreaBase/tab_dtc.h"
|
||||
#include "TrainingAreaBase/tab_dtc.h"
|
||||
#include "TrainingAreaBase/tab_ftc.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <QObject>
|
||||
#include <type_traits>
|
||||
|
||||
TEST(tab_dtc_Compilation, HeaderCompiles)
|
||||
/**
|
||||
* @test Der generierte Dtc muss von QObject abgeleitet sein (Signale für Topic-Updates);
|
||||
* beide Schnittstellen sind abstrakt.
|
||||
*/
|
||||
TEST(tab_dtc_Generated, DtcIsQObjectDerived)
|
||||
{
|
||||
// This test verifies that the header compiles without errors
|
||||
static_assert(std::is_base_of<QObject, TrainingAreaBase::Interface::Dtc>::value,
|
||||
"generierter Dtc muss von QObject abgeleitet sein");
|
||||
static_assert(std::is_abstract<TrainingAreaBase::Interface::Dtc>::value,
|
||||
"Dtc muss abstrakt sein");
|
||||
static_assert(std::is_abstract<TrainingAreaBase::Interface::Ftc>::value,
|
||||
"Ftc muss abstrakt sein");
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Die generierten Identifier müssen dem Proxy-Namensschema folgen.
|
||||
*/
|
||||
TEST(tab_dtc_Generated, IdentifiersMatchProxy)
|
||||
{
|
||||
EXPECT_STREQ(TrainingAreaBase::Interface::Dtc::identifier(), "TrainingAreaBase.Interface.Dtc");
|
||||
EXPECT_STREQ(TrainingAreaBase::Interface::Ftc::identifier(), "TrainingAreaBase.Interface.Ftc");
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Die DDS-Typen aus tab.hpp müssen plain-Member bereitstellen (rtiddsgen 7.7):
|
||||
* EquipmentBase (equipmentNumber/sampleTime) und der abgeleitete
|
||||
* BatteryAlarm (batteryPort/description/acknowledge).
|
||||
*/
|
||||
TEST(tab_dtc_Generated, EquipmentTypesHavePlainMembers)
|
||||
{
|
||||
using EquipmentBase = TrainingAreaBase::EquipmentBase;
|
||||
using BatteryAlarm = TrainingAreaBase::BatteryAlarm;
|
||||
|
||||
static_assert(std::is_same<decltype(EquipmentBase{}.equipmentNumber), int32_t>::value,
|
||||
"equipmentNumber muss ein plain int32_t-Member sein");
|
||||
static_assert(std::is_same<decltype(EquipmentBase{}.sampleTime), int64_t>::value,
|
||||
"sampleTime muss ein plain int64_t-Member sein");
|
||||
|
||||
static_assert(std::is_base_of<EquipmentBase, BatteryAlarm>::value,
|
||||
"BatteryAlarm muss von EquipmentBase abgeleitet sein");
|
||||
static_assert(std::is_same<decltype(BatteryAlarm{}.batteryPort), int32_t>::value,
|
||||
"batteryPort muss ein plain int32_t-Member sein");
|
||||
static_assert(std::is_same<decltype(BatteryAlarm{}.description), std::string>::value,
|
||||
"description muss ein plain std::string-Member sein");
|
||||
static_assert(std::is_same<decltype(BatteryAlarm{}.acknowledge), bool>::value,
|
||||
"acknowledge muss ein plain bool-Member sein");
|
||||
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Include-Guard: mehrfaches Einbinden der generierten Header ist erlaubt.
|
||||
*/
|
||||
TEST(tab_dtc_Generated, MultipleIncludeGuard)
|
||||
{
|
||||
// Including the header multiple times should not cause errors
|
||||
#include "TrainingAreaBase/tab_dtc.h"
|
||||
#include "TrainingAreaBase/tab_ftc.h"
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
Reference in new issue
Block a user