49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
/**
|
|
* @file test_build_rti_guards.cpp
|
|
* @brief Tests für BUILD_RTI conditional compilation guards
|
|
*
|
|
* Tests verify that:
|
|
* 1. Code compiles with BUILD_RTI=OFF (fallback mode)
|
|
* 2. RTI-dependent code is properly guarded
|
|
* 3. Non-RTI code paths work correctly
|
|
*/
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
// Test 1: Verify BUILD_RTI macro is defined correctly
|
|
TEST(BuildRTIGuards, MacroDefined)
|
|
{
|
|
#ifdef BUILD_RTI
|
|
// When BUILD_RTI is enabled, it should be 1
|
|
EXPECT_EQ(BUILD_RTI, 1);
|
|
#else
|
|
// When BUILD_RTI is disabled, it should be 0 or undefined
|
|
// This test passes in fallback mode
|
|
SUCCEED();
|
|
#endif
|
|
}
|
|
|
|
// Test 2: Verify DDS connector compiles without RTI
|
|
TEST(BuildRTIGuards, DDSConnectorFallback)
|
|
{
|
|
// This test verifies that DDS-related headers can be included
|
|
// and basic functionality works without RTI libraries
|
|
// The actual DDS connector should have fallback implementations
|
|
bool rti_available = false;
|
|
#ifdef BUILD_RTI
|
|
rti_available = true;
|
|
#endif
|
|
EXPECT_FALSE(rti_available); // In fallback mode, RTI is not available
|
|
}
|
|
|
|
// Test 3: Verify conditional compilation doesn't break build
|
|
TEST(BuildRTIGuards, ConditionalCompilationSafe)
|
|
{
|
|
// Verify that #if BUILD_RTI guards don't cause syntax errors
|
|
int value = 0;
|
|
#if BUILD_RTI
|
|
value = 1;
|
|
#endif
|
|
// In fallback mode, value should remain 0
|
|
EXPECT_EQ(value, 0);
|
|
} |