From 776516e7e95ab74fa01e176394aa210fe3ef3115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Swatowski?= Date: Thu, 9 Apr 2020 18:15:30 +0200 Subject: [PATCH] change in namespace --- PolyEngine/CMakeListsCommon.cmake | 4 +- PolyEngine/Tests/CoreTests/Src/RTTI2Test.cpp | 56 ++++++++++---------- PolyEngine/Tests/CoreTests/Src/RTTITests.cpp | 4 +- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/PolyEngine/CMakeListsCommon.cmake b/PolyEngine/CMakeListsCommon.cmake index 5bbb5e0b..eacf2855 100644 --- a/PolyEngine/CMakeListsCommon.cmake +++ b/PolyEngine/CMakeListsCommon.cmake @@ -179,7 +179,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(Clang|^GNU$)") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess") endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument -Wno-missing-braces") endif() # Shared compile flags @@ -362,4 +362,4 @@ add_subdirectory(${ENGINE_ROOT_DIR}/API ${COMMON_BUILD_DIR}/API) add_subdirectory(${ENGINE_ROOT_DIR}/Engine ${COMMON_BUILD_DIR}/Engine) add_subdirectory(${ENGINE_ROOT_DIR}/RenderingDevice/OpenGL ${COMMON_BUILD_DIR}/RenderingDevice/OpenGL) add_subdirectory(${ENGINE_ROOT_DIR}/Editor ${COMMON_BUILD_DIR}/Editor) -add_subdirectory(${ENGINE_ROOT_DIR}/Standalone ${COMMON_BUILD_DIR}/Standalone) \ No newline at end of file +add_subdirectory(${ENGINE_ROOT_DIR}/Standalone ${COMMON_BUILD_DIR}/Standalone) diff --git a/PolyEngine/Tests/CoreTests/Src/RTTI2Test.cpp b/PolyEngine/Tests/CoreTests/Src/RTTI2Test.cpp index 704c957c..e7ee9277 100644 --- a/PolyEngine/Tests/CoreTests/Src/RTTI2Test.cpp +++ b/PolyEngine/Tests/CoreTests/Src/RTTI2Test.cpp @@ -2,75 +2,75 @@ #include #include -using namespace pe::core::rtti; +namespace rtti2 = pe::core::rtti::RTTI2; struct TestAttr {} constexpr testAttr; -struct TestClass : public virtual RTTI2::RTTIBase { - TestClass() : RTTI2::RTTIBase(RTTI2::TypeManager::get().registerOrGetType()) {} +struct TestClass : public virtual rtti2::RTTIBase { + TestClass() : rtti2::RTTIBase(rtti2::TypeManager::get().registerOrGetType()) {} }; -template <> struct RTTI2::RTTIinfo { - constexpr static auto info = List(testAttr, testAttr, RTTI2::ClassName{ "testname" }); +template <> struct rtti2::RTTIinfo { + constexpr static auto info = List(testAttr, testAttr, rtti2::ClassName{ "testname" }); }; -TEST_CASE("RTTI2 simple attribute", "[RTTI2]") { +TEST_CASE("rtti2 simple attribute", "[rtti2]") { TestClass tc{}; CHECK(tc.typeInfo().id != std::type_index{ typeid(void) }); auto ta = tc.typeInfo().get(); CHECK(ta); CHECK(ta->size() == 2); CHECK(tc.typeInfo().get() == nullptr); - auto x = tc.typeInfo().get(); + auto x = tc.typeInfo().get(); CHECK(x); CHECK(std::string("testname") == x->name); } struct TestAttrUniq {} constexpr testAttrUniq; -template <> struct RTTI2::AttrType { - using type = RTTI2::UniqueAttribute; +template <> struct rtti2::AttrType { + using type = rtti2::UniqueAttribute; }; -struct TestClass2 : public virtual RTTI2::RTTIBase { - TestClass2() : RTTI2::RTTIBase(RTTI2::TypeManager::get().registerOrGetType()) {} +struct TestClass2 : public virtual rtti2::RTTIBase { + TestClass2() : rtti2::RTTIBase(rtti2::TypeManager::get().registerOrGetType()) {} }; -template <> struct RTTI2::RTTIinfo { +template <> struct rtti2::RTTIinfo { constexpr static auto info = List(testAttrUniq, testAttrUniq); }; -TEST_CASE("RTTI2 uniq attribute", "[RTTI2]") +TEST_CASE("rtti2 uniq attribute", "[rtti2]") { REQUIRE_THROWS(TestClass2{}); } struct TestAttrBase { const char* foo; }; -template <> struct RTTI2::AttrType { - using type = RTTI2::DerivedAttribute; +template <> struct rtti2::AttrType { + using type = rtti2::DerivedAttribute; }; struct TestAttrDerived : TestAttrBase {}; -template <> struct RTTI2::AttrType { - using type = RTTI2::DerivedAttribute; +template <> struct rtti2::AttrType { + using type = rtti2::DerivedAttribute; }; -struct TestClassA : public virtual RTTI2::RTTIBase { - TestClassA() : RTTI2::RTTIBase(RTTI2::TypeManager::get().registerOrGetType()) {} +struct TestClassA : public virtual rtti2::RTTIBase { + TestClassA() : rtti2::RTTIBase(rtti2::TypeManager::get().registerOrGetType()) {} }; -template <> struct RTTI2::RTTIinfo { - constexpr static auto info = List(TestAttrDerived{ "foo" }); +template <> struct rtti2::RTTIinfo { + constexpr static auto info = List(TestAttrDerived{ {"foo"} }); }; -struct TestClassB : public virtual RTTI2::RTTIBase, public TestClassA { - TestClassB() : RTTI2::RTTIBase(RTTI2::TypeManager::get().registerOrGetType()) {} +struct TestClassB : public virtual rtti2::RTTIBase, public TestClassA { + TestClassB() : rtti2::RTTIBase(rtti2::TypeManager::get().registerOrGetType()) {} }; -template <> struct RTTI2::RTTIinfo { - constexpr static auto info = List(RTTI2::baseclass{}); +template <> struct rtti2::RTTIinfo { + constexpr static auto info = List(rtti2::baseclass{}); }; -TEST_CASE("RTTI2 derived", "[RTTI2]") { +TEST_CASE("rtti2 derived", "[rtti2]") { TestClassA tca{}; auto attr = tca.typeInfo().get(); CHECK(attr); CHECK(std::string("foo") == attr->at(0)->foo); TestClassB tcb{}; CHECK(tcb.typeInfo().bases[0].get().id == tca.typeInfo().id); - CHECK(RTTI2::isSame(tca.typeInfo())); - CHECK(RTTI2::isDerived(tcb.typeInfo())); + CHECK(rtti2::isSame(tca.typeInfo())); + CHECK(rtti2::isDerived(tcb.typeInfo())); } diff --git a/PolyEngine/Tests/CoreTests/Src/RTTITests.cpp b/PolyEngine/Tests/CoreTests/Src/RTTITests.cpp index 0477c7c1..7a161635 100644 --- a/PolyEngine/Tests/CoreTests/Src/RTTITests.cpp +++ b/PolyEngine/Tests/CoreTests/Src/RTTITests.cpp @@ -2,9 +2,9 @@ #include #include -/* -using namespace Poly; +using namespace Poly; +/* enum class eRTTITestEnum { VAL_1,