diff --git a/test/allocator_test.cpp b/test/allocator_test.cpp index cab749f..0345608 100644 --- a/test/allocator_test.cpp +++ b/test/allocator_test.cpp @@ -84,5 +84,14 @@ test_main(int, char*[]) fv = &do_nothing; fv.clear(); + function > f2; + alloc_count = 0; + dealloc_count = 0; + f2 = plus(); + f2.clear(); + BOOST_TEST(alloc_count == 1); + BOOST_TEST(dealloc_count == 1); + return 0; } diff --git a/test/function_test.cpp b/test/function_test.cpp index 1b721a5..8b09ce5 100644 --- a/test/function_test.cpp +++ b/test/function_test.cpp @@ -632,6 +632,28 @@ test_ref() } } +static void +test_new_syntax() +{ + write_five_obj five; + function v2; + + // Assignment + v2 = five; + BOOST_TEST(!v2.empty()); + + // Invocation + global_int = 0; + v2(); + + BOOST_TEST(global_int == 5); + function cat(&string_cat); + BOOST_TEST(cat("str", "ing") == "string"); + + function sum(&sum_ints); + BOOST_TEST(sum(2, 3) == 5); +} + int test_main(int, char* []) { test_zero_args(); @@ -640,6 +662,7 @@ int test_main(int, char* []) test_emptiness(); test_member_functions(); test_ref(); + test_new_syntax(); return 0; }