78 lines
3.1 KiB
C++
78 lines
3.1 KiB
C++
/**
|
|
* @file test_asm_dtc.cpp
|
|
* @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 "AssetManagement/asm_dtc.h"
|
|
#include "AssetManagement/asm_ftc.h"
|
|
|
|
#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)
|
|
{
|
|
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 Die generierten Identifier müssen dem Service-Namensschema folgen.
|
|
*/
|
|
TEST(asm_dtc_Generated, IdentifiersMatchService)
|
|
{
|
|
EXPECT_STREQ(AssetManagement::Interface::Dtc::identifier(), "AssetManagement.Interface.Dtc");
|
|
EXPECT_STREQ(AssetManagement::Interface::Ftc::identifier(), "AssetManagement.Interface.Ftc");
|
|
}
|
|
|
|
/**
|
|
* @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)
|
|
{
|
|
using Asset = AssetManagement::Asset;
|
|
|
|
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);
|
|
}
|