2 /* Copyright 2002, The libsigc++ Development Team
3 * Assigned to public domain. Use as you wish without restriction.
6 #include "testutilities.h"
7 #include <sigc++/adaptors/hide.h>
13 std::ostringstream result_stream;
15 struct foo : public sigc::functor_base
17 // choose a type that can hold all return values
18 typedef int result_type;
22 result_stream << "foo() ";
28 result_stream << "foo(int " << j << ") ";
33 struct foo_void : public sigc::functor_base
35 typedef void result_type;
39 result_stream << "foo_void()";
43 } // end anonymous namespace
45 namespace sigc { SIGC_FUNCTOR_TRAIT(foo,bool) }
47 int main(int argc, char* argv[])
49 auto util = TestUtilities::get_instance();
51 if (!util->check_command_args(argc, argv))
52 return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE;
54 result_stream << sigc::hide<0>(foo())(1, 2);
55 util->check_result(result_stream, "foo(int 2) 3");
57 result_stream << sigc::hide<1>(foo())(1, 2);
58 util->check_result(result_stream, "foo(int 1) 2");
60 result_stream << sigc::hide<-1>(foo())(1);
61 util->check_result(result_stream, "foo() 1");
63 result_stream << sigc::hide(foo())(1);
64 util->check_result(result_stream, "foo() 1");
66 sigc::hide(foo_void())(1); // void test
67 util->check_result(result_stream, "foo_void()");
69 return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE;