1- #include < cib/cib.hpp>
1+ #include < cib/callback.hpp>
2+
3+ #include < stdx/tuple.hpp>
24
35#include < catch2/catch_test_macros.hpp>
46
@@ -9,33 +11,33 @@ template <typename BuilderValue> constexpr static auto build() {
911}
1012
1113template <typename BuilderMeta, typename BuiltCallback>
12- constexpr static bool built_is_convertable_to_interface (BuiltCallback) {
14+ constexpr static bool built_is_convertible_to_interface (BuiltCallback) {
1315 using interface_type = cib::interface_t <BuilderMeta>;
1416 return std::is_convertible_v<BuiltCallback, interface_type>;
1517}
1618
1719struct EmptyCallbackNoArgs {
18- using meta = cib::callback_meta <>;
19- constexpr static auto value = cib::builder_t <meta >{};
20+ using service = callback::service <>;
21+ constexpr static auto value = cib::builder_t <service >{};
2022};
2123
2224TEST_CASE (" empty callback with no args" , " [callback]" ) {
2325 constexpr auto built_callback = build<EmptyCallbackNoArgs>();
2426
2527 SECTION (" can be called without issue" ) { built_callback (); }
2628
27- SECTION (" built type is convertable to the interface type" ) {
28- REQUIRE (built_is_convertable_to_interface <EmptyCallbackNoArgs::meta >(
29+ SECTION (" built type is convertible to the interface type" ) {
30+ REQUIRE (built_is_convertible_to_interface <EmptyCallbackNoArgs::service >(
2931 built_callback));
3032 }
3133}
3234
3335template <int Id> static bool is_callback_invoked = false ;
3436
3537struct CallbackNoArgsWithSingleExtension {
36- using meta = cib::callback_meta <>;
38+ using service = callback::service <>;
3739 constexpr static auto value = []() {
38- auto const builder = cib::builder_t <meta >{};
40+ auto const builder = cib::builder_t <service >{};
3941 return builder.add ([]() { is_callback_invoked<0 > = true ; });
4042 }();
4143};
@@ -50,14 +52,14 @@ TEST_CASE("callback with no args with single extension", "[callback]") {
5052 REQUIRE (is_callback_invoked<0 >);
5153 }
5254
53- SECTION (" built type is convertable to the interface type" ) {
54- REQUIRE (built_is_convertable_to_interface <
55- CallbackNoArgsWithSingleExtension::meta >(built_callback));
55+ SECTION (" built type is convertible to the interface type" ) {
56+ REQUIRE (built_is_convertible_to_interface <
57+ CallbackNoArgsWithSingleExtension::service >(built_callback));
5658 }
5759}
5860
5961struct CallbackNoArgsWithMultipleExtensions {
60- using meta = cib::callback_meta <>;
62+ using service = callback::service <>;
6163
6264 static void extension_one () { is_callback_invoked<1 > = true ; }
6365
@@ -66,7 +68,7 @@ struct CallbackNoArgsWithMultipleExtensions {
6668 };
6769
6870 constexpr static auto value = []() {
69- auto const builder = cib::builder_t <meta >{};
71+ auto const builder = cib::builder_t <service >{};
7072
7173 return builder.add ([]() { is_callback_invoked<0 > = true ; })
7274 .add (extension_one)
@@ -89,33 +91,33 @@ TEST_CASE("callback with no args with multiple extensions", "[callback]") {
8991 REQUIRE (is_callback_invoked<2 >);
9092 }
9193
92- SECTION (" built type is convertable to the interface type" ) {
93- REQUIRE (built_is_convertable_to_interface <
94- CallbackNoArgsWithMultipleExtensions::meta >(built_callback));
94+ SECTION (" built type is convertible to the interface type" ) {
95+ REQUIRE (built_is_convertible_to_interface <
96+ CallbackNoArgsWithMultipleExtensions::service >(built_callback));
9597 }
9698}
9799
98100struct CallbackWithArgsWithNoExtensions {
99- using meta = cib::callback_meta <int , bool >;
100- constexpr static auto value = cib::builder_t <meta >{};
101+ using service = callback::service <int , bool >;
102+ constexpr static auto value = cib::builder_t <service >{};
101103};
102104
103105TEST_CASE (" callback with args with no extensions" , " [callback]" ) {
104106 constexpr auto built_callback = build<CallbackWithArgsWithNoExtensions>();
105107
106108 SECTION (" can be called" ) { built_callback (42 , true ); }
107109
108- SECTION (" built type is convertable to the interface type" ) {
109- REQUIRE (built_is_convertable_to_interface <
110- CallbackWithArgsWithNoExtensions::meta >(built_callback));
110+ SECTION (" built type is convertible to the interface type" ) {
111+ REQUIRE (built_is_convertible_to_interface <
112+ CallbackWithArgsWithNoExtensions::service >(built_callback));
111113 }
112114}
113115
114116template <int Id, typename ... ArgTypes>
115117static stdx::tuple<ArgTypes...> callback_args{};
116118
117119struct CallbackWithArgsWithMultipleExtensions {
118- using meta = cib::callback_meta <int , bool >;
120+ using service = callback::service <int , bool >;
119121
120122 static void extension_one (int a, bool b) {
121123 is_callback_invoked<1 > = true ;
@@ -128,7 +130,7 @@ struct CallbackWithArgsWithMultipleExtensions {
128130 };
129131
130132 constexpr static auto value = []() {
131- auto const builder = cib::builder_t <meta >{};
133+ auto const builder = cib::builder_t <service >{};
132134
133135 return builder
134136 .add ([](int a, bool b) {
@@ -168,8 +170,9 @@ TEST_CASE("callback with args with multiple extensions", "[callback]") {
168170 REQUIRE (get<1 >(callback_args<2 , int , bool >) == false );
169171 }
170172
171- SECTION (" built type is convertable to the interface type" ) {
172- REQUIRE (built_is_convertable_to_interface<
173- CallbackWithArgsWithMultipleExtensions::meta>(built_callback));
173+ SECTION (" built type is convertible to the interface type" ) {
174+ REQUIRE (built_is_convertible_to_interface<
175+ CallbackWithArgsWithMultipleExtensions::service>(
176+ built_callback));
174177 }
175178}
0 commit comments