evaluate_category_16.cpp 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. // Copyright Cromwell D. Enage 2017.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/parameter/config.hpp>
  6. #if (BOOST_PARAMETER_MAX_ARITY < 16)
  7. #error Define BOOST_PARAMETER_MAX_ARITY as 16 or greater.
  8. #endif
  9. #include <boost/parameter/name.hpp>
  10. namespace test {
  11. BOOST_PARAMETER_NAME((_lrc0, keywords) in(lrc0))
  12. BOOST_PARAMETER_NAME((_lr1, keywords) out(lr1))
  13. BOOST_PARAMETER_NAME((_lr2, keywords) out(lr2))
  14. BOOST_PARAMETER_NAME((_lrc3, keywords) in(lrc3))
  15. BOOST_PARAMETER_NAME((_lrc4, keywords) in(lrc4))
  16. BOOST_PARAMETER_NAME((_lr5, keywords) out(lr5))
  17. BOOST_PARAMETER_NAME((_lr6, keywords) out(lr6))
  18. BOOST_PARAMETER_NAME((_lrc7, keywords) in(lrc7))
  19. BOOST_PARAMETER_NAME((_rrc0, keywords) in(rrc0))
  20. BOOST_PARAMETER_NAME((_rrc1, keywords) in(rrc1))
  21. BOOST_PARAMETER_NAME((_rrc2, keywords) in(rrc2))
  22. BOOST_PARAMETER_NAME((_rrc3, keywords) in(rrc3))
  23. BOOST_PARAMETER_NAME((_rrc4, keywords) in(rrc4))
  24. BOOST_PARAMETER_NAME((_rrc5, keywords) in(rrc5))
  25. BOOST_PARAMETER_NAME((_rrc6, keywords) in(rrc6))
  26. BOOST_PARAMETER_NAME((_rrc7, keywords) in(rrc7))
  27. } // namespace test
  28. #include <boost/parameter/parameters.hpp>
  29. #include <boost/parameter/required.hpp>
  30. #include <boost/parameter/optional.hpp>
  31. namespace test {
  32. struct h_parameters
  33. : boost::parameter::parameters<
  34. boost::parameter::required<test::keywords::lrc0>
  35. , boost::parameter::required<test::keywords::rrc0>
  36. , boost::parameter::required<test::keywords::lr1>
  37. , boost::parameter::required<test::keywords::rrc1>
  38. , boost::parameter::required<test::keywords::lr2>
  39. , boost::parameter::required<test::keywords::rrc2>
  40. , boost::parameter::required<test::keywords::lrc3>
  41. , boost::parameter::required<test::keywords::rrc3>
  42. , boost::parameter::optional<test::keywords::lrc4>
  43. , boost::parameter::optional<test::keywords::rrc4>
  44. , boost::parameter::optional<test::keywords::lr5>
  45. , boost::parameter::optional<test::keywords::rrc5>
  46. , boost::parameter::optional<test::keywords::lr6>
  47. , boost::parameter::optional<test::keywords::rrc6>
  48. , boost::parameter::optional<test::keywords::lrc7>
  49. , boost::parameter::optional<test::keywords::rrc7>
  50. >
  51. {
  52. };
  53. } // namespace test
  54. #include <boost/core/lightweight_test.hpp>
  55. #include "evaluate_category.hpp"
  56. namespace test {
  57. struct D
  58. {
  59. template <typename Args>
  60. static void evaluate(Args const& args)
  61. {
  62. BOOST_TEST_EQ(
  63. test::passed_by_lvalue_reference_to_const
  64. , test::U::evaluate_category<0>(args[test::_lrc0])
  65. );
  66. BOOST_TEST_EQ(
  67. test::passed_by_lvalue_reference
  68. , test::U::evaluate_category<1>(args[test::_lr1])
  69. );
  70. BOOST_TEST_EQ(
  71. test::passed_by_lvalue_reference
  72. , test::U::evaluate_category<2>(args[test::_lr2])
  73. );
  74. BOOST_TEST_EQ(
  75. test::passed_by_lvalue_reference_to_const
  76. , test::U::evaluate_category<3>(args[test::_lrc3])
  77. );
  78. BOOST_TEST_EQ(
  79. test::passed_by_lvalue_reference_to_const
  80. , test::U::evaluate_category<4>(
  81. args[test::_lrc4 | test::lvalue_const_bitset<4>()]
  82. )
  83. );
  84. BOOST_TEST_EQ(
  85. test::passed_by_lvalue_reference
  86. , test::U::evaluate_category<5>(
  87. args[
  88. test::_lr5 || test::lvalue_bitset_function<5>()
  89. ]
  90. )
  91. );
  92. BOOST_TEST_EQ(
  93. test::passed_by_lvalue_reference
  94. , test::U::evaluate_category<6>(
  95. args[test::_lr6 | test::lvalue_bitset<6>()]
  96. )
  97. );
  98. BOOST_TEST_EQ(
  99. test::passed_by_lvalue_reference_to_const
  100. , test::U::evaluate_category<7>(
  101. args[
  102. test::_lrc7 || test::lvalue_const_bitset_function<7>()
  103. ]
  104. )
  105. );
  106. #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  107. BOOST_TEST_EQ(
  108. test::passed_by_rvalue_reference_to_const
  109. , test::U::evaluate_category<0>(args[test::_rrc0])
  110. );
  111. BOOST_TEST_EQ(
  112. test::passed_by_rvalue_reference_to_const
  113. , test::U::evaluate_category<1>(args[test::_rrc1])
  114. );
  115. BOOST_TEST_EQ(
  116. test::passed_by_rvalue_reference_to_const
  117. , test::U::evaluate_category<2>(args[test::_rrc2])
  118. );
  119. BOOST_TEST_EQ(
  120. test::passed_by_rvalue_reference_to_const
  121. , test::U::evaluate_category<3>(args[test::_rrc3])
  122. );
  123. BOOST_TEST_EQ(
  124. test::passed_by_rvalue_reference_to_const
  125. , test::U::evaluate_category<4>(
  126. args[test::_rrc4 | test::rvalue_const_bitset<4>()]
  127. )
  128. );
  129. BOOST_TEST_EQ(
  130. test::passed_by_rvalue_reference_to_const
  131. , test::U::evaluate_category<5>(
  132. args[
  133. test::_rrc5 || test::rvalue_const_bitset_function<5>()
  134. ]
  135. )
  136. );
  137. BOOST_TEST_EQ(
  138. test::passed_by_rvalue_reference_to_const
  139. , test::U::evaluate_category<6>(
  140. args[test::_rrc6 | test::rvalue_const_bitset<6>()]
  141. )
  142. );
  143. BOOST_TEST_EQ(
  144. test::passed_by_rvalue_reference_to_const
  145. , test::U::evaluate_category<7>(
  146. args[
  147. test::_rrc7 || test::rvalue_const_bitset_function<7>()
  148. ]
  149. )
  150. );
  151. #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
  152. BOOST_TEST_EQ(
  153. test::passed_by_lvalue_reference_to_const
  154. , test::U::evaluate_category<0>(args[test::_rrc0])
  155. );
  156. BOOST_TEST_EQ(
  157. test::passed_by_lvalue_reference_to_const
  158. , test::U::evaluate_category<1>(args[test::_rrc1])
  159. );
  160. BOOST_TEST_EQ(
  161. test::passed_by_lvalue_reference_to_const
  162. , test::U::evaluate_category<2>(args[test::_rrc2])
  163. );
  164. BOOST_TEST_EQ(
  165. test::passed_by_lvalue_reference_to_const
  166. , test::U::evaluate_category<3>(args[test::_rrc3])
  167. );
  168. BOOST_TEST_EQ(
  169. test::passed_by_lvalue_reference_to_const
  170. , test::U::evaluate_category<4>(
  171. args[test::_rrc4 | test::rvalue_const_bitset<4>()]
  172. )
  173. );
  174. BOOST_TEST_EQ(
  175. test::passed_by_lvalue_reference_to_const
  176. , test::U::evaluate_category<5>(
  177. args[
  178. test::_rrc5 || test::rvalue_const_bitset_function<5>()
  179. ]
  180. )
  181. );
  182. BOOST_TEST_EQ(
  183. test::passed_by_lvalue_reference_to_const
  184. , test::U::evaluate_category<6>(
  185. args[test::_rrc6 | test::rvalue_const_bitset<6>()]
  186. )
  187. );
  188. BOOST_TEST_EQ(
  189. test::passed_by_lvalue_reference_to_const
  190. , test::U::evaluate_category<7>(
  191. args[
  192. test::_rrc7 || test::rvalue_const_bitset_function<7>()
  193. ]
  194. )
  195. );
  196. #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
  197. }
  198. };
  199. } // namespace test
  200. int main()
  201. {
  202. test::D::evaluate(
  203. test::h_parameters()(
  204. test::lvalue_const_bitset<0>()
  205. , test::rvalue_const_bitset<0>()
  206. , test::lvalue_bitset<1>()
  207. , test::rvalue_const_bitset<1>()
  208. , test::lvalue_bitset<2>()
  209. , test::rvalue_const_bitset<2>()
  210. , test::lvalue_const_bitset<3>()
  211. , test::rvalue_const_bitset<3>()
  212. )
  213. );
  214. test::D::evaluate(
  215. test::h_parameters()(
  216. test::lvalue_const_bitset<0>()
  217. , test::rvalue_const_bitset<0>()
  218. , test::lvalue_bitset<1>()
  219. , test::rvalue_const_bitset<1>()
  220. , test::lvalue_bitset<2>()
  221. , test::rvalue_const_bitset<2>()
  222. , test::lvalue_const_bitset<3>()
  223. , test::rvalue_const_bitset<3>()
  224. , test::lvalue_const_bitset<4>()
  225. , test::rvalue_const_bitset<4>()
  226. , test::lvalue_bitset<5>()
  227. , test::rvalue_const_bitset<5>()
  228. , test::lvalue_bitset<6>()
  229. , test::rvalue_const_bitset<6>()
  230. , test::lvalue_const_bitset<7>()
  231. , test::rvalue_const_bitset<7>()
  232. )
  233. );
  234. return boost::report_errors();
  235. }