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,41 +1,77 @@
|
||||
/**
|
||||
* @file test_asm_dtc.cpp
|
||||
* @brief Tests for AssetManagement Dtc stub header compilation
|
||||
* @brief Verhaltenstests für die generierte AssetManagement Dtc/Ftc-Schnittstelle
|
||||
*
|
||||
* Diese Tests prüfen den von CODEGEN_CLIENT_TOPICS_IFC aus asm_service.xml
|
||||
* generierten Header (Lts/Services/AssetManagement/asm_dtc.h bzw. asm_ftc.h)
|
||||
* aus dem Build-Tree. Es darf keinen Stub-Header im Quellbaum geben.
|
||||
* Zusätzlich werden die plainen DDS-Typ-Member aus asm.hpp verifiziert, auf die
|
||||
* der migrierte Code (asm_dtc_impl_custom.cpp, main_handler.cpp) zugreift.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "AssetManagement/asm_dtc.h"
|
||||
#include "AssetManagement/asm_ftc.h"
|
||||
|
||||
// Test that the header compiles and provides expected forward declarations
|
||||
TEST(AsmDtcTest, HeaderCompilesSuccessfully)
|
||||
#include <gtest/gtest.h>
|
||||
#include <QObject>
|
||||
#include <type_traits>
|
||||
|
||||
/**
|
||||
* @test Der generierte Dtc muss von QObject abgeleitet sein (Signale für Topic-Updates);
|
||||
* beide Schnittstellen sind abstrakt.
|
||||
*/
|
||||
TEST(asm_dtc_Generated, DtcIsQObjectDerived)
|
||||
{
|
||||
// This test verifies that asm_dtc.h compiles without errors
|
||||
// The header provides forward declarations for DDS-generated Dtc/Ftc classes
|
||||
static_assert(std::is_base_of<QObject, AssetManagement::Interface::Dtc>::value,
|
||||
"generierter Dtc muss von QObject abgeleitet sein");
|
||||
static_assert(std::is_abstract<AssetManagement::Interface::Dtc>::value,
|
||||
"Dtc muss abstrakt sein");
|
||||
static_assert(std::is_abstract<AssetManagement::Interface::Ftc>::value,
|
||||
"Ftc muss abstrakt sein");
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(AsmDtcTest, NamespaceStructureExists)
|
||||
/**
|
||||
* @test Die generierten Identifier müssen dem Service-Namensschema folgen.
|
||||
*/
|
||||
TEST(asm_dtc_Generated, IdentifiersMatchService)
|
||||
{
|
||||
// Verify that the AssetManagement namespace exists
|
||||
using namespace AssetManagement;
|
||||
|
||||
// Verify that the Interface namespace exists within AssetManagement
|
||||
using namespace AssetManagement::Interface;
|
||||
|
||||
// Forward declaration should be available (pointer type should compile)
|
||||
Dtc* dtc_ptr = nullptr;
|
||||
Ftc* ftc_ptr = nullptr;
|
||||
|
||||
EXPECT_EQ(dtc_ptr, nullptr);
|
||||
EXPECT_EQ(ftc_ptr, nullptr);
|
||||
EXPECT_STREQ(AssetManagement::Interface::Dtc::identifier(), "AssetManagement.Interface.Dtc");
|
||||
EXPECT_STREQ(AssetManagement::Interface::Ftc::identifier(), "AssetManagement.Interface.Ftc");
|
||||
}
|
||||
|
||||
TEST(AsmDtcTest, ForwardDeclarationsAreUsable)
|
||||
/**
|
||||
* @test Die DDS-Typen aus asm.hpp müssen plain-Member bereitstellen (rtiddsgen 7.7):
|
||||
* Asset (id, name, assetTypeId, locationId, subLocation), die der migrierte
|
||||
* AssetManagement-Code direkt als Felder nutzt.
|
||||
*/
|
||||
TEST(asm_dtc_Generated, AssetHasPlainMembers)
|
||||
{
|
||||
// Test that forward-declared types can be used in function signatures
|
||||
auto use_dtc = [](AssetManagement::Interface::Dtc* ptr) { return ptr != nullptr; };
|
||||
auto use_ftc = [](AssetManagement::Interface::Ftc* ptr) { return ptr != nullptr; };
|
||||
using Asset = AssetManagement::Asset;
|
||||
|
||||
EXPECT_FALSE(use_dtc(nullptr));
|
||||
EXPECT_FALSE(use_ftc(nullptr));
|
||||
}
|
||||
static_assert(std::is_base_of<::Core::BaseEntity, Asset>::value,
|
||||
"Asset muss von Core::BaseEntity abgeleitet sein (id/name/isUsed)");
|
||||
static_assert(std::is_same<decltype(Asset{}.id), int32_t>::value,
|
||||
"id muss ein plain int32_t-Member sein");
|
||||
static_assert(std::is_same<decltype(Asset{}.name), std::string>::value,
|
||||
"name muss ein plain std::string-Member sein");
|
||||
static_assert(std::is_same<decltype(Asset{}.assetTypeId), ::AssetManagement::AssetType>::value,
|
||||
"assetTypeId muss ein plain AssetType-Member sein");
|
||||
static_assert(std::is_same<decltype(Asset{}.locationId), int32_t>::value,
|
||||
"locationId muss ein plain int32_t-Member sein");
|
||||
static_assert(std::is_same<decltype(Asset{}.subLocation), int32_t>::value,
|
||||
"subLocation muss ein plain int32_t-Member sein");
|
||||
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Include-Guard: mehrfaches Einbinden der generierten Header ist erlaubt.
|
||||
*/
|
||||
TEST(asm_dtc_Generated, MultipleIncludeGuard)
|
||||
{
|
||||
// Including the header multiple times should not cause errors
|
||||
#include "AssetManagement/asm_dtc.h"
|
||||
#include "AssetManagement/asm_ftc.h"
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
Reference in new issue
Block a user