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,61 +1,53 @@
|
||||
/**
|
||||
* @file test_aes_enums.cpp
|
||||
* @brief Tests für AreaEffectSimulation Enum-Header
|
||||
* @brief Verhaltenstests für die generierten AreaEffectSimulation-Enumerationen
|
||||
*
|
||||
* Diese Tests validieren dass die generierten DDS-Enum-Header korrekt kompilieren.
|
||||
* Diese Tests prüfen den von rtiddsgen aus aes_enums.idl generierten Header
|
||||
* (Lts/Services/AreaEffectSimulation/aes_enums.hpp) aus dem Build-Tree.
|
||||
* Die Werte stammen aus aes_service.xml (z.B. AesExplosionGeometry für
|
||||
* Explosionsgeometrien, AesEffectState für den Effekt-Zustandsautomaten).
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// Include des zu testenden Headers
|
||||
#include "Lts/Services/AreaEffectSimulation/aes_enums.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <type_traits>
|
||||
|
||||
/**
|
||||
* @test Test dass der Header kompiliert und Enums existieren
|
||||
* @test AesExplosionGeometry muss mit den Werten aus aes_enums.idl generiert werden.
|
||||
*/
|
||||
TEST(AesEnumsTest, HeaderCompilesAndEnumsExist)
|
||||
TEST(AesEnumsTest, ExplosionGeometryValues)
|
||||
{
|
||||
// Verify that enum classes are accessible
|
||||
using namespace AreaEffectSimulation;
|
||||
|
||||
// Create enum values
|
||||
SymbolAppearance appearance = SymbolAppearance::Solid;
|
||||
SymbolVisibility visibility = SymbolVisibility::Visible;
|
||||
|
||||
EXPECT_EQ(appearance, SymbolAppearance::Solid);
|
||||
EXPECT_EQ(visibility, SymbolVisibility::Visible);
|
||||
|
||||
// Test other enum values
|
||||
EXPECT_EQ(SymbolAppearance::Dashed, static_cast<SymbolAppearance>(1));
|
||||
EXPECT_EQ(SymbolAppearance::Dotted, static_cast<SymbolAppearance>(2));
|
||||
EXPECT_EQ(SymbolVisibility::Hidden, static_cast<SymbolVisibility>(1));
|
||||
static_assert(std::is_enum<::AreaEffectSimulation::AesExplosionGeometry>::value,
|
||||
"AesExplosionGeometry muss aus aes_enums.hpp vorliegen");
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesExplosionGeometry::EgAimPoint), 0);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesExplosionGeometry::EgRadial), 1);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesExplosionGeometry::EgArea), 2);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesExplosionGeometry::EgLine), 3);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesExplosionGeometry::EgPoint), 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Test dass UnitSymbolPosition struct korrekt ist
|
||||
* @test AesEffectState muss mit den Werten aus aes_enums.idl generiert werden.
|
||||
*/
|
||||
TEST(AesEnumsTest, UnitSymbolPositionStruct)
|
||||
TEST(AesEnumsTest, EffectStateValues)
|
||||
{
|
||||
using namespace AreaEffectSimulation;
|
||||
|
||||
// Test default initialization
|
||||
UnitSymbolPosition pos1;
|
||||
EXPECT_DOUBLE_EQ(pos1.x, 0.0);
|
||||
EXPECT_DOUBLE_EQ(pos1.y, 0.0);
|
||||
|
||||
// Test custom initialization
|
||||
UnitSymbolPosition pos2{10.5, 20.5};
|
||||
EXPECT_DOUBLE_EQ(pos2.x, 10.5);
|
||||
EXPECT_DOUBLE_EQ(pos2.y, 20.5);
|
||||
|
||||
// Test assignment
|
||||
pos1 = pos2;
|
||||
EXPECT_DOUBLE_EQ(pos1.x, 10.5);
|
||||
EXPECT_DOUBLE_EQ(pos1.y, 20.5);
|
||||
static_assert(std::is_enum<::AreaEffectSimulation::AesEffectState>::value,
|
||||
"AesEffectState muss aus aes_enums.hpp vorliegen");
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsUnknown), 0);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsExpired), 1);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsRemoved), 2);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsCreated), 4);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsPrepared), 5);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsActivated), 6);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsPaused), 7);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsReceived), 8);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsFired), 9);
|
||||
EXPECT_EQ(static_cast<int>(::AreaEffectSimulation::AesEffectState::EsError), 255);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test Test dass Header mehrfach inkludierbar ist (include guard)
|
||||
* @test Include-Guard: mehrfaches Einbinden des generierten Headers ist erlaubt.
|
||||
*/
|
||||
TEST(AesEnumsTest, MultipleIncludeGuard)
|
||||
{
|
||||
@@ -65,4 +57,4 @@ TEST(AesEnumsTest, MultipleIncludeGuard)
|
||||
|
||||
// If we reach this point, the include guard works
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user