1// Copyright Louis Dionne 2013-2022
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
5#include <boost/hana/assert.hpp>
6#include <boost/hana/experimental/printable.hpp>
7#include <boost/hana/tuple.hpp>
8
9#include <sstream>
10#include <string>
11namespace hana = boost::hana;
12
13
14int main() {
15 {
16 std::ostringstream ss;
17 ss << hana::experimental::print(hana::make_tuple());
18 BOOST_HANA_RUNTIME_CHECK(ss.str() == "()");
19 }
20
21 {
22 std::ostringstream ss;
23 ss << hana::experimental::print(hana::make_tuple(1));
24 BOOST_HANA_RUNTIME_CHECK(ss.str() == "(1)");
25 }
26
27 {
28 std::ostringstream ss;
29 ss << hana::experimental::print(hana::make_tuple(1, 2));
30 BOOST_HANA_RUNTIME_CHECK(ss.str() == "(1, 2)");
31 }
32
33 {
34 std::ostringstream ss;
35 ss << hana::experimental::print(hana::make_tuple(1, '2', "3456"));
36 BOOST_HANA_RUNTIME_CHECK(ss.str() == "(1, 2, 3456)");
37 }
38
39 {
40 std::ostringstream ss;
41 ss << hana::experimental::print(hana::make_tuple(1, '2', hana::make_tuple()));
42 BOOST_HANA_RUNTIME_CHECK(ss.str() == "(1, 2, ())");
43 }
44
45 {
46 std::ostringstream ss;
47 ss << hana::experimental::print(hana::make_tuple(1, '2', hana::make_tuple(3.3, '4')));
48 BOOST_HANA_RUNTIME_CHECK(ss.str() == "(1, 2, (3.3, 4))");
49 }
50}
51

source code of boost/libs/hana/test/experimental/printable/tuple.cpp