string.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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/string.hpp>
  7. #include <sstream>
  8. namespace hana = boost::hana;
  9. int main() {
  10. {
  11. std::ostringstream ss;
  12. ss << hana::experimental::print(
  13. BOOST_HANA_STRING("")
  14. );
  15. BOOST_HANA_RUNTIME_CHECK(ss.str() == "\"\"");
  16. }
  17. {
  18. std::ostringstream ss;
  19. ss << hana::experimental::print(
  20. BOOST_HANA_STRING("x")
  21. );
  22. BOOST_HANA_RUNTIME_CHECK(ss.str() == "\"x\"");
  23. }
  24. {
  25. std::ostringstream ss;
  26. ss << hana::experimental::print(
  27. BOOST_HANA_STRING("xy")
  28. );
  29. BOOST_HANA_RUNTIME_CHECK(ss.str() == "\"xy\"");
  30. }
  31. {
  32. std::ostringstream ss;
  33. ss << hana::experimental::print(
  34. BOOST_HANA_STRING("xyz")
  35. );
  36. BOOST_HANA_RUNTIME_CHECK(ss.str() == "\"xyz\"");
  37. }
  38. }