mp_set_push_front.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // Copyright 2015 Peter Dimov.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. //
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. #include <boost/mp11/set.hpp>
  8. #include <boost/mp11/list.hpp>
  9. #include <boost/core/lightweight_test_trait.hpp>
  10. #include <type_traits>
  11. #include <tuple>
  12. int main()
  13. {
  14. using boost::mp11::mp_list;
  15. using boost::mp11::mp_set_push_front;
  16. {
  17. using L1 = mp_list<>;
  18. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1>, L1>));
  19. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void>, mp_list<void>>));
  20. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, int>, mp_list<int>>));
  21. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int>, mp_list<void, int>>));
  22. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int, char[]>, mp_list<void, int, char[]>>));
  23. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int, void, int, void, int>, mp_list<void, int>>));
  24. }
  25. {
  26. using L2 = mp_list<void>;
  27. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2>, L2>));
  28. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void>, L2>));
  29. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, int>, mp_list<int, void>>));
  30. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void, int>, mp_list<int, void>>));
  31. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void, void, void, int, int, int>, mp_list<int, void>>));
  32. }
  33. {
  34. using L3 = mp_list<void, int>;
  35. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3>, L3>));
  36. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void>, L3>));
  37. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int>, L3>));
  38. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int, int, int, void, void, void>, L3>));
  39. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void const>, mp_list<void const, void, int>>));
  40. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void const, int const>, mp_list<void const, int const, void, int>>));
  41. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int, char[], int, char[], void, char[], void, char[]>, mp_list<char[], void, int>>));
  42. }
  43. {
  44. using L4 = mp_list<void, int, char[]>;
  45. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4>, L4>));
  46. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void>, L4>));
  47. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, int>, L4>));
  48. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, char[]>, L4>));
  49. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void, int, char[], void, int, char[]>, L4>));
  50. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void const>, mp_list<void const, void, int, char[]>>));
  51. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void const, int const, char const[]>, mp_list<void const, int const, char const[], void, int, char[]>>));
  52. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void, void const, int, int const, char[], char const[]>, mp_list<void const, int const, char const[], void, int, char[]>>));
  53. }
  54. //
  55. {
  56. using L1 = std::tuple<>;
  57. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1>, L1>));
  58. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void>, std::tuple<void>>));
  59. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, int>, std::tuple<int>>));
  60. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int>, std::tuple<void, int>>));
  61. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int, char[]>, std::tuple<void, int, char[]>>));
  62. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L1, void, int, void, int, void, int>, std::tuple<void, int>>));
  63. }
  64. {
  65. using L2 = std::tuple<void>;
  66. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2>, L2>));
  67. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void>, L2>));
  68. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, int>, std::tuple<int, void>>));
  69. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void, int>, std::tuple<int, void>>));
  70. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L2, void, void, void, int, int, int>, std::tuple<int, void>>));
  71. }
  72. {
  73. using L3 = std::tuple<void, int>;
  74. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3>, L3>));
  75. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void>, L3>));
  76. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int>, L3>));
  77. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int, int, int, void, void, void>, L3>));
  78. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void const>, std::tuple<void const, void, int>>));
  79. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, void const, int const>, std::tuple<void const, int const, void, int>>));
  80. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L3, int, char[], int, char[], void, char[], void, char[]>, std::tuple<char[], void, int>>));
  81. }
  82. {
  83. using L4 = std::tuple<void, int, char[]>;
  84. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4>, L4>));
  85. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void>, L4>));
  86. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, int>, L4>));
  87. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, char[]>, L4>));
  88. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void, int, char[], void, int, char[]>, L4>));
  89. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void const>, std::tuple<void const, void, int, char[]>>));
  90. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void const, int const, char const[]>, std::tuple<void const, int const, char const[], void, int, char[]>>));
  91. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_set_push_front<L4, void, void const, int, int const, char[], char const[]>, std::tuple<void const, int const, char const[], void, int, char[]>>));
  92. }
  93. return boost::report_errors();
  94. }