set.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright Louis Dionne 2013-2017
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  4. #include <boost/hana/assert.hpp>
  5. #include <boost/hana/experimental/printable.hpp>
  6. #include <boost/hana/integral_constant.hpp>
  7. #include <boost/hana/set.hpp>
  8. #include <boost/hana/string.hpp>
  9. #include <sstream>
  10. #include <string>
  11. namespace hana = boost::hana;
  12. int main() {
  13. {
  14. std::ostringstream ss;
  15. ss << hana::experimental::print(
  16. hana::make_set()
  17. );
  18. BOOST_HANA_RUNTIME_CHECK(ss.str() == "{}");
  19. }
  20. {
  21. std::ostringstream ss;
  22. ss << hana::experimental::print(
  23. hana::make_set(hana::int_c<1>)
  24. );
  25. BOOST_HANA_RUNTIME_CHECK(ss.str() == "{1}");
  26. }
  27. {
  28. std::ostringstream ss;
  29. ss << hana::experimental::print(
  30. hana::make_set(hana::int_c<1>, BOOST_HANA_STRING("3456"))
  31. );
  32. BOOST_HANA_RUNTIME_CHECK(ss.str() == "{1, \"3456\"}");
  33. }
  34. {
  35. std::ostringstream ss;
  36. ss << hana::experimental::print(
  37. hana::make_set(hana::char_c<'x'>, BOOST_HANA_STRING("3456"))
  38. );
  39. BOOST_HANA_RUNTIME_CHECK(ss.str() == "{x, \"3456\"}");
  40. }
  41. }