File tree Expand file tree Collapse file tree 2 files changed +46
-3
lines changed
Expand file tree Collapse file tree 2 files changed +46
-3
lines changed Original file line number Diff line number Diff line change @@ -61,9 +61,9 @@ template <typename T>
6161struct isAutoCreationClass
6262{
6363 template <class C >
64- static constexpr auto check (C *)
65- -> std::enable_if_t<std:: is_same_v<decltype(C::isAutoCreation), bool>,
66- bool>
64+ static constexpr auto check (C *) -> std::enable_if_t<
65+ std::is_same_v<decltype(C::isAutoCreation), const bool>,
66+ bool>
6767 {
6868 return C::isAutoCreation;
6969 }
Original file line number Diff line number Diff line change 11#include < drogon/DrObject.h>
22#include < drogon/drogon_test.h>
3+ #include < drogon/HttpController.h>
34
45using namespace drogon ;
56
@@ -41,3 +42,45 @@ DROGON_TEST(DrObjectNamespaceTest)
4142 CHECK (objPtr2.get () != nullptr );
4243 CHECK (objPtr == objPtr2);
4344}
45+
46+ class TestC : public DrObject <TestC>
47+ {
48+ public:
49+ static constexpr bool isAutoCreation = true ;
50+ };
51+
52+ class TestD : public DrObject <TestD>
53+ {
54+ public:
55+ static constexpr bool isAutoCreation = false ;
56+ };
57+
58+ class TestE : public DrObject <TestE>
59+ {
60+ public:
61+ static constexpr double isAutoCreation = 3.0 ;
62+ };
63+
64+ class CtrlA : public HttpController <CtrlA>
65+ {
66+ public:
67+ METHOD_LIST_BEGIN
68+ METHOD_LIST_END
69+ };
70+
71+ class CtrlB : public HttpController <CtrlB, false >
72+ {
73+ public:
74+ METHOD_LIST_BEGIN
75+ METHOD_LIST_END
76+ };
77+
78+ DROGON_TEST (IsAutoCreationClassTest)
79+ {
80+ STATIC_REQUIRE (isAutoCreationClass<TestA>::value == false );
81+ STATIC_REQUIRE (isAutoCreationClass<TestC>::value == true );
82+ STATIC_REQUIRE (isAutoCreationClass<TestD>::value == false );
83+ STATIC_REQUIRE (isAutoCreationClass<TestE>::value == false );
84+ STATIC_REQUIRE (isAutoCreationClass<CtrlA>::value == true );
85+ STATIC_REQUIRE (isAutoCreationClass<CtrlB>::value == false );
86+ }
You can’t perform that action at this time.
0 commit comments