#include "includes.h" #include "parser_test.h" #include #include using CIdlInterfaceIdCompatibilityTest = CParserTest; // Backup namespace to differentiate between generated and defined in backup file. namespace bck { using u8string = ::sdv::u8string; template using sequence = ::sdv::sequence; template using pointer = ::sdv::pointer; namespace internal { using IInternalMemAlloc = ::sdv::internal::IInternalMemAlloc; template inline bck::pointer make_ptr(internal::IInternalMemAlloc* /*pAllocator*/, size_t /*nSize*/) { return {}; } } } // Reload the backup file, but change the namespace to "bck". #define sdv bck #undef IDL_PARSER_INTERFACE_H #undef SDV_INTERFACE_H #undef SDV_EXCEPT_H #include "../../../sdv_executables/sdv_idl_compiler/core_idl_backup.h" #undef sdv /** * @brief Use inline non-constexpr function to get the ID. * @details The standard GetInterfaceId and GetExceptionId functions are constexpr and cause to return the same ID for the sdv and * the bck object, thus not detecting any changes. This is due to the use of "constexpr", implementing the return value of the * function at compile time. By using an inline function, the access of the ID occurs at runtime allowing to differentiate between * the bck and sdv IDs. * @tparam TObj The object to retrieve the ID for. * @return The ID of the object. */ template inline uint64_t GetId() { return TObj::_id; } TEST_F(CIdlInterfaceIdCompatibilityTest, InterfaceAccess) { EXPECT_EQ(GetId(), GetId()); } TEST_F(CIdlInterfaceIdCompatibilityTest, SdvExceptions) { EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); } TEST_F(CIdlInterfaceIdCompatibilityTest, CoreExceptions) { EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); } TEST_F(CIdlInterfaceIdCompatibilityTest, CompilerInterfaces) { EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); } TEST_F(CIdlInterfaceIdCompatibilityTest, CompilerExceptions) { EXPECT_EQ(GetId(), GetId()); } TEST_F(CIdlInterfaceIdCompatibilityTest, EntityInterfaces) { EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); EXPECT_EQ(GetId(), GetId()); }