From 1484ae8e0615a981a6666ee03d094a1a19239b12 Mon Sep 17 00:00:00 2001 From: Tobias Schwinger Date: Sun, 22 Jul 2007 08:29:54 +0000 Subject: [PATCH] adjusts test to semantic changes: unfused_typed only contains operator() overloads for one arity now [SVN r38267] --- test/functional/unfused_typed.cpp | 64 +++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/test/functional/unfused_typed.cpp b/test/functional/unfused_typed.cpp index 7c1e3270..7c5fa856 100644 --- a/test/functional/unfused_typed.cpp +++ b/test/functional/unfused_typed.cpp @@ -26,7 +26,9 @@ using mpl::placeholders::_; using boost::noncopyable; -typedef fusion::vector types; +typedef fusion::vector<> types0; +typedef fusion::vector types1; +typedef fusion::vector types3; template struct test_func @@ -79,9 +81,10 @@ void result_type_tests() { using boost::is_same; - typedef fusion::unfused_typed< test_func<>, types > t; - BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value )); - BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value )); + typedef fusion::unfused_typed< test_func<>, types0 > t0; + BOOST_TEST(( is_same< boost::result_of< t0 () >::type, long >::value )); + typedef fusion::unfused_typed< test_func<>, types1 > t1; + BOOST_TEST(( is_same< boost::result_of< t1 (int) >::type, long >::value )); } #if defined(BOOST_MSVC) && BOOST_MSVC < 1400 @@ -90,22 +93,30 @@ void result_type_tests() # define BOOST_TEST_NO_VC71(cond) BOOST_TEST(cond) #endif -int main() +void nullary_tests() { - result_type_tests(); - test_func f; - fusion::unfused_typed< test_func<>, types > unfused_func; - fusion::unfused_typed< test_func &, types > unfused_func_ref(f); - fusion::unfused_typed< test_func<> const, types > unfused_func_c; - fusion::unfused_typed< test_func<>, types > const unfused_func_c2; - fusion::unfused_typed< test_func const &, types > unfused_func_c_ref(f); + fusion::unfused_typed< test_func<>, types0 > unfused_func; + fusion::unfused_typed< test_func &, types0 > unfused_func_ref(f); + fusion::unfused_typed< test_func<> const, types0 > unfused_func_c; + fusion::unfused_typed< test_func<>, types0 > const unfused_func_c2; + fusion::unfused_typed< test_func const &, types0 > unfused_func_c_ref(f); BOOST_TEST(unfused_func() == 100); BOOST_TEST(unfused_func_ref() == 100); BOOST_TEST(unfused_func_c() == 0); BOOST_TEST(unfused_func_c2() == 0); BOOST_TEST(unfused_func_c_ref() == 0); +} + +void unary_tests() +{ + test_func f; + fusion::unfused_typed< test_func<>, types1 > unfused_func; + fusion::unfused_typed< test_func &, types1 > unfused_func_ref(f); + fusion::unfused_typed< test_func<> const, types1 > unfused_func_c; + fusion::unfused_typed< test_func<>, types1 > const unfused_func_c2; + fusion::unfused_typed< test_func const &, types1 > unfused_func_c_ref(f); long lvalue = 1; BOOST_TEST_NO_VC71(unfused_func(lvalue) == 100); @@ -118,18 +129,37 @@ int main() BOOST_TEST(lvalue == 1 + 4*sizeof(lvalue)); BOOST_TEST(unfused_func_c_ref(lvalue) == 0); BOOST_TEST(lvalue == 1 + 5*sizeof(lvalue)); +} +void ternary_tests() +{ + test_func f; + fusion::unfused_typed< test_func<>, types3 > unfused_func; + fusion::unfused_typed< test_func &, types3 > unfused_func_ref(f); + fusion::unfused_typed< test_func<> const, types3 > unfused_func_c; + fusion::unfused_typed< test_func<>, types3 > const unfused_func_c2; + fusion::unfused_typed< test_func const &, types3 > unfused_func_c_ref(f); + + long lvalue = 1; static const long expected = 2*sizeof(int) + 7*sizeof(char); BOOST_TEST_NO_VC71(unfused_func(lvalue,2,'\007') == 100 + expected); - BOOST_TEST(lvalue == 1 + 6*sizeof(lvalue)); + BOOST_TEST(lvalue == 1 + 1*sizeof(lvalue)); BOOST_TEST(unfused_func_ref(lvalue,2,'\007') == 100 + expected); - BOOST_TEST(lvalue == 1 + 7*sizeof(lvalue)); + BOOST_TEST(lvalue == 1 + 2*sizeof(lvalue)); BOOST_TEST(unfused_func_c(lvalue,2,'\007') == 0 + expected); - BOOST_TEST(lvalue == 1 + 8*sizeof(lvalue)); + BOOST_TEST(lvalue == 1 + 3*sizeof(lvalue)); BOOST_TEST(unfused_func_c2(lvalue,2,'\007') == 0 + expected); - BOOST_TEST(lvalue == 1 + 9*sizeof(lvalue)); + BOOST_TEST(lvalue == 1 + 4*sizeof(lvalue)); BOOST_TEST(unfused_func_c_ref(lvalue,2,'\007') == 0 + expected); - BOOST_TEST(lvalue == 1 + 10*sizeof(lvalue)); + BOOST_TEST(lvalue == 1 + 5*sizeof(lvalue)); +} + +int main() +{ + result_type_tests(); + nullary_tests(); + unary_tests(); + ternary_tests(); return boost::report_errors(); }