50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
/**
|
|
* @file test_build_rti_guards.cpp
|
|
* @brief Tests für BUILD_RTI conditional compilation guards
|
|
*
|
|
* Tests verify that:
|
|
* 1. BUILD_RTI is defined as 1 in the validated configuration
|
|
* 2. RTI-dependent code paths are active (BUILD_RTI=ON)
|
|
* 3. #if BUILD_RTI guards compile and evaluate correctly
|
|
*
|
|
* BUILD_RTI=ON is the only valid migration configuration — the OFF
|
|
* variant is neither built nor tested.
|
|
*/
|
|
|
|
#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 RTI code paths are active in the validated configuration
|
|
TEST(BuildRTIGuards, RtiAvailableInValidatedConfig)
|
|
{
|
|
// The validated migration configuration is BUILD_RTI=ON: the RTI
|
|
// code paths must be compiled in and available.
|
|
bool rti_available = false;
|
|
#ifdef BUILD_RTI
|
|
rti_available = true;
|
|
#endif
|
|
EXPECT_TRUE(rti_available);
|
|
}
|
|
|
|
// Test 3: Verify conditional compilation doesn't break build
|
|
TEST(BuildRTIGuards, ConditionalCompilationSafe)
|
|
{
|
|
// Verify that #if BUILD_RTI guards evaluate to the active branch
|
|
int value = 0;
|
|
#if BUILD_RTI
|
|
value = 1;
|
|
#endif
|
|
EXPECT_EQ(value, 1);
|
|
} |