9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
15 namespace tt = boost::test_tools;
17 using namespace Acts::concept;
22 BOOST_AUTO_TEST_SUITE(Surfaces)
29 int bar(
const double&) {
return 5; }
33 int bar(
const double&)
const {
return 5; }
37 int bar(
const double&) {
return 5; }
42 static_assert(!has_method<E, int, bar_method_t>,
"failed");
44 static_assert(has_method<E, int, bar_method_t, const double&>,
"failed");
46 static_assert(!has_method<E, double, bar_method_t, const double&>,
"failed");
48 static_assert(!has_method<E, int, bar_method_t, const double>,
"failed");
50 static_assert(!has_method<E, int, bar_method_t, double&>,
"failed");
52 static_assert(!has_method<E, int, bar_method_t, double>,
"failed");
56 static_assert(!has_method<const E, int, bar_method_t, const double&>,
59 static_assert(!has_method<E, int, foo_method_t, const double&>,
"failed");
62 static_assert(!has_method<E2, int, bar_method_t>,
"failed");
66 static_assert(!has_method<E2, int, bar_method_t, const double&>,
"failed");
68 static_assert(has_method<const E2, int, bar_method_t, const double&>,
71 static_assert(!has_method<E2, int, bar_method_t, const double>,
"failed");
73 static_assert(!has_method<E2, int, bar_method_t, double&>,
"failed");
75 static_assert(!has_method<E2, int, bar_method_t, double>,
"failed");
77 static_assert(!has_method<const E2, char, bar_method_t, const double&>,
80 static_assert(!has_method<const E2, int, foo_method_t, const double&>,
84 static_assert(!has_method<E3, int, bar_method_t, const double&>,
"failed");
116 static_assert(has_member<M, member_a_t, int>,
"!");
117 static_assert(has_member<M, member_b_t, double>,
"!");
119 static_assert(!has_member<M, member_b_t, int>,
"!");
120 static_assert(!has_member<M, member_a_t, double>,
"!");
122 static_assert(has_member<M2, member_a_t, double>,
"!");
123 static_assert(!has_member<M2, member_a_t, int>,
"!");
125 static_assert(exists<member_a_t, M>,
"!");
126 static_assert(exists<member_a_t, M2>,
"!");
127 static_assert(exists<member_a_t, M3>,
"!");
128 static_assert(!exists<member_a_t, M4>,
"!");
131 static_assert(!has_member<M5, member_b_t, char>,
"!");
134 static_assert(!exists<member_b_t, M5>,
"!");
137 template <
typename T>
139 template <
typename T>
156 static_assert(exists<nested_a_t, N>,
"!");
157 static_assert(exists<nested_b_t, N>,
"!");
159 static_assert(exists<nested_a_t, N2>,
"!");
160 static_assert(!exists<nested_b_t, N2>,
"!");
162 static_assert(!exists<nested_a_t, N3>,
"!");
163 static_assert(exists<nested_b_t, N3>,
"!");
167 template <
typename T>
168 using member_t = decltype(std::declval<T>().member);
171 template <
typename T>
175 template <
typename T>
176 using meta_t =
typename T::template meta<void, void>;
179 template <
typename T>
181 require<has_method<T, double, foo_method_t, double, int>,
182 has_method<const T, bool, bar_method_t, double&&>,
183 has_member<T, member_t, bool>, exists<nested_t, T>,
191 template <
typename U,
typename V>
194 double foo(
double,
int) {
return 5; }
196 bool bar(
double&&)
const {
return true; }
204 template <
typename U>
207 double foo(
double,
int) {
return 5; }
209 bool bar(
double&&)
const {
return true; }
215 int foo(
double) {
return 5; }
219 double foo(
int) {
return 5; }
223 double bar(
double) {
return 5; }
227 static_assert(SomeConcept<A>,
"A does not fulfill \"SomeConcept\"");
228 static_assert(!SomeConcept<A2>,
"A2 does not fulfill \"SomeConcept\"");
229 static_assert(!SomeConcept<B>,
"B does fulfill \"SomeConcept\"");
230 static_assert(!SomeConcept<C>,
"C does fulfill \"SomeConcept\"");
231 static_assert(!SomeConcept<D>,
"D does fulfill \"SomeConcept\"");
234 BOOST_AUTO_TEST_SUITE_END()