diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-03-24 06:43:11 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-03-24 06:43:11 +0000 |
commit | ab01ea435b1fcd3e1579a5de9b73955a47c4fd0b (patch) | |
tree | 8f7720a8e4e91c029ab857d2b0d9dc32b8a01f44 | |
parent | 2c8fee233a4ac700e3e41f2ec581bc41bc6d7135 (diff) | |
download | ATCD-ab01ea435b1fcd3e1579a5de9b73955a47c4fd0b.tar.gz |
Tue Mar 24 06:43:42 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* bin/tao_orb_tests.lst:
Added new IDL_Inherited_Operation and the sequence unit tests
are not using boost anymore
* tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp
* tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp
* tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp
* tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp
* tests/Sequence_Unit_Tests/fwd_mock_reference.cpp
* tests/Sequence_Unit_Tests/fwd_mock_reference.hpp
* tests/Sequence_Unit_Tests/mock_array.hpp
* tests/Sequence_Unit_Tests/mock_reference.hpp
* tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp
* tests/Sequence_Unit_Tests/run_test.pl
* tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc
* tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp
* tests/Sequence_Unit_Tests/string_sequence_tester.hpp
* tests/Sequence_Unit_Tests/string_ut.cpp
* tests/Sequence_Unit_Tests/test_macros.h
* tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp
* tests/Sequence_Unit_Tests/testing_counters.hpp
* tests/Sequence_Unit_Tests/testing_string_traits.hpp
* tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp
* tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp
* tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp
* tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp
* tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp
* tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp
* tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp
* tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp
* tests/Sequence_Unit_Tests/value_sequence_tester.hpp
Removed usage of boost. The boost unit test framework is nice, but we
don't have boost on just a few build/test systems which results in the
fact that we don't run these tests which we really need to do, given
the fact that several of them are broken
24 files changed, 2270 insertions, 2748 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 2cd6f274d14..a8235518b76 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,41 @@ +Tue Mar 24 06:43:42 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> + + * bin/tao_orb_tests.lst: + Added new IDL_Inherited_Operation and the sequence unit tests + are not using boost anymore + + * tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp + * tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp + * tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp + * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp + * tests/Sequence_Unit_Tests/fwd_mock_reference.cpp + * tests/Sequence_Unit_Tests/fwd_mock_reference.hpp + * tests/Sequence_Unit_Tests/mock_array.hpp + * tests/Sequence_Unit_Tests/mock_reference.hpp + * tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp + * tests/Sequence_Unit_Tests/run_test.pl + * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc + * tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp + * tests/Sequence_Unit_Tests/string_sequence_tester.hpp + * tests/Sequence_Unit_Tests/string_ut.cpp + * tests/Sequence_Unit_Tests/test_macros.h + * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp + * tests/Sequence_Unit_Tests/testing_counters.hpp + * tests/Sequence_Unit_Tests/testing_string_traits.hpp + * tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp + * tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp + * tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp + * tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp + * tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp + * tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp + * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp + * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp + * tests/Sequence_Unit_Tests/value_sequence_tester.hpp + Removed usage of boost. The boost unit test framework is nice, but we + don't have boost on just a few build/test systems which results in the + fact that we don't run these tests which we really need to do, given + the fact that several of them are broken + Mon Mar 23 20:24:42 UTC 2009 Phil Mesnier <mesnier_p@ociweb.com> * tests/IDL_Inherited_Operation/InheritedOp_i.h: diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst index ca0cc308e61..6c08d25e478 100644 --- a/TAO/bin/tao_orb_tests.lst +++ b/TAO/bin/tao_orb_tests.lst @@ -311,6 +311,7 @@ TAO/tests/Big_Request_Muxing/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E TAO/tests/Oneways_Invoking_Twoways/run_test.pl: !ST !LabVIEW_RT !WinCE !FUZZ TAO/tests/Queued_Message_Test/run_test.pl: TAO/tests/DLL_ORB/run_test.pl: !ST !STATIC !LabVIEW_RT !WinCE !FUZZ +TAO/tests/IDL_Inherited_Operation/run_test.pl TAO/tests/InterOp-Naming/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ TAO/tests/Multiple/run_test.pl: !SUNCC5_1 !LabVIEW_RT !WinCE !FUZZ TAO/tests/Exposed_Policies/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !ACE_FOR_TAO !LabVIEW_RT !WinCE !FUZZ @@ -353,8 +354,7 @@ TAO/tests/UNKNOWN_Exception/run_test.pl: TAO/tests/Native_Exceptions/run_test.pl: TAO/tests/Servant_To_Reference_Test/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST TAO/tests/Sequence_Iterators/run_test.pl: -TAO/tests/Sequence_Unit_Tests/run_test.pl -noboost: !LabVIEW_RT !WinCE !FUZZ -TAO/tests/Sequence_Unit_Tests/run_test.pl -boost: BOOST !LabVIEW_RT !WinCE !FUZZ +TAO/tests/Sequence_Unit_Tests/run_test.pl: TAO/tests/Typedef_String_Array/run_test.pl: TAO/tests/GIOP_Fragments/PMB_With_Fragments/run_test.pl: !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ !VxWorks_RTP TAO/tests/CodeSets/simple/run_test.pl: !GIOP10 !STATIC !LabVIEW_RT !WinCE !FUZZ diff --git a/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc b/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc index 4c71d40e683..9bdcd042de1 100644 --- a/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc +++ b/TAO/tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc @@ -31,7 +31,7 @@ project(*Bounded_String) : taoexe { } } -project(*UB_Arr_Seq): taoexe, boost_unit_test_framework { +project(*UB_Arr_Seq): taoexe { // Temporarily disabled this test, need to change the mock_array a lot requires += dummy_label exename = unbounded_array_sequence_ut @@ -41,7 +41,7 @@ project(*UB_Arr_Seq): taoexe, boost_unit_test_framework { } } -project(*Obj_Ref_Seq_Elem): taoexe, boost_unit_test_framework { +project(*Obj_Ref_Seq_Elem): taoexe { exename = object_reference_sequence_element_ut Source_Files { mock_reference.cpp @@ -49,7 +49,7 @@ project(*Obj_Ref_Seq_Elem): taoexe, boost_unit_test_framework { } } -project(*UB_Obj_Ref_Seq): taoexe, boost_unit_test_framework { +project(*UB_Obj_Ref_Seq): taoexe { exename = unbounded_object_reference_sequence_ut Source_Files { mock_reference.cpp @@ -57,7 +57,7 @@ project(*UB_Obj_Ref_Seq): taoexe, boost_unit_test_framework { } } -project(*UB_Sequence_CDR): taoexe, boost_unit_test_framework { +project(*UB_Sequence_CDR): taoexe { exename = unbounded_sequence_cdr_ut Source_Files { mock_reference.cpp @@ -65,7 +65,7 @@ project(*UB_Sequence_CDR): taoexe, boost_unit_test_framework { } } -project(*B_Sequence_CDR): taoexe, boost_unit_test_framework { +project(*B_Sequence_CDR): taoexe { exename = bounded_sequence_cdr_ut Source_Files { mock_reference.cpp @@ -73,7 +73,7 @@ project(*B_Sequence_CDR): taoexe, boost_unit_test_framework { } } -project(*UB_Fwd_Ob_Ref_Seq): taoexe, boost_unit_test_framework { +project(*UB_Fwd_Ob_Ref_Seq): taoexe { exename = unbounded_fwd_object_reference_sequence_ut Source_Files { fwd_mock_reference.cpp @@ -81,7 +81,7 @@ project(*UB_Fwd_Ob_Ref_Seq): taoexe, boost_unit_test_framework { } } -project(*UB_Octet_Sequence): taoexe, boost_unit_test_framework { +project(*UB_Octet_Sequence): taoexe { exename = unbounded_octet_sequence_ut Source_Files { mock_reference.cpp @@ -89,7 +89,7 @@ project(*UB_Octet_Sequence): taoexe, boost_unit_test_framework { } } -project(*UB_Oct_Seq_No_Cpy): taoexe, boost_unit_test_framework { +project(*UB_Oct_Seq_No_Cpy): taoexe { exename = unbounded_octet_sequence_no_copy_ut Source_Files { mock_reference.cpp @@ -97,7 +97,7 @@ project(*UB_Oct_Seq_No_Cpy): taoexe, boost_unit_test_framework { } } -project(*B_Obj_Ref_Seq): taoexe, boost_unit_test_framework { +project(*B_Obj_Ref_Seq): taoexe { exename = bounded_object_reference_sequence_ut Source_Files { mock_reference.cpp @@ -105,42 +105,42 @@ project(*B_Obj_Ref_Seq): taoexe, boost_unit_test_framework { } } -project(*String_Seq_Elem): taoexe, boost_unit_test_framework { +project(*String_Seq_Elem): taoexe { exename = string_sequence_element_ut Source_Files { string_sequence_element_ut.cpp } } -project(*UB_String_Seq): taoexe, boost_unit_test_framework { +project(*UB_String_Seq): taoexe { exename = unbounded_string_sequence_ut Source_Files { unbounded_string_sequence_ut.cpp } } -project(*B_String_Seq): taoexe, boost_unit_test_framework { +project(*B_String_Seq): taoexe { exename = bounded_string_sequence_ut Source_Files { bounded_string_sequence_ut.cpp } } -project(*Test_Alloc_Traits): taoexe, boost_unit_test_framework { +project(*Test_Alloc_Traits): taoexe { exename = testing_allocation_traits_ut Source_Files { testing_allocation_traits_ut.cpp } } -project(*UB_Value_Sequence): taoexe, boost_unit_test_framework { +project(*UB_Value_Sequence): taoexe { exename = unbounded_value_sequence_ut Source_Files { unbounded_value_sequence_ut.cpp } } -project(*B_Value_Sequence): taoexe, boost_unit_test_framework { +project(*B_Value_Sequence): taoexe { exename = bounded_value_sequence_ut Source_Files { bounded_value_sequence_ut.cpp diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp index 21a8fb14451..90b08c65cb8 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_object_reference_sequence_ut.cpp @@ -16,11 +16,9 @@ #include "tao/Bounded_Object_Reference_Sequence_T.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; CORBA::ULong const TMAX = 64; @@ -35,7 +33,7 @@ struct Tester typedef tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -43,16 +41,17 @@ struct Tester { tested_sequence x; - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_buffer_constructor_release_true() + int test_buffer_constructor_release_true() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -63,17 +62,18 @@ struct Tester a.reset(); tested_sequence x(maximum / 2, data, true); - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(x.length(), maximum / 2); - BOOST_CHECK_EQUAL(x.get_buffer(), data); - BOOST_CHECK_EQUAL(x.release(), true); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(x.length(), maximum / 2); + CHECK_EQUAL(x.get_buffer(), data); + CHECK_EQUAL(x.release(), true); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_buffer_constructor_release_false() + int test_buffer_constructor_release_false() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -85,23 +85,24 @@ struct Tester { tested_sequence x(maximum / 2, data, false); - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(x.length(), maximum / 2); - BOOST_CHECK_EQUAL(x.get_buffer(), data); - BOOST_CHECK_EQUAL(x.release(), false); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(x.length(), maximum / 2); + CHECK_EQUAL(x.get_buffer(), data); + CHECK_EQUAL(x.release(), false); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); tested_sequence::freebuf(data); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor_from_default() + int test_copy_constructor_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -111,12 +112,13 @@ struct Tester tested_sequence y(x); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(2), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(2), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor() + int test_copy_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls da(tested_allocation_traits::default_buffer_allocation_calls); @@ -127,14 +129,14 @@ struct Tester CORBA::ULong const l = 16; { tested_sequence x; - BOOST_CHECK_MESSAGE(da.expect(1), da); - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(da.expect(1), da); + FAIL_RETURN_IF_NOT(a.expect(0), a); x.length(l); - BOOST_CHECK_MESSAGE(i.expect(l), i); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(i.expect(l), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); for(CORBA::ULong i = 0; i != l; ++i) { x[i] = mock_reference::allocate(i); @@ -143,23 +145,24 @@ struct Tester d.reset(); r.reset(); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); - BOOST_CHECK_MESSAGE(d.expect(l), d); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(d.expect(l), d); for(CORBA::ULong i = 0; i != l; ++i) { - BOOST_CHECK_EQUAL(int(i), y[i]->id()); + CHECK_EQUAL(int(i), y[i]->id()); } } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(2*TMAX), r); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(2), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(2*TMAX), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(2), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor_throw_duplicate() + int test_copy_constructor_throw_duplicate() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls da(tested_allocation_traits::default_buffer_allocation_calls); @@ -170,15 +173,15 @@ struct Tester CORBA::ULong const l = 16; { tested_sequence x; - BOOST_CHECK_MESSAGE(da.expect(1), da); - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(da.expect(1), da); + FAIL_RETURN_IF_NOT(a.expect(0), a); x.length(l); - BOOST_CHECK_MESSAGE(i.expect(l), i); + FAIL_RETURN_IF_NOT(i.expect(l), i); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); for(CORBA::ULong i = 0; i != l; ++i) { x[i] = mock_reference::allocate(i); @@ -187,21 +190,22 @@ struct Tester d.reset(); r.reset(); mock_reference::duplicate_calls.failure_countdown(8); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(da.expect(0), da); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(8), d); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(da.expect(0), da); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(8), d); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls da(tested_allocation_traits::default_buffer_allocation_calls); @@ -211,18 +215,19 @@ struct Tester tested_sequence x; x.length(8); - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + FAIL_RETURN_IF_NOT(i.expect(8), i); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(da.expect(1), da); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(da.expect(1), da); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls da(tested_allocation_traits::default_buffer_allocation_calls); @@ -230,21 +235,22 @@ struct Tester expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x; - BOOST_CHECK_MESSAGE(da.expect(1), da); - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(da.expect(1), da); + FAIL_RETURN_IF_NOT(a.expect(0), a); x.length(16); - BOOST_CHECK_MESSAGE(i.expect(16), i); + FAIL_RETURN_IF_NOT(i.expect(16), i); - BOOST_CHECK_THROW(x.length(2 * TMAX), std::runtime_error); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + CHECK_THROW(x.length(2 * TMAX), std::runtime_error); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); - BOOST_CHECK_EQUAL(TMAX, x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(TMAX, x.maximum()); + CHECK_EQUAL(CORBA::ULong(16), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } value_type * alloc_and_init_buffer() @@ -258,15 +264,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK_EQUAL( 1, a[0]->id()); - BOOST_CHECK_EQUAL( 4, a[1]->id()); - BOOST_CHECK_EQUAL( 9, a[2]->id()); - BOOST_CHECK_EQUAL(16, a[3]->id()); + CHECK_EQUAL( 1, a[0]->id()); + CHECK_EQUAL( 4, a[1]->id()); + CHECK_EQUAL( 9, a[2]->id()); + CHECK_EQUAL(16, a[3]->id()); + return 0; } - void test_replace_release_true() + int test_replace_release_true() { value_type * buffer = alloc_and_init_buffer(); @@ -276,23 +283,24 @@ struct Tester { tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - - BOOST_CHECK_EQUAL(TMAX, a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + + CHECK_EQUAL(TMAX, a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + return 0; } - void test_replace_release_false() + int test_replace_release_false() { value_type * buffer = alloc_and_init_buffer(); @@ -302,23 +310,24 @@ struct Tester { tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - - BOOST_CHECK_EQUAL(TMAX, a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + + CHECK_EQUAL(TMAX, a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + return 0; } - void test_replace_release_default() + int test_replace_release_default() { value_type * buffer = alloc_and_init_buffer(); @@ -328,83 +337,40 @@ struct Tester { tested_sequence a; a.replace(4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - - BOOST_CHECK_EQUAL(TMAX, a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + + CHECK_EQUAL(TMAX, a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(TMAX), r); - } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_throw_duplicate, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_default, - shared_this)); + FAIL_RETURN_IF_NOT(r.expect(TMAX), r); + return 0; } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); - - return ts; + int status = 0; + Tester mytester; + + status += mytester.test_default_constructor(); + status += mytester.test_buffer_constructor_release_true(); + status += mytester.test_buffer_constructor_release_false(); + status += mytester.test_copy_constructor_from_default(); + status += mytester.test_copy_constructor(); + status += mytester.test_copy_constructor_throw_duplicate(); + status += mytester.test_set_length_less_than_maximum(); + status += mytester.test_set_length_more_than_maximum(); + status += mytester.test_replace_release_true(); + status += mytester.test_replace_release_false(); + status += mytester.test_replace_release_default(); + + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp index 85f112d7dc7..b8365bbe922 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_sequence_cdr_ut.cpp @@ -23,11 +23,9 @@ #include "tao/Bounded_Sequence_CDR_T.h" #include "tao/CDR.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; CORBA::ULong const TMAX = 64; @@ -64,15 +62,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK_EQUAL( 1, a[0]->id()); - BOOST_CHECK_EQUAL( 4, a[1]->id()); - BOOST_CHECK_EQUAL( 9, a[2]->id()); - BOOST_CHECK_EQUAL(16, a[3]->id()); + CHECK_EQUAL( 1, a[0]->id()); + CHECK_EQUAL( 4, a[1]->id()); + CHECK_EQUAL( 9, a[2]->id()); + CHECK_EQUAL(16, a[3]->id()); + return 0; } - void test_stream() + int test_stream() { value_type * buffer = alloc_and_init_buffer(); @@ -81,50 +80,28 @@ struct Tester tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(64), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(64), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); TAO_OutputCDR stream; stream << a; - BOOST_CHECK_MESSAGE(s.expect(4), s); + FAIL_RETURN_IF_NOT(s.expect(4), s); } tested_sequence::freebuf(buffer); + return 0; } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_stream, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + int status = 0; + Tester mytester; + + status += mytester.test_stream(); - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp index 4cf5ea06a96..01a9fb09d04 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_string_sequence_ut.cpp @@ -21,13 +21,9 @@ #include "ace/OS_NS_string.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" -#include <sstream> -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; CORBA::ULong const MAXIMUM = 32; @@ -44,7 +40,7 @@ struct Tester typedef typename tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -53,21 +49,23 @@ struct Tester tested_sequence x; x.length(8); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF_NOT(a.expect(0), a); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + FAIL_RETURN_IF_NOT(i.expect(8), i); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { tested_sequence x; - BOOST_CHECK_THROW(x.length(64), std::runtime_error); + CHECK_THROW(x.length(64), std::runtime_error); + return 0; } value_type * alloc_and_init_buffer() @@ -81,15 +79,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK(helper::compare(1, a[0])); - BOOST_CHECK(helper::compare(4, a[1])); - BOOST_CHECK(helper::compare(9, a[2])); - BOOST_CHECK(helper::compare(16, a[3])); + CHECK(helper::compare(1, a[0])); + CHECK(helper::compare(4, a[1])); + CHECK(helper::compare(9, a[2])); + CHECK(helper::compare(16, a[3])); + return 0; } - void test_regression_2201() + int test_regression_2201() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -97,23 +96,24 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); a.length (3); - BOOST_CHECK_EQUAL(CORBA::ULong(3), a.length()); + CHECK_EQUAL(CORBA::ULong(3), a.length()); a.length (4); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK(helper::compare_empty(a[3])); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK(helper::compare_empty(a[3])); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -121,19 +121,20 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -141,19 +142,20 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -161,18 +163,19 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(true, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -182,23 +185,24 @@ struct Tester { tested_sequence a; a.replace(4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); @@ -208,23 +212,24 @@ struct Tester { tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); @@ -234,45 +239,49 @@ struct Tester { tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + + CHECK_EQUAL(CORBA::ULong(MAXIMUM), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -280,112 +289,69 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), b.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), b.maximum()); + CHECK_EQUAL(CORBA::ULong(0), b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(0), c); + FAIL_RETURN_IF_NOT(c.expect(0), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); - BOOST_CHECK_MESSAGE(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(c.expect(0), c); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(MAXIMUM), r); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(MAXIMUM), r); + return 0; } - - void add_all(test_suite * ts) + + int test_all () { - typedef string_sequence_tester<tested_sequence> common; - boost::shared_ptr<common> tester(common::allocate(true)); - tester->add_all(ts); - - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_regression_2201, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - } + int status = 0; - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + typedef string_sequence_tester<tested_sequence> common; + common X (true); + status += X.test_all (); + + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_regression_2201(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_default(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("bounded string sequence unit test"); + int status = 0; - { - typedef TAO::bounded_basic_string_sequence<char, MAXIMUM> s_sequence; - typedef Tester<s_sequence> nTester; - boost::shared_ptr<nTester> tester(nTester::allocate()); - tester->add_all(ts); - } + typedef TAO::bounded_basic_string_sequence<char, MAXIMUM> s_sequence; + typedef Tester<s_sequence> nTester; + nTester myntester; + + status += myntester.test_all(); - { - typedef TAO::bounded_basic_string_sequence<CORBA::WChar, MAXIMUM> w_sequence; - typedef Tester<w_sequence> wTester; - boost::shared_ptr<wTester> tester(wTester::allocate()); - tester->add_all(ts); - } + typedef TAO::bounded_basic_string_sequence<CORBA::WChar, MAXIMUM> w_sequence; + typedef Tester<w_sequence> wTester; + wTester mywtester; + + status += mywtester.test_all(); - return ts; + return status; } + diff --git a/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp index 4ed1a2d2041..2f3b95c8113 100644 --- a/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp @@ -15,11 +15,9 @@ #include "value_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; CORBA::ULong const MAXIMUM = 32; @@ -33,7 +31,7 @@ struct Tester { typedef tested_sequence::value_type value_type; - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -41,19 +39,21 @@ struct Tester tested_sequence x; x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(MAXIMUM), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { tested_sequence x; - BOOST_CHECK_THROW(x.length(64), std::runtime_error); + CHECK_THROW(x.length(64), std::runtime_error); + return 0; } value_type * alloc_and_init_buffer() @@ -64,7 +64,7 @@ struct Tester return buf; } - void test_regression_2201 () + int test_regression_2201 () { value_type * buffer = alloc_and_init_buffer(); @@ -72,28 +72,29 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(32, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(32), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); a.length (3); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(3), a.length()); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(3), a.length()); a.length (4); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(int( 0), a[3]); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(int( 0), a[3]); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); @@ -101,62 +102,65 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -165,24 +169,25 @@ struct Tester { tested_sequence a; a.replace(4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -191,24 +196,25 @@ struct Tester { tested_sequence a; a.replace(4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -217,144 +223,107 @@ struct Tester { tested_sequence a; a.replace(4, buffer, true); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(32), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + + CHECK_EQUAL(CORBA::ULong(32), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::default_buffer_allocation_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(MAXIMUM, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(MAXIMUM, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), c); tested_sequence::freebuf(buffer); + return 0; } - void add_all(test_suite * ts) + int test_all() { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_regression_2201, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - + int status = 0; + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_regression_2201(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded value sequence unit test"); - + int status = 0; { - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + Tester tester; + status += tester.test_all (); } { typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate(true)); - tester->add_all(ts); + common tester(true); + status += tester.test_all (); } - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp b/TAO/tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp index 20cfafac6ea..546c95d0863 100644 --- a/TAO/tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/object_reference_sequence_element_ut.cpp @@ -11,27 +11,16 @@ #include "testing_object_reference_traits.hpp" #include "mock_reference.hpp" #include "tao/Object_Reference_Sequence_Element_T.h" - -#include <sstream> -#include <stdexcept> -#include <iostream> - -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO::details; -using namespace boost::unit_test_framework; - -struct Tester -{ typedef object_reference_traits<mock_reference,mock_reference_var,true> tested_element_traits; typedef object_reference_sequence_element<tested_element_traits> tested_element; typedef mock_reference * reference_type; typedef tested_element_traits::object_type_var reference_var; - void test_assignment_from_var_release_true() + int test_assignment_from_var_release_true() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -42,30 +31,32 @@ struct Tester tested_element x(xe, true); reference_var y(mock_reference::allocate(2)); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(x); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0),d ); + FAIL_RETURN_IF_NOT(r.expect(0),r ); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); + + return 0; } - void test_assignment_from_var_release_false() + int test_assignment_from_var_release_false() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -77,31 +68,32 @@ struct Tester tested_element x(xe, false); reference_var y(mock_reference::allocate(2)); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d ); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(x); tested_element_traits::release(oldxe); - BOOST_CHECK_MESSAGE(r.expect(2), r); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(r.expect(2), r); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0),d ); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); + return 0; } - void test_assignment_from_var_throw() + int test_assignment_from_var_throw() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -112,33 +104,34 @@ struct Tester tested_element x(xe, true); reference_var y(mock_reference::allocate(2)); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); mock_reference::duplicate_calls.failure_countdown(1); - BOOST_CHECK_THROW(x = y, testing_exception); + CHECK_THROW(x = y, testing_exception); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); - BOOST_CHECK_EQUAL(1, x->id()); - BOOST_CHECK_EQUAL(2, y->id()); + CHECK_EQUAL(1, x->id()); + CHECK_EQUAL(2, y->id()); tested_element_traits::release(x); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); + return 0; } - void test_assignment_from_element_release_true() + int test_assignment_from_element_release_true() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -151,31 +144,32 @@ struct Tester reference_type ye = mock_reference::allocate(2); tested_element y(ye, true); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0) ,r); x = y; - BOOST_CHECK_MESSAGE(d.expect(1), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(d.expect(1), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(xe); tested_element_traits::release(ye); - BOOST_CHECK_MESSAGE(r.expect(2), r); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(r.expect(2),r ); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); + return 0; } - void test_assignment_from_element_release_false() + int test_assignment_from_element_release_false() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -189,32 +183,33 @@ struct Tester reference_type ye = mock_reference::allocate(2); tested_element y(ye, true); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(1), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(1), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(1), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(1), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(xe); tested_element_traits::release(oldxe); tested_element_traits::release(ye); - BOOST_CHECK_MESSAGE(r.expect(3), r); - BOOST_CHECK_MESSAGE(mr.expect(3), mr); + FAIL_RETURN_IF_NOT(r.expect(3), r); + FAIL_RETURN_IF_NOT(mr.expect(3), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); + return 0; } - void test_assignment_from_reference_release_true() + int test_assignment_from_reference_release_true() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -226,30 +221,31 @@ struct Tester reference_type y = mock_reference::allocate(2); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(r.expect(1), r); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); + return 0; } - void test_assignment_from_reference_release_false() + int test_assignment_from_reference_release_false() { expected_calls d(tested_element_traits::duplicate_calls); expected_calls r(tested_element_traits::release_calls); @@ -262,81 +258,43 @@ struct Tester reference_type y = mock_reference::allocate(2); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(1), mr); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(1), mr); - BOOST_CHECK_EQUAL(2, x->id()); + CHECK_EQUAL(2, x->id()); tested_element_traits::release(xe); tested_element_traits::release(oldxe); - BOOST_CHECK_MESSAGE(r.expect(2), r); - BOOST_CHECK_MESSAGE(mr.expect(2), mr); + FAIL_RETURN_IF_NOT(r.expect(2), 2); + FAIL_RETURN_IF_NOT(mr.expect(2), mr); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); - BOOST_CHECK_MESSAGE(md.expect(0), md); - BOOST_CHECK_MESSAGE(mr.expect(0), mr); - } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_var_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_var_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_var_throw, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_element_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_element_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_reference_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_reference_release_false, - shared_this)); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + FAIL_RETURN_IF_NOT(md.expect(0), md); + FAIL_RETURN_IF_NOT(mr.expect(0), mr); + return 0; } - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; -}; - -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("object reference sequence element unit test"); + int status = 0; - boost::shared_ptr<Tester > mock_reference_tester( - Tester::allocate()); - mock_reference_tester->add_all(ts); + status += test_assignment_from_var_release_true (); + status += test_assignment_from_var_release_false (); + status += test_assignment_from_var_throw (); + status += test_assignment_from_element_release_true (); + status += test_assignment_from_element_release_false (); + status += test_assignment_from_reference_release_true (); + status += test_assignment_from_reference_release_false (); - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/run_test.pl b/TAO/tests/Sequence_Unit_Tests/run_test.pl index 3b3ec000483..bc0b4f461cb 100755 --- a/TAO/tests/Sequence_Unit_Tests/run_test.pl +++ b/TAO/tests/Sequence_Unit_Tests/run_test.pl @@ -6,20 +6,12 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; -use PerlACE::Run_Test; +use PerlACE::TestTarget; use strict; -if ($ARGV[0] =~ /^-h/i || $ARGV[0] =~ /^-\?/i) { - print "Usage: run_test.pl [-boost|-noboost]\n". - "\tDefault is to run all tests, specifying -boost or -noboost will\n". - "\teither run the tests that require the boost unit test library or\n". - "\tthe other tests, respectively.\n"; - exit 0; -} - my $final_result = 0; -my @tests = qw(unbounded_value_sequence_ut +my @testsToRun = qw(unbounded_value_sequence_ut unbounded_array_sequence_ut bounded_value_sequence_ut string_sequence_element_ut @@ -34,9 +26,6 @@ my @tests = qw(unbounded_value_sequence_ut bounded_object_reference_sequence_ut bounded_sequence_cdr_ut unbounded_sequence_cdr_ut - ); - -my @testsNoBoost = qw( Unbounded_Octet Unbounded_Simple_Types Bounded_Simple_Types @@ -44,51 +33,24 @@ my @testsNoBoost = qw( Bounded_String ); -my @testsToRun = qw(); - -push(@testsToRun, @tests) if ($#ARGV < 0 || $ARGV[0] eq '-boost'); -push(@testsToRun, @testsNoBoost) if ($#ARGV < 0 || $ARGV[0] eq '-noboost'); - - foreach my $process (@testsToRun) { - - - my $P = 0; - if (PerlACE::is_vxworks_test()) { - $P = new PerlACE::ProcessVX ($process, - '--log_level=nothing ' - .'--report_level=no'); - } - else { - $P = new PerlACE::Process ($process, - '--log_level=nothing ' - .'--report_level=no'); - } - my $executable = $P->Executable; - - # Not all the binaries are generated in all configurations. - if (PerlACE::is_vxworks_test()) { - next unless -e $executable; - } - else { - next unless -x $executable; - } - - print "Running $process ..."; - my $result = $P->Spawn; - if ($result != 0) { - print "FAILED\n"; - $final_result = 1; - next; - } - $result = $P->WaitKill($PerlACE::wait_interval_for_process_creation); - if ($result != 0) { - print "FAILED\n"; - $final_result = 1; - next; - } - print "SUCCESS\n"; + my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + my $P = $server->CreateProcess ($process); + print "Running $process ...\n"; + my $result = $P->Spawn; + if ($result != 0) { + print "FAILED $process\n"; + $final_result = 1; + next; + } + $result = $P->WaitKill($server->ProcessStartWaitInterval()); + if ($result != 0) { + print "FAILED $process\n"; + $final_result = 1; + next; + } + print "SUCCESS\n"; } exit $final_result; diff --git a/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp b/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp index 3bf93b550e4..a70089ecb79 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp @@ -15,388 +15,393 @@ #include "ace/OS_NS_string.h" -#include <sstream> -#include <stdexcept> -#include <iostream> - -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO::details; -using namespace boost::unit_test_framework; + template<typename charT> -struct helper {}; +struct helper +{ +}; template<> -struct helper<char> +struct helper <char> { - static char const * empty() { + static char const * + empty () + { return ""; } - static char const * sample0() { + static char const * + sample0 () + { return "Hello"; } - static char const * sample1() { + static char const * + sample1 () + { return "World"; } - static char * dup_sample0() { - return string_traits<char,true>::duplicate(sample0()); + static char * + dup_sample0 () + { + return string_traits <char, true>::duplicate (sample0 ()); } - static char * dup_sample1() { - return string_traits<char,true>::duplicate(sample1()); + static char * + dup_sample1 () + { + return string_traits <char, true>::duplicate (sample1 ()); } - static bool equal(char const * lhs, char const * rhs) { - return ACE_OS::strcmp(lhs, rhs) == 0; + static bool + equal (char const *lhs, char const *rhs) + { + return ACE_OS::strcmp (lhs, rhs) == 0; } }; template<> -struct helper<CORBA::WChar> +struct helper <CORBA::WChar> { - static CORBA::WChar const * empty() { + static CORBA::WChar const * + empty () + { return L""; } - static CORBA::WChar const * sample0() { + static CORBA::WChar const * + sample0 () + { return L"Hello"; } - static CORBA::WChar const * sample1() { + static CORBA::WChar const * + sample1 () + { return L"World"; } - static CORBA::WChar * dup_sample0() { - return string_traits<CORBA::WChar,true>::duplicate(sample0()); + static CORBA::WChar * + dup_sample0 () + { + return string_traits <CORBA::WChar, true>::duplicate (sample0 ()); } - static CORBA::WChar * dup_sample1() { - return string_traits<CORBA::WChar,true>::duplicate(sample1()); + static CORBA::WChar * + dup_sample1 () + { + return string_traits <CORBA::WChar, true>::duplicate (sample1 ()); } - static bool equal(CORBA::WChar const * lhs, CORBA::WChar const * rhs) { - return ACE_OS::strcmp(lhs, rhs) == 0; + static bool + equal (CORBA::WChar const *lhs, CORBA::WChar const *rhs) + { + return ACE_OS::strcmp (lhs, rhs) == 0; } }; template<class charT> struct Tester { - typedef string_traits<charT,true> tested_element_traits; - typedef string_sequence_element<tested_element_traits> tested_element; - typedef charT * string_type; - typedef charT const * const_string_type; + typedef string_traits <charT, true> tested_element_traits; + typedef string_sequence_element <tested_element_traits> tested_element; + typedef charT *string_type; + typedef charT const *const_string_type; typedef typename tested_element_traits::string_var string_var; typedef typename tested_element_traits::string_mgr string_mgr; - void test_assignment_from_const_string() + int + test_assignment_from_const_string () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample0(); - const_string_type y = helper<charT>::sample1(); - d.reset(); r.reset(); + string_type xe = helper <charT>::dup_sample0 (); + const_string_type y = helper <charT>::sample1 (); + d.reset (); + r.reset (); tested_element x(xe, true); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample1(), xe), - "Mismatch after assignment from const. expected=" - << helper<charT>::sample0() - << ", got=" << x); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample1(), xe), + "Mismatch after assignment from const. expected=" + << helper<charT>::sample0() + << ", got=" << x); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_element() + int + test_assignment_from_element () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample0(); + string_type xe = helper <charT>::dup_sample0 (); tested_element x(xe, true); - string_type ye = helper<charT>::dup_sample1(); + string_type ye = helper <charT>::dup_sample1 (); tested_element y(ye, true); - d.reset(); r.reset(); + d.reset (); + r.reset (); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample1(), xe), - "Mismatch after assignment from element. expected=" - << helper<charT>::sample1() - << ", got=" << xe); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample1(), xe), + "Mismatch after assignment from element. expected=" + << helper<charT>::sample1() + << ", got=" << xe); - tested_element_traits::release(xe); - tested_element_traits::release(ye); - BOOST_CHECK_MESSAGE(r.expect(2), r); + tested_element_traits::release (xe); + tested_element_traits::release (ye); + FAIL_RETURN_IF_NOT(r.expect(2), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_self_assignment() + int + test_self_assignment () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample0(); + string_type xe = helper <charT>::dup_sample0 (); tested_element x(xe, true); - d.reset(); r.reset(); + d.reset (); + r.reset (); x = x; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after self assignment. expected=" - << helper<charT>::sample0() - << ", got=" << xe); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after self assignment. expected=" + << helper<charT>::sample0() + << ", got=" << xe); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_non_const_string() + int + test_assignment_from_non_const_string () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { string_type xe = 0; tested_element x(xe, true); string_type y = - tested_element_traits::duplicate(helper<charT>::sample0()); - BOOST_CHECK_MESSAGE(d.expect(1), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + tested_element_traits::duplicate (helper <charT>::sample0 ()); + FAIL_RETURN_IF_NOT(d.expect(1), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after assignment from non-const. expected=" - << helper<charT>::sample0() - << ", got=" << x); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after assignment from non-const. expected=" + << helper<charT>::sample0() + << ", got=" << x); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_copy_constructor() + int + test_copy_constructor () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { string_type xe = - tested_element_traits::duplicate(helper<charT>::sample0()); + tested_element_traits::duplicate (helper <charT>::sample0 ()); tested_element x(xe, true); - d.reset(); r.reset(); + d.reset (); + r.reset (); - tested_element y(x); + tested_element y (x); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), y), - "Mismatch after copy constructor. expected=" - << helper<charT>::sample0() - << ", got=" << y); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), y), + "Mismatch after copy constructor. expected=" + << helper<charT>::sample0() + << ", got=" << y); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_copy() + int + test_assignment_from_copy () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample0(); + string_type xe = helper <charT>::dup_sample0 (); tested_element x(xe, true); - d.reset(); r.reset(); + d.reset (); + r.reset (); - tested_element y(x); + tested_element y (x); x = y; - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after assignment. expected=" - << helper<charT>::sample0() - << ", got=" << xe); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after assignment. expected=" + << helper<charT>::sample0() + << ", got=" << xe); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), y), - "Mismatch after assignment. expected=" - << helper<charT>::sample0() - << ", got=" << y); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), y), + "Mismatch after assignment. expected=" + << helper<charT>::sample0() + << ", got=" << y); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_var() + int + test_assignment_from_var () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample1(); + string_type xe = helper <charT>::dup_sample1 (); tested_element x(xe, true); - BOOST_CHECK_MESSAGE(d.expect(1), d); + FAIL_RETURN_IF_NOT(d.expect(1), d); - string_var y(helper<charT>::sample0()); + string_var y (helper <charT>::sample0()); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after assignment from var. expected=" - << helper<charT>::sample0() - << ", got=" << x); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after assignment from var. expected=" + << helper<charT>::sample0() + << ", got=" << x); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - void test_assignment_from_mgr() + int + test_assignment_from_mgr () { - expected_calls d(tested_element_traits::duplicate_calls); - expected_calls r(tested_element_traits::release_calls); + expected_calls d (tested_element_traits::duplicate_calls); + expected_calls r (tested_element_traits::release_calls); { - string_type xe = helper<charT>::dup_sample1(); + string_type xe = helper <charT>::dup_sample1 (); tested_element x(xe, true); - BOOST_CHECK_MESSAGE(d.expect(1), d); + FAIL_RETURN_IF_NOT(d.expect(1), d); string_mgr y; - y = helper<charT>::sample0(); + y = helper <charT>::sample0 (); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); x = y; - BOOST_CHECK_MESSAGE(r.expect(1), r); + FAIL_RETURN_IF_NOT(r.expect(1), r); - BOOST_CHECK_MESSAGE( - helper<charT>::equal(helper<charT>::sample0(), xe), - "Mismatch after assignment from mgr. expected=" - << helper<charT>::sample0() - << ", got=" << x); + FAIL_RETURN_IF_NOT( + helper<charT>::equal(helper<charT>::sample0(), xe), + "Mismatch after assignment from mgr. expected=" + << helper<charT>::sample0() + << ", got=" << x); - tested_element_traits::release(xe); - BOOST_CHECK_MESSAGE(r.expect(1), r); + tested_element_traits::release (xe); + FAIL_RETURN_IF_NOT(r.expect(1), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); + return 0; } - - void add_all(test_suite * ts) + int + test_all () { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_const_string, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_element, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_self_assignment, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_non_const_string, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_copy, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_var, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_mgr, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + int status = 0; + status += this->test_assignment_from_const_string (); + status += this->test_assignment_from_element (); + status += this->test_self_assignment (); + status += this->test_assignment_from_non_const_string (); + status += this->test_copy_constructor (); + status += this->test_assignment_from_copy (); + status += this->test_assignment_from_var (); + status += this->test_assignment_from_mgr (); + return status; } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) -{ - test_suite * ts = - BOOST_TEST_SUITE("string sequence element unit test"); - - boost::shared_ptr<Tester<char> > char_tester( - Tester<char>::allocate()); - char_tester->add_all(ts); - - boost::shared_ptr<Tester<CORBA::WChar> > wchar_tester( - Tester<CORBA::WChar>::allocate()); - wchar_tester->add_all(ts); - - return ts; -} +int ACE_TMAIN (int, ACE_TCHAR*[]) + { + int status = 0; + Tester <char> char_tester; + status += char_tester.test_all (); + Tester <char> wchar_tester; + status += wchar_tester.test_all (); + return status; + } diff --git a/TAO/tests/Sequence_Unit_Tests/string_sequence_tester.hpp b/TAO/tests/Sequence_Unit_Tests/string_sequence_tester.hpp index 2b4d3d6406f..ffcb4923845 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_sequence_tester.hpp +++ b/TAO/tests/Sequence_Unit_Tests/string_sequence_tester.hpp @@ -13,9 +13,7 @@ #include "ace/OS_NS_string.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" #include <sstream> @@ -116,24 +114,25 @@ struct string_sequence_tester typedef typename tested_sequence::element_traits tested_element_traits; typedef typename tested_sequence::allocation_traits tested_allocation_traits; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_EQUAL( + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(bounded_, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 1 : 0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(bounded_ ? 1 : 0), f); + return 0; } - void test_copy_constructor_from_default() + int test_copy_constructor_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -145,30 +144,32 @@ struct string_sequence_tester a.reset(); f.reset(); i.reset(); d.reset(); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(bounded_ ? 1 : 0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); - BOOST_CHECK_MESSAGE(d.expect(0), d); - - BOOST_CHECK_EQUAL(x.maximum(), y.maximum()); - BOOST_CHECK_EQUAL(x.length(), y.length()); - BOOST_CHECK_EQUAL(x.release(), y.release()); + FAIL_RETURN_IF_NOT(a.expect(bounded_ ? 1 : 0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + + CHECK_EQUAL(x.maximum(), y.maximum()); + CHECK_EQUAL(x.length(), y.length()); + CHECK_EQUAL(x.release(), y.release()); } - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 2 : 0), f); + FAIL_RETURN_IF_NOT(f.expect(bounded_ ? 2 : 0), f); + return 0; } - void test_index_accessor() + int test_index_accessor() { tested_sequence x; x.length(8); tested_sequence const & y = x; character_type const * t = y[4]; - BOOST_CHECK_MESSAGE(helper::compare_empty(t), + FAIL_RETURN_IF_NOT(helper::compare_empty(t), "Unexpected string value " << t); + return 0; } - void test_index_modifier() + int test_index_modifier() { tested_sequence x; x.length(8); @@ -180,16 +181,17 @@ struct string_sequence_tester character_type const * t = y[4]; - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(text, x[4]) == 0, + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(text, x[4]) == 0, "Mismatched values expected=" << text << ", got=" << x[4]); - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(text, y[4]) == 0, + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(text, y[4]) == 0, "Mismatched values expected=" << text << ", got=" << y[4]); - BOOST_CHECK(text != t); + CHECK(text != t); + return 0; } - void test_index_checking() + int test_index_checking() { tested_sequence x; x.length(8); @@ -197,11 +199,12 @@ struct string_sequence_tester tested_sequence const & y = x; character_type const * lhs = 0; character_type const * rhs = 0; - BOOST_CHECK_THROW(lhs = y[32], std::range_error); - BOOST_CHECK_THROW(x[32] = rhs, std::range_error); + CHECK_THROW(lhs = y[32], std::range_error); + CHECK_THROW(x[32] = rhs, std::range_error); + return 0; } - void test_copy_constructor_values() + int test_copy_constructor_values() { tested_sequence a; a.length(16); @@ -216,22 +219,23 @@ struct string_sequence_tester CORBA::ULong max; { tested_sequence b(a); - BOOST_CHECK_MESSAGE(d.expect(16), d); + FAIL_RETURN_IF_NOT(d.expect(16), d); max = b.maximum(); - BOOST_CHECK_EQUAL(a.length(), b.length()); + CHECK_EQUAL(a.length(), b.length()); for(CORBA::ULong i = 0; i != a.length(); ++i) { - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(a[i], b[i]) == 0, + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(a[i], b[i]) == 0, "Mismatched elements at index=" << i << ", a=" << a[i] << ", b=" << b[i]); } } - BOOST_CHECK_MESSAGE(r.expect(max), r); + FAIL_RETURN_IF_NOT(r.expect(max), r); + return 0; } - void test_freebuf_releases_elements() + int test_freebuf_releases_elements() { value_type * buffer = tested_sequence::allocbuf(32); for(int i = 0; i != 32; ++i) @@ -244,38 +248,40 @@ struct string_sequence_tester tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(32), r); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(32), r); + return 0; } - void test_assignment_from_default() + int test_assignment_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_EQUAL( + FAIL_RETURN_IF_NOT(a.expect(0), a); + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_ , x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(bounded_ , x.release()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(bounded_ ? 1 : 0), a); - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 1 : 0), f); - BOOST_CHECK_EQUAL(x.maximum(), y.maximum()); - BOOST_CHECK_EQUAL(x.length(), y.length()); - BOOST_CHECK_EQUAL(x.release(), y.release()); + FAIL_RETURN_IF_NOT(a.expect(bounded_ ? 1 : 0), a); + FAIL_RETURN_IF_NOT(f.expect(bounded_ ? 1 : 0), f); + CHECK_EQUAL(x.maximum(), y.maximum()); + CHECK_EQUAL(x.length(), y.length()); + CHECK_EQUAL(x.release(), y.release()); } - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 2 : 0), f); + FAIL_RETURN_IF_NOT(f.expect(bounded_ ? 2 : 0), f); + return 0; } - void test_assignment_values() + int test_assignment_values() { tested_sequence a; a.length(16); @@ -290,24 +296,25 @@ struct string_sequence_tester { tested_sequence b; b = a; - BOOST_CHECK_MESSAGE(d.expect(16), d); + FAIL_RETURN_IF_NOT(d.expect(16), d); max = b.maximum(); - BOOST_CHECK_EQUAL(a.maximum(), b.maximum()); - BOOST_CHECK_EQUAL(a.length(), b.length()); - BOOST_CHECK_EQUAL(a.release(), b.release()); + CHECK_EQUAL(a.maximum(), b.maximum()); + CHECK_EQUAL(a.length(), b.length()); + CHECK_EQUAL(a.release(), b.release()); for(CORBA::ULong i = 0; i != a.length(); ++i) { - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(a[i], b[i]) == 0, + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(a[i], b[i]) == 0, "Mismatched elements at index " << i); } r.reset(); } - BOOST_CHECK_MESSAGE(r.expect(max), r); + FAIL_RETURN_IF_NOT(r.expect(max), r); + return 0; } - void test_exception_in_copy_constructor() + int test_exception_in_copy_constructor() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -316,13 +323,14 @@ struct string_sequence_tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_assignment() + int test_exception_in_assignment() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -333,17 +341,18 @@ struct string_sequence_tester expected_calls a(tested_allocation_traits::allocbuf_calls); f.reset(); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(y = x, testing_exception); + CHECK_THROW(y = x, testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(3), y.length()); + CHECK_EQUAL(CORBA::ULong(3), y.length()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_duplicate_exception_in_copy_constructor() + int test_duplicate_exception_in_copy_constructor() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -361,16 +370,17 @@ struct string_sequence_tester tested_element_traits::duplicate_calls.failure_countdown(4); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(4), d); - BOOST_CHECK_MESSAGE(r.expect(x.maximum()), r); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(4), d); + FAIL_RETURN_IF_NOT(r.expect(x.maximum()), r); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_duplicate_exception_in_assignment() + int test_duplicate_exception_in_assignment() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -399,27 +409,28 @@ struct string_sequence_tester r.reset(); f.reset(); tested_element_traits::duplicate_calls.failure_countdown(4); - BOOST_CHECK_THROW(y = x, testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(4), d); - BOOST_CHECK_MESSAGE(r.expect(x.maximum()), r); + CHECK_THROW(y = x, testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(4), d); + FAIL_RETURN_IF_NOT(r.expect(x.maximum()), r); - BOOST_CHECK_EQUAL(CORBA::ULong(4), y.length()); + CHECK_EQUAL(CORBA::ULong(4), y.length()); for(CORBA::ULong i = 0; i != 4; ++i) { - BOOST_CHECK_MESSAGE( + FAIL_RETURN_IF_NOT( helper::compare_test_string(y[i]), "Mismatch in element " << i << ", got=" << y[i]); } } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_const() + int test_get_buffer_const() { tested_sequence a; a.length(8); tested_sequence const & b = a; @@ -427,79 +438,39 @@ struct string_sequence_tester const_value_type const * buffer = b.get_buffer(); a[0] = helper::test_string(); - BOOST_CHECK_EQUAL(buffer, b.get_buffer()); - BOOST_CHECK_MESSAGE(ACE_OS::strcmp(a[0], buffer[0]) == 0, + CHECK_EQUAL(buffer, b.get_buffer()); + FAIL_RETURN_IF_NOT(ACE_OS::strcmp(a[0], buffer[0]) == 0, "Mismatched elements a[0]=" << a[0] << ", buffer[0]=" << buffer[0]); + return 0; } - void add_all(boost::unit_test_framework::test_suite * ts) + int test_all () { - boost::shared_ptr<string_sequence_tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_default_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_index_accessor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_index_modifier, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_index_checking, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_copy_constructor_values, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_freebuf_releases_elements, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_assignment_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_assignment_values, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_exception_in_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_exception_in_assignment, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_duplicate_exception_in_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_duplicate_exception_in_assignment, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &string_sequence_tester::test_get_buffer_const, - shared_this)); - - - } - - static boost::shared_ptr<string_sequence_tester> allocate(bool bounded = false) - { - boost::shared_ptr<string_sequence_tester> ptr( - new string_sequence_tester(bounded)); - ptr->self_ = ptr; - - return ptr; + int status=0; + status += this->test_default_constructor(); + status += this->test_copy_constructor_from_default(); + status += this->test_index_accessor(); + status += this->test_index_modifier(); + status += this->test_index_checking(); + status += this->test_copy_constructor_values(); + status += this->test_freebuf_releases_elements(); + status += this->test_assignment_from_default(); + status += this->test_assignment_values(); + status += this->test_exception_in_copy_constructor(); + status += this->test_exception_in_assignment(); + status += this->test_duplicate_exception_in_copy_constructor(); + status += this->test_duplicate_exception_in_assignment(); + status += this->test_get_buffer_const(); + + return status; } - -private: string_sequence_tester(bool bounded) : bounded_(bounded) {} +private: bool bounded_; - - boost::weak_ptr<string_sequence_tester> self_; }; #endif // guard_string_sequence_tester_hpp diff --git a/TAO/tests/Sequence_Unit_Tests/string_ut.cpp b/TAO/tests/Sequence_Unit_Tests/string_ut.cpp index 5ff67e39e0d..3dac99b2e4c 100644 --- a/TAO/tests/Sequence_Unit_Tests/string_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/string_ut.cpp @@ -12,13 +12,7 @@ #include "ace/OS_NS_string.h" -#include <sstream> -#include <stdexcept> -#include <iostream> - -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" using namespace TAO::details; diff --git a/TAO/tests/Sequence_Unit_Tests/test_macros.h b/TAO/tests/Sequence_Unit_Tests/test_macros.h new file mode 100644 index 00000000000..2db80f1410f --- /dev/null +++ b/TAO/tests/Sequence_Unit_Tests/test_macros.h @@ -0,0 +1,43 @@ +// $Id$ + +#include "ace/Log_Msg.h" + +#define FAIL_RETURN_IF(CONDITION) \ + if (CONDITION) \ + { \ + ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +#define FAIL_RETURN_IF_NOT(CONDITION, X) \ + if (!(CONDITION)) \ + { \ + ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } +#define CHECK_EQUAL(X, Y) \ + if ((X) != (Y)) \ + { \ + ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } +#define CHECK(X) \ + if (!(X)) \ + { \ + ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +#define CHECK_THROW(X, Y) \ + try { \ + X; \ + } \ + catch (Y const &) \ + { \ + } \ + catch (...) \ + { \ + return 1; \ + } \ + + diff --git a/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp b/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp index de4426c4f16..190768bb70e 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp @@ -8,18 +8,15 @@ * @author Carlos O'Ryan */ #include "testing_allocation_traits.hpp" - -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" #define CHECK_NO_THROW(statement) \ try { statement; } catch(...) { \ - BOOST_ERROR("unexpected exception raised"); } + return 1; } using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO::details; -using namespace boost::unit_test_framework; + CORBA::ULong const MAXIMUM = 32; @@ -30,7 +27,7 @@ struct Tester typedef bounded_value_allocation_traits<value_type,MAXIMUM,true> bounded; template<class aspect> - void test_allocbuf() + int test_allocbuf() { expected_calls c(aspect::allocbuf_calls); @@ -38,15 +35,16 @@ struct Tester value_type * s = 0; CHECK_NO_THROW(s = aspect::allocbuf(4)); aspect::freebuf(s); - BOOST_CHECK_THROW(s = aspect::allocbuf(4), testing_exception); + CHECK_THROW(s = aspect::allocbuf(4), testing_exception); CHECK_NO_THROW(s = aspect::allocbuf(4)); aspect::freebuf(s); - BOOST_CHECK_MESSAGE(c.expect(3), c); + FAIL_RETURN_IF_NOT(c.expect(3), c); + return 0; } template<class aspect> - void test_freebuf() + int test_freebuf() { expected_calls c(aspect::freebuf_calls); @@ -54,34 +52,36 @@ struct Tester value_type * s = aspect::allocbuf(4); CHECK_NO_THROW(aspect::freebuf(s)); s = aspect::allocbuf(4); - BOOST_CHECK_THROW(aspect::freebuf(s), testing_exception); + CHECK_THROW(aspect::freebuf(s), testing_exception); aspect::freebuf(s); s = aspect::allocbuf(4); CHECK_NO_THROW(aspect::freebuf(s)); - BOOST_CHECK_MESSAGE(c.expect(4), c); + FAIL_RETURN_IF_NOT(c.expect(4), c); + return 0; } - void test_default_buffer_allocation_value() + int test_default_buffer_allocation_value() { expected_calls u(unbounded::default_buffer_allocation_calls); expected_calls b(bounded::default_buffer_allocation_calls); value_type * s = unbounded::default_buffer_allocation(); - BOOST_CHECK_MESSAGE(u.expect(1), u); - BOOST_CHECK_MESSAGE(b.expect(0), b); - BOOST_CHECK_EQUAL(static_cast<value_type*>(0), s); + FAIL_RETURN_IF_NOT(u.expect(1), u); + FAIL_RETURN_IF_NOT(b.expect(0), b); + CHECK_EQUAL(static_cast<value_type*>(0), s); bounded::freebuf(s); s = bounded::default_buffer_allocation(); - BOOST_CHECK_MESSAGE(u.expect(0), u); - BOOST_CHECK_MESSAGE(b.expect(1), b); - BOOST_CHECK(static_cast<value_type*>(0) != s); + FAIL_RETURN_IF_NOT(u.expect(0), u); + FAIL_RETURN_IF_NOT(b.expect(1), b); + CHECK(static_cast<value_type*>(0) != s); bounded::freebuf(s); + return 0; } template<class aspect> - void test_default_buffer_allocation() + int test_default_buffer_allocation() { expected_calls c(aspect::default_buffer_allocation_calls); @@ -90,112 +90,81 @@ struct Tester CHECK_NO_THROW( s = aspect::default_buffer_allocation()); aspect::freebuf(s); - BOOST_CHECK_THROW( + CHECK_THROW( s = aspect::default_buffer_allocation(), testing_exception); CHECK_NO_THROW( s = aspect::default_buffer_allocation()); aspect::freebuf(s); - BOOST_CHECK_MESSAGE(c.expect(3), c); + FAIL_RETURN_IF_NOT(c.expect(3), c); + return 0; } - void test_default_buffer_allocation_unbounded() + int test_default_buffer_allocation_unbounded() { - test_default_buffer_allocation<unbounded>(); + return test_default_buffer_allocation<unbounded>(); } - void test_default_buffer_allocation_bounded() + int test_default_buffer_allocation_bounded() { - test_default_buffer_allocation<bounded>(); + return test_default_buffer_allocation<bounded>(); } - void test_allocbuf_unbounded() + int test_allocbuf_unbounded() { - test_allocbuf<unbounded>(); + return test_allocbuf<unbounded>(); } - void test_allocbuf_bounded() + int test_allocbuf_bounded() { - test_allocbuf<bounded>(); + return test_allocbuf<bounded>(); } - void test_freebuf_unbounded() + int test_freebuf_unbounded() { - test_freebuf<unbounded>(); + return test_freebuf<unbounded>(); } - void test_freebuf_bounded() + int test_freebuf_bounded() { - test_freebuf<bounded>(); + return test_freebuf<bounded>(); } - void add_all(test_suite * ts) + int test_all() { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_value, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_buffer_allocation_bounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_allocbuf_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_allocbuf_bounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_freebuf_unbounded, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_freebuf_bounded, - shared_this)); + int status = 0; + status += this->test_default_buffer_allocation_value(); + status += this->test_default_buffer_allocation_unbounded(); + status += this->test_default_buffer_allocation_bounded(); + status += this->test_allocbuf_unbounded(); + status += this->test_allocbuf_bounded(); + status += this->test_freebuf_unbounded(); + status += this->test_freebuf_bounded(); + return status; } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; struct Foo { int y; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("testing allocation traits unit test"); - + int status = 0; { - boost::shared_ptr<Tester<int> > tester( - Tester<int>::allocate()); - tester->add_all(ts); + Tester<int> tester; + status += tester.test_all (); } { - boost::shared_ptr<Tester<Foo> > tester( - Tester<Foo>::allocate()); - tester->add_all(ts); + Tester<Foo> tester; + status += tester.test_all (); } { - boost::shared_ptr<Tester<char*> > tester( - Tester<char*>::allocate()); - tester->add_all(ts); + Tester<char*> tester; + status += tester.test_all (); } - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp b/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp index e5f20bb8ee1..399c8118455 100644 --- a/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp +++ b/TAO/tests/Sequence_Unit_Tests/testing_counters.hpp @@ -13,8 +13,7 @@ */ #include "testing_exception.hpp" - -#include <boost/utility.hpp> +#include "ace/Copy_Disabled.h" #include <iostream> @@ -59,7 +58,7 @@ private: * number of times. */ class expected_calls - : private boost::noncopyable + : private ACE_Copy_Disabled { public: inline expected_calls(call_counter const & counter) diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp index 9648158918a..6f988b979d8 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_array_sequence_ut.cpp @@ -14,64 +14,37 @@ #include "tao/Unbounded_Array_Sequence_T.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -using namespace boost::unit_test_framework; -using namespace TAO; - -struct Tester -{ - typedef unbounded_array_sequence<my_array, my_array_slice, my_array_tag> tested_sequence; - typedef tested_sequence::value_type value_type; - typedef tested_sequence::const_value_type const_value_type; - - typedef tested_sequence::element_traits tested_element_traits; - typedef tested_sequence::allocation_traits tested_allocation_traits; - typedef TAO::details::range_checking<value_type,true> range; - - void test_default_constructor() +#define FAIL_RETURN_IF(CONDITION) \ + if (CONDITION) \ + { \ + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("\tFailed at %N:%l\n"))); \ + return 1; \ + } + +typedef unbounded_array_sequence<my_array, my_array_slice, my_array_tag> tested_sequence; +typedef tested_sequence::value_type value_type; +typedef tested_sequence::const_value_type const_value_type; + +typedef tested_sequence::element_traits tested_element_traits; +typedef tested_sequence::allocation_traits tested_allocation_traits; +typedef TAO::details::range_checking<value_type,true> range; + +int test_default_constructor() { { tested_sequence x; - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF(CORBA::ULong(0), x.maximum()); + FAIL_RETURN_IF(CORBA::ULong(0), x.length()); + FAIL_RETURN_IF(true, x.release()); } } - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_constructor, - shared_this)); - } - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; -}; - -test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded array sequence unit test"); + int status = 0; - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + status += test_default_constructor (); - return ts; + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp index 0116dd37dcb..2ac57d827af 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_fwd_object_reference_sequence_ut.cpp @@ -16,11 +16,9 @@ #include "tao/Unbounded_Object_Reference_Sequence_T.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; struct Tester @@ -33,7 +31,7 @@ struct Tester typedef tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -41,46 +39,22 @@ struct Tester { tested_sequence x; - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(false, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(false, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); - } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_constructor, - shared_this)); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); - - return ts; + int status = 0; + Tester x; + status += x.test_default_constructor (); + + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp index 263576143d9..c54fd4c5f75 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_object_reference_sequence_ut.cpp @@ -16,11 +16,9 @@ #include "tao/Unbounded_Object_Reference_Sequence_T.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; struct Tester @@ -33,7 +31,7 @@ struct Tester typedef tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -41,16 +39,17 @@ struct Tester { tested_sequence x; - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(false, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(false, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -58,30 +57,32 @@ struct Tester { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_ulong_constructor_throw() + int test_ulong_constructor_throw() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); + CHECK_THROW(tested_sequence x(16), testing_exception); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_buffer_constructor_release_true() + int test_buffer_constructor_release_true() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -92,17 +93,18 @@ struct Tester a.reset(); tested_sequence x(maximum, maximum / 2, data, true); - BOOST_CHECK_EQUAL(x.maximum(), maximum); - BOOST_CHECK_EQUAL(x.length(), maximum / 2); - BOOST_CHECK_EQUAL(x.get_buffer(), data); - BOOST_CHECK_EQUAL(x.release(), true); + CHECK_EQUAL(x.maximum(), maximum); + CHECK_EQUAL(x.length(), maximum / 2); + CHECK_EQUAL(x.get_buffer(), data); + CHECK_EQUAL(x.release(), true); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_buffer_constructor_release_false() + int test_buffer_constructor_release_false() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -114,23 +116,24 @@ struct Tester { tested_sequence x(maximum, maximum / 2, data, false); - BOOST_CHECK_EQUAL(x.maximum(), maximum); - BOOST_CHECK_EQUAL(x.length(), maximum / 2); - BOOST_CHECK_EQUAL(x.get_buffer(), data); - BOOST_CHECK_EQUAL(x.release(), false); + CHECK_EQUAL(x.maximum(), maximum); + CHECK_EQUAL(x.length(), maximum / 2); + CHECK_EQUAL(x.get_buffer(), data); + CHECK_EQUAL(x.release(), false); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); tested_sequence::freebuf(data); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor_from_default() + int test_copy_constructor_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -140,12 +143,13 @@ struct Tester tested_sequence y(x); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor() + int test_copy_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -156,11 +160,11 @@ struct Tester { tested_sequence x(l); x.length(l); - BOOST_CHECK_MESSAGE(i.expect(l), i); + FAIL_RETURN_IF_NOT(i.expect(l), i); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); for(CORBA::ULong i = 0; i != l; ++i) { x[i] = mock_reference::allocate(i); @@ -169,23 +173,24 @@ struct Tester d.reset(); r.reset(); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); - BOOST_CHECK_MESSAGE(d.expect(l), d); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(d.expect(l), d); for(CORBA::ULong i = 0; i != l; ++i) { - BOOST_CHECK_EQUAL(int(i), y[i]->id()); + CHECK_EQUAL(int(i), y[i]->id()); } } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(2*l), r); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(2), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(2*l), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(2), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor_throw_duplicate() + int test_copy_constructor_throw_duplicate() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -197,11 +202,11 @@ struct Tester tested_sequence x(l); x.length(l); - BOOST_CHECK_MESSAGE(i.expect(l), i); + FAIL_RETURN_IF_NOT(i.expect(l), i); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(l, x.length()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(l, x.length()); for(CORBA::ULong i = 0; i != l; ++i) { x[i] = mock_reference::allocate(i); @@ -210,20 +215,21 @@ struct Tester d.reset(); r.reset(); mock_reference::duplicate_calls.failure_countdown(8); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(8), d); - BOOST_CHECK_MESSAGE(r.expect(l), r); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(8), d); + FAIL_RETURN_IF_NOT(r.expect(l), r); } - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(l), r); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(l), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -232,116 +238,120 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + FAIL_RETURN_IF_NOT(i.expect(8), i); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(32), i); + FAIL_RETURN_IF_NOT(i.expect(32), i); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_copy_elements() + int test_set_length_copy_elements() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.length()); - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), a); - BOOST_CHECK_MESSAGE(i.expect(16), i); + CHECK_EQUAL(CORBA::ULong(16), x.length()); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), a); + FAIL_RETURN_IF_NOT(i.expect(16), i); for(int j = 0; j != 16; ++j) { - BOOST_CHECK_EQUAL(mock_reference::_nil(), x[j]); + CHECK_EQUAL(mock_reference::_nil(), x[j]); x[j] = mock_reference::allocate(j); } x.length(32); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(16), i); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(16), i); tested_sequence const & y = x; for(CORBA::ULong i = 0; i != 16UL; ++i) { - BOOST_REQUIRE(mock_reference::_nil() != y[i]); - BOOST_CHECK_EQUAL(int(i), y[i]->id()); + CHECK(mock_reference::_nil() != y[i]); + CHECK_EQUAL(int(i), y[i]->id()); } for(CORBA::ULong i = 16; i != 32UL; ++i) { - BOOST_CHECK_EQUAL(mock_reference::_nil(), y[i]); + CHECK_EQUAL(mock_reference::_nil(), y[i]); } } - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_set_length_throw() + int test_set_length_throw() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(16); - BOOST_CHECK_MESSAGE(i.expect(16), i); + FAIL_RETURN_IF_NOT(i.expect(16), i); for(int j = 0; j != 16; ++j) { - BOOST_CHECK_EQUAL(mock_reference::_nil(), x[j]); + CHECK_EQUAL(mock_reference::_nil(), x[j]); x[j] = mock_reference::allocate(j); } tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(x.length(32), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.length()); - BOOST_CHECK_MESSAGE(i.expect(0), i); + CHECK_THROW(x.length(32), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(CORBA::ULong(16), x.length()); + FAIL_RETURN_IF_NOT(i.expect(0), i); tested_sequence const & y = x; for(int j = 0; j != 16; ++j) { - BOOST_REQUIRE(mock_reference::_nil() != y[j]); - BOOST_CHECK_EQUAL(j, y[j]->id()); + CHECK(mock_reference::_nil() != y[j]); + CHECK_EQUAL(j, y[j]->id()); } } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } value_type * alloc_and_init_buffer() @@ -355,15 +365,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK_EQUAL( 1, a[0]->id()); - BOOST_CHECK_EQUAL( 4, a[1]->id()); - BOOST_CHECK_EQUAL( 9, a[2]->id()); - BOOST_CHECK_EQUAL(16, a[3]->id()); + CHECK_EQUAL( 1, a[0]->id()); + CHECK_EQUAL( 4, a[1]->id()); + CHECK_EQUAL( 9, a[2]->id()); + CHECK_EQUAL(16, a[3]->id()); + return 0; } - void test_replace_release_true() + int test_replace_release_true() { value_type * buffer = alloc_and_init_buffer(); @@ -373,23 +384,24 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_release_false() + int test_replace_release_false() { value_type * buffer = alloc_and_init_buffer(); @@ -399,23 +411,24 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), 0); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), 0); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_release_default() + int test_replace_release_default() { value_type * buffer = alloc_and_init_buffer(); @@ -425,95 +438,55 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), 0); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), 0); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void add_all(test_suite * ts) + int test_all() { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_default_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor_throw, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_throw_duplicate, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_copy_elements, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_throw, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_release_default, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + int status = 0; + status += this->test_default_constructor(); + status += this->test_ulong_constructor(); + status += this->test_ulong_constructor_throw(); + status += this->test_buffer_constructor_release_true(); + status += this->test_buffer_constructor_release_false(); + status += this->test_copy_constructor_from_default(); + status += this->test_copy_constructor(); + status += this->test_copy_constructor_throw_duplicate(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_set_length_copy_elements(); + status += this->test_set_length_throw(); + status += this->test_replace_release_true(); + status += this->test_replace_release_false(); + status += this->test_replace_release_default(); + return status; } -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + int status = 0; + { + Tester tester; + status += tester.test_all(); + } - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp index 56162ac842a..3f0ec8063af 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_nocopy_ut.cpp @@ -15,16 +15,14 @@ #include "value_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" #include "tao/Basic_Types.h" #include "tao/CDR.h" #include "ace/OS_NS_stdio.h" -using namespace boost::unit_test_framework; + using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; typedef unbounded_value_sequence<CORBA::Octet> tested_sequence; @@ -36,81 +34,85 @@ struct Tester { typedef tested_sequence::value_type value_type; - void test_copy_constructor_from_ulong() + int test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_assignment_from_ulong() + int test_assignment_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); x.length(8); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_ulong_constructor() + int test_exception_in_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence x(16), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -118,34 +120,36 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_set_length() + int test_exception_in_set_length() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -153,10 +157,11 @@ struct Tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(x.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(x.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } value_type * alloc_and_init_buffer() @@ -178,7 +183,7 @@ struct Tester return mb; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); @@ -186,62 +191,65 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -250,24 +258,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -276,24 +285,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -302,187 +312,137 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, true); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(0UL, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(0UL, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); tested_sequence::freebuf(buffer); + return 0; } - void test_no_copy_octet() + int test_no_copy_octet() { #if (TAO_NO_COPY_OCTET_SEQUENCES == 1) ACE_Message_Block * mb = alloc_and_init_mb(); tested_sequence a (8, mb); - BOOST_CHECK_EQUAL(CORBA::Octet( 't'), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 'g'), a[6]); + CHECK_EQUAL(CORBA::Octet( 't'), a[0]); + CHECK_EQUAL(CORBA::Octet( 'g'), a[6]); char upperbuf[256]; ACE_OS::sprintf (upperbuf, "%s", "THIS IS A TEST"); size_t n = (ACE_OS::strlen (upperbuf) + 1) * sizeof (char); ACE_Message_Block * upper_mb = 0; - ACE_NEW (upper_mb, - ACE_Message_Block (n)); + ACE_NEW_RETURN (upper_mb, + ACE_Message_Block (n), 1); // Copy buf into the Message_Block and update the wr_ptr (). upper_mb->copy ((char *) upperbuf, n); a.replace (n, upper_mb); - BOOST_CHECK_EQUAL(CORBA::Octet( 'T'), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 'S'), a[6]); + CHECK_EQUAL(CORBA::Octet( 'T'), a[0]); + CHECK_EQUAL(CORBA::Octet( 'S'), a[6]); #endif + return 0; } - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_no_copy_octet, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_set_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - - } - - static boost::shared_ptr<Tester> allocate() + int test_all() { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + int status = 0; + status += this->test_no_copy_octet(); + status += this->test_ulong_constructor(); + status += this->test_copy_constructor_from_ulong(); + status += this->test_assignment_from_ulong(); + status += this->test_exception_in_ulong_constructor(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_exception_in_set_length(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded no copy octet sequence unit test"); - + int status = 0; { - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + Tester tester; + status += tester.test_all(); } { typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate()); - tester->add_all(ts); + common tester (false); + status += tester.test_all (); } - return ts; + return status; } + + diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp index b43d978fbda..fa1d36ff127 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_octet_sequence_ut.cpp @@ -15,15 +15,13 @@ #include "value_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" #include "tao/Basic_Types.h" #include "tao/CDR.h" using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; -using namespace boost::unit_test_framework; + typedef unbounded_value_sequence<CORBA::Octet> tested_sequence; typedef tested_sequence::element_traits tested_element_traits; @@ -34,81 +32,85 @@ struct Tester { typedef tested_sequence::value_type value_type; - void test_copy_constructor_from_ulong() + int test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_assignment_from_ulong() + int test_assignment_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); x.length(8); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_ulong_constructor() + int test_exception_in_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence x(16), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -116,34 +118,36 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_set_length() + int test_exception_in_set_length() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -151,10 +155,11 @@ struct Tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(x.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(x.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } value_type * alloc_and_init_buffer() @@ -165,7 +170,7 @@ struct Tester return buf; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); @@ -173,62 +178,65 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -237,24 +245,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -263,24 +272,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -289,162 +299,112 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, true); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(CORBA::Octet( 1), a[0]); - BOOST_CHECK_EQUAL(CORBA::Octet( 4), a[1]); - BOOST_CHECK_EQUAL(CORBA::Octet( 9), a[2]); - BOOST_CHECK_EQUAL(CORBA::Octet(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(CORBA::Octet( 1), a[0]); + CHECK_EQUAL(CORBA::Octet( 4), a[1]); + CHECK_EQUAL(CORBA::Octet( 9), a[2]); + CHECK_EQUAL(CORBA::Octet(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(0UL, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(0UL, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); tested_sequence::freebuf(buffer); + return 0; } - void add_all(test_suite * ts) + int test_all() { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_set_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - + int status = 0; + + status += this->test_ulong_constructor(); + status += this->test_copy_constructor_from_ulong(); + status += this->test_assignment_from_ulong(); + status += this->test_exception_in_ulong_constructor(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_exception_in_set_length(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -using namespace boost::unit_test_framework; - -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded octet sequence unit test"); - + int status = 0; { - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); + Tester tester; + status += tester.test_all (); } { typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate()); - tester->add_all(ts); + common tester (false); + status += tester.test_all (); } - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp index 99043e4bd97..abeb7ac9452 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_sequence_cdr_ut.cpp @@ -22,11 +22,9 @@ #include "tao/Unbounded_Sequence_CDR_T.h" #include "tao/CDR.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; typedef unbounded_object_reference_sequence<mock_reference, mock_reference_var> tested_sequence; @@ -61,15 +59,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK_EQUAL( 1, a[0]->id()); - BOOST_CHECK_EQUAL( 4, a[1]->id()); - BOOST_CHECK_EQUAL( 9, a[2]->id()); - BOOST_CHECK_EQUAL(16, a[3]->id()); + CHECK_EQUAL( 1, a[0]->id()); + CHECK_EQUAL( 4, a[1]->id()); + CHECK_EQUAL( 9, a[2]->id()); + CHECK_EQUAL(16, a[3]->id()); + return 0; } - void test_stream() + int test_stream() { value_type * buffer = alloc_and_init_buffer(); @@ -78,50 +77,26 @@ struct Tester tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); TAO_OutputCDR stream; stream << a; - BOOST_CHECK_MESSAGE(s.expect(4), s); + FAIL_RETURN_IF_NOT(s.expect(4), s); } tested_sequence::freebuf(buffer); + return 0; } - - void add_all(test_suite * ts) - { - boost::shared_ptr<Tester> shared_this(self_); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_stream, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: - Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded object reference sequence unit test"); - - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); - - return ts; + int status = 0; + Tester x; + status += x.test_stream (); + + return status; } - diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp index 0293fb0a4f0..58f9b30fa8a 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp @@ -17,11 +17,9 @@ #include "string_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; template<class tested_sequence> @@ -36,7 +34,7 @@ struct Tester typedef typename tested_sequence::allocation_traits tested_allocation_traits; typedef TAO::details::range_checking<value_type,true> range; - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -44,16 +42,17 @@ struct Tester { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_copy_constructor_from_ulong() + int test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -61,29 +60,30 @@ struct Tester expected_calls d(tested_element_traits::duplicate_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + FAIL_RETURN_IF_NOT(i.expect(8), i); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); - BOOST_CHECK_MESSAGE(d.expect(8), d); + FAIL_RETURN_IF_NOT(d.expect(8), d); } - BOOST_CHECK_MESSAGE(f.expect(2), f); - BOOST_CHECK_MESSAGE(i.expect(0), i); + FAIL_RETURN_IF_NOT(f.expect(2), f); + FAIL_RETURN_IF_NOT(i.expect(0), i); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -92,51 +92,54 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); - BOOST_CHECK_MESSAGE(i.expect(8), i); + FAIL_RETURN_IF_NOT(i.expect(8), i); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls i(tested_element_traits::default_initializer_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_MESSAGE(i.expect(32), i); + FAIL_RETURN_IF_NOT(i.expect(32), i); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_ulong_constructor() + int test_exception_in_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence x(16), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_exception_in_length() + int test_exception_in_length() { expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -154,25 +157,26 @@ struct Tester r.reset(); f.reset(); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(y.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(d.expect(0), d); - BOOST_CHECK_MESSAGE(r.expect(0), r); + CHECK_THROW(y.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(d.expect(0), d); + FAIL_RETURN_IF_NOT(r.expect(0), r); - BOOST_CHECK_EQUAL(CORBA::ULong(4), y.length()); + CHECK_EQUAL(CORBA::ULong(4), y.length()); for(CORBA::ULong i = 0; i != 4; ++i) { - BOOST_CHECK_MESSAGE( + FAIL_RETURN_IF_NOT( helper::compare_test_string(y[i]), "Mismatch in element " << i << ", got=" << y[i]); } } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_duplicate_exception_in_length() + int test_duplicate_exception_in_length() { expected_calls f(tested_allocation_traits::freebuf_calls); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -190,22 +194,23 @@ struct Tester r.reset(); f.reset(); tested_element_traits::duplicate_calls.failure_countdown(3); - BOOST_CHECK_THROW(y.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(d.expect(3), d); - BOOST_CHECK_MESSAGE(r.expect(8), r); + CHECK_THROW(y.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(d.expect(3), d); + FAIL_RETURN_IF_NOT(r.expect(8), r); - BOOST_CHECK_EQUAL(CORBA::ULong(4), y.length()); + CHECK_EQUAL(CORBA::ULong(4), y.length()); for(CORBA::ULong i = 0; i != 4; ++i) { - BOOST_CHECK_MESSAGE( + FAIL_RETURN_IF_NOT( helper::compare_test_string(y[i]), "Mismatch in element " << i << ", got=" << y[i]); } } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } value_type * alloc_and_init_buffer() @@ -219,15 +224,16 @@ struct Tester return buf; } - void check_values(tested_sequence const & a) + int check_values(tested_sequence const & a) { - BOOST_CHECK(helper::compare(1, a[0])); - BOOST_CHECK(helper::compare(4, a[1])); - BOOST_CHECK(helper::compare(9, a[2])); - BOOST_CHECK(helper::compare(16, a[3])); + CHECK(helper::compare(1, a[0])); + CHECK(helper::compare(4, a[1])); + CHECK(helper::compare(9, a[2])); + CHECK(helper::compare(16, a[3])); + return 0; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -235,19 +241,20 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -255,19 +262,20 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -275,18 +283,19 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(true, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -296,23 +305,24 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), 0); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), 0); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); @@ -322,23 +332,24 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), 0); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), 0); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); @@ -348,45 +359,49 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_MESSAGE(r.expect(0), r); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + FAIL_RETURN_IF_NOT(r.expect(0), r); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -394,25 +409,26 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(0UL, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(0UL, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void test_regression_2201() + int test_regression_2201() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); @@ -420,123 +436,70 @@ struct Tester expected_calls r(tested_element_traits::release_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(false, a.release()); check_values(a); a.length (3); - BOOST_CHECK_EQUAL(CORBA::ULong(3), a.length()); + CHECK_EQUAL(CORBA::ULong(3), a.length()); a.length (4); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK(helper::compare_empty(a[3])); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK(helper::compare_empty(a[3])); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); - BOOST_CHECK_MESSAGE(r.expect(8), r); + FAIL_RETURN_IF_NOT(r.expect(8), r); + return 0; } - void add_all(test_suite * ts) + int test_all() { + int status = 0; typedef string_sequence_tester<tested_sequence> common; - boost::shared_ptr<common> tester(common::allocate()); - tester->add_all(ts); - - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_length, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_duplicate_exception_in_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_regression_2201, - shared_this)); - } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; + common tester (false); + status += tester.test_all (); + + status += this->test_ulong_constructor(); + status += this->test_copy_constructor_from_ulong(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_exception_in_ulong_constructor(); + status += this->test_exception_in_length(); + status += this->test_duplicate_exception_in_length(); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_default(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + status += this->test_regression_2201(); + return status; } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded string sequence unit test"); - + int status = 0; { typedef Tester<unbounded_basic_string_sequence <char> > nTester; - boost::shared_ptr<nTester> tester(nTester::allocate()); - tester->add_all(ts); + nTester ntester; + status += ntester.test_all (); } { typedef Tester<unbounded_basic_string_sequence <CORBA::WChar> > wTester; - boost::shared_ptr<wTester> tester(wTester::allocate()); - tester->add_all(ts); + wTester wtester; + status += wtester.test_all (); } - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp b/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp index 2c42548cd69..9d209b828e3 100644 --- a/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp +++ b/TAO/tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp @@ -15,11 +15,9 @@ #include "value_sequence_tester.hpp" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" + -using namespace boost::unit_test_framework; using namespace TAO_VERSIONED_NAMESPACE_NAME::TAO; typedef unbounded_value_sequence<int> tested_sequence; @@ -31,81 +29,85 @@ struct Tester { typedef tested_sequence::value_type value_type; - void test_copy_constructor_from_ulong() + int test_copy_constructor_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_assignment_from_ulong() + int test_assignment_from_ulong() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); x.length(8); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(16), y.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), y.length()); - BOOST_CHECK_EQUAL(true, y.release()); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); + CHECK_EQUAL(CORBA::ULong(16), y.maximum()); + CHECK_EQUAL(CORBA::ULong(8), y.length()); + CHECK_EQUAL(true, y.release()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_ulong_constructor() + int test_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_ulong_constructor() + int test_exception_in_ulong_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence x(16), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence x(16), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } - void test_set_length_less_than_maximum() + int test_set_length_less_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); @@ -113,34 +115,36 @@ struct Tester tested_sequence x(16); x.length(8); - BOOST_CHECK_EQUAL(CORBA::ULong(16), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(8), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(16), x.maximum()); + CHECK_EQUAL(CORBA::ULong(8), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_set_length_more_than_maximum() + int test_set_length_more_than_maximum() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x(16); - BOOST_CHECK_MESSAGE(a.expect(1), a); + FAIL_RETURN_IF_NOT(a.expect(1), a); x.length(32); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(32), x.length()); - BOOST_CHECK_EQUAL(true, x.release()); + CHECK_EQUAL(CORBA::ULong(32), x.maximum()); + CHECK_EQUAL(CORBA::ULong(32), x.length()); + CHECK_EQUAL(true, x.release()); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_set_length() + int test_exception_in_set_length() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -148,10 +152,11 @@ struct Tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(x.length(8), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(x.length(8), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(f.expect(0), f); + return 0; } value_type * alloc_and_init_buffer() @@ -162,7 +167,7 @@ struct Tester return buf; } - void test_regression_2201 () + int test_regression_2201 () { value_type * buffer = alloc_and_init_buffer(); @@ -170,26 +175,27 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); a.length (3); - BOOST_CHECK_EQUAL(CORBA::ULong(3), a.length()); + CHECK_EQUAL(CORBA::ULong(3), a.length()); a.length (4); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(int(0), a[3]); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(int(0), a[3]); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_default() + int test_buffer_constructor_default() { value_type * buffer = alloc_and_init_buffer(); @@ -197,62 +203,65 @@ struct Tester expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_false() + int test_buffer_constructor_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, false); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_buffer_constructor_true() + int test_buffer_constructor_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_replace_default() + int test_replace_default() { value_type * buffer = alloc_and_init_buffer(); @@ -261,24 +270,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_false() + int test_replace_false() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -287,24 +297,25 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, false); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(false, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(false, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); tested_sequence::freebuf(buffer); + return 0; } - void test_replace_true() + int test_replace_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); @@ -313,165 +324,108 @@ struct Tester { tested_sequence a; a.replace(8, 4, buffer, true); - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(0), f); - - BOOST_CHECK_EQUAL(CORBA::ULong(8), a.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(4), a.length()); - BOOST_CHECK_EQUAL(buffer, a.get_buffer()); - BOOST_CHECK_EQUAL(int( 1), a[0]); - BOOST_CHECK_EQUAL(int( 4), a[1]); - BOOST_CHECK_EQUAL(int( 9), a[2]); - BOOST_CHECK_EQUAL(int(16), a[3]); - BOOST_CHECK_EQUAL(true, a.release()); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(0), f); + + CHECK_EQUAL(CORBA::ULong(8), a.maximum()); + CHECK_EQUAL(CORBA::ULong(4), a.length()); + CHECK_EQUAL(buffer, a.get_buffer()); + CHECK_EQUAL(int( 1), a[0]); + CHECK_EQUAL(int( 4), a[1]); + CHECK_EQUAL(int( 9), a[2]); + CHECK_EQUAL(int(16), a[3]); + CHECK_EQUAL(true, a.release()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_get_buffer_default() + int test_get_buffer_default() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_false() + int test_get_buffer_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(a.get_buffer(), buffer); + CHECK_EQUAL(a.get_buffer(), buffer); + return 0; } - void test_get_buffer_true_with_release_false() + int test_get_buffer_true_with_release_false() { value_type * buffer = alloc_and_init_buffer(); tested_sequence a(8, 4, buffer, false); - BOOST_CHECK(0 == a.get_buffer(true)); + CHECK(0 == a.get_buffer(true)); tested_sequence::freebuf(buffer); + return 0; } - void test_get_buffer_true_with_release_true() + int test_get_buffer_true_with_release_true() { value_type * buffer = alloc_and_init_buffer(); expected_calls c(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence a(8, 4, buffer, true); - BOOST_CHECK_EQUAL(buffer, a.get_buffer(true)); + CHECK_EQUAL(buffer, a.get_buffer(true)); tested_sequence const & b = a; - BOOST_CHECK_EQUAL(0UL, b.maximum()); - BOOST_CHECK_EQUAL(0UL, b.length()); - BOOST_CHECK(0 != b.get_buffer()); - BOOST_CHECK_EQUAL(true, b.release()); + CHECK_EQUAL(0UL, b.maximum()); + CHECK_EQUAL(0UL, b.length()); + CHECK(0 != b.get_buffer()); + CHECK_EQUAL(true, b.release()); - BOOST_CHECK_MESSAGE(c.expect(1), c); + FAIL_RETURN_IF_NOT(c.expect(1), c); - BOOST_CHECK(buffer != b.get_buffer()); + CHECK(buffer != b.get_buffer()); } - BOOST_CHECK_MESSAGE(c.expect(0), c); - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(c.expect(0), c); + FAIL_RETURN_IF_NOT(f.expect(1), f); tested_sequence::freebuf(buffer); + return 0; } - void add_all(test_suite * ts) + int test_all() { - boost::shared_ptr<Tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_copy_constructor_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_assignment_from_ulong, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_ulong_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_less_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_set_length_more_than_maximum, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_exception_in_set_length, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_regression_2201 , - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_buffer_constructor_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_replace_true, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_false, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &Tester::test_get_buffer_true_with_release_true, - shared_this)); - + int status = 0; + status += this->test_ulong_constructor(); + status += this->test_copy_constructor_from_ulong(); + status += this->test_assignment_from_ulong(); + status += this->test_exception_in_ulong_constructor(); + status += this->test_set_length_less_than_maximum(); + status += this->test_set_length_more_than_maximum(); + status += this->test_exception_in_set_length(); + status += this->test_regression_2201 (); + status += this->test_buffer_constructor_default(); + status += this->test_buffer_constructor_false(); + status += this->test_buffer_constructor_true(); + status += this->test_replace_default(); + status += this->test_replace_false(); + status += this->test_replace_true(); + status += this->test_get_buffer_false(); + status += this->test_get_buffer_true_with_release_false(); + status += this->test_get_buffer_true_with_release_true(); + return status; } - - static boost::shared_ptr<Tester> allocate() - { - boost::shared_ptr<Tester> ptr(new Tester); - ptr->self_ = ptr; - - return ptr; - } - -private: Tester() {} - - boost::weak_ptr<Tester> self_; }; -ACE_Proper_Export_Flag test_suite * -init_unit_test_suite(int, char*[]) +int ACE_TMAIN(int,ACE_TCHAR*[]) { - test_suite * ts = - BOOST_TEST_SUITE("unbounded value sequence unit test"); - - { - boost::shared_ptr<Tester> tester(Tester::allocate()); - tester->add_all(ts); - } + int status = 0; + Tester tester; + status += tester.test_all (); - { - typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; - boost::shared_ptr<common> tester(common::allocate()); - tester->add_all(ts); - } + typedef value_sequence_tester<tested_sequence,tested_allocation_traits> common; + common tester2 (false); + status += tester2.test_all (); - return ts; + return status; } diff --git a/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp b/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp index 7e502dc966d..9f21028e19a 100644 --- a/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp +++ b/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp @@ -11,9 +11,7 @@ */ #include "tao/Basic_Types.h" -#include <boost/test/unit_test.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> +#include "test_macros.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -24,57 +22,60 @@ struct value_sequence_tester typedef typename tested_sequence::value_type value_type; typedef typename tested_sequence::const_value_type const_value_type; - void test_default_constructor() + int test_default_constructor() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_EQUAL( + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(bounded_, x.release()); } - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 1 : 0), f); + FAIL_RETURN_IF_NOT(a.expect(0), a); + FAIL_RETURN_IF_NOT(f.expect(bounded_ ? 1 : 0), f); + return 0; } - void test_copy_constructor_from_default() + int test_copy_constructor_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_EQUAL( + FAIL_RETURN_IF_NOT(a.expect(0), a); + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(bounded_, x.release()); tested_sequence y(x); - BOOST_CHECK_MESSAGE(a.expect(bounded_ ? 1 : 0), a); - BOOST_CHECK_EQUAL(x.maximum(), y.maximum()); - BOOST_CHECK_EQUAL(x.length(), y.length()); - BOOST_CHECK_EQUAL(x.release(), y.release()); + FAIL_RETURN_IF_NOT(a.expect(bounded_ ? 1 : 0), a); + CHECK_EQUAL(x.maximum(), y.maximum()); + CHECK_EQUAL(x.length(), y.length()); + CHECK_EQUAL(x.release(), y.release()); } - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 2 : 0), f); + FAIL_RETURN_IF_NOT(f.expect(bounded_ ? 2 : 0), f); + return 0; } - void test_index_accessor() + int test_index_accessor() { tested_sequence x; x.length(8); tested_sequence const & y = x; const_value_type & z = y[4]; - BOOST_CHECK_EQUAL(z, y[4]); + CHECK_EQUAL(z, y[4]); + return 0; } - void test_index_modifier() + int test_index_modifier() { tested_sequence x; x.length(8); @@ -82,12 +83,13 @@ struct value_sequence_tester tested_sequence const & y = x; const_value_type & z = y[4]; x[4] = 4; - BOOST_CHECK_EQUAL(4, x[4]); - BOOST_CHECK_EQUAL(4, y[4]); - BOOST_CHECK_EQUAL(4, z); + CHECK_EQUAL(4, x[4]); + CHECK_EQUAL(4, y[4]); + CHECK_EQUAL(4, z); + return 0; } - void test_index_checking() + int test_index_checking() { tested_sequence x; x.length(8); @@ -95,52 +97,55 @@ struct value_sequence_tester tested_sequence const & y = x; int z = 0; - BOOST_CHECK_THROW(z = y[32], std::range_error); - BOOST_CHECK_THROW(x[32] = z, std::range_error); + CHECK_THROW(z = y[32], std::range_error); + CHECK_THROW(x[32] = z, std::range_error); + return 0; } - void test_copy_constructor_values() + int test_copy_constructor_values() { tested_sequence a; a.length(16); for(CORBA::ULong i = 0; i != 16; ++i) a[i] = i*i; tested_sequence b(a); - BOOST_CHECK_EQUAL(a.length(), b.length()); + CHECK_EQUAL(a.length(), b.length()); for(CORBA::ULong i = 0; i != a.length(); ++i) { - BOOST_CHECK_MESSAGE(a[i] == b[i], + FAIL_RETURN_IF_NOT(a[i] == b[i], "Mismatched elements at index " << i); } + return 0; } - void test_assignment_from_default() + int test_assignment_from_default() { expected_calls a(tested_allocation_traits::allocbuf_calls); expected_calls f(tested_allocation_traits::freebuf_calls); { tested_sequence x; - BOOST_CHECK_MESSAGE(a.expect(0), a); - BOOST_CHECK_EQUAL( + FAIL_RETURN_IF_NOT(a.expect(0), a); + CHECK_EQUAL( CORBA::ULong(tested_allocation_traits::default_maximum()), x.maximum()); - BOOST_CHECK_EQUAL(CORBA::ULong(0), x.length()); - BOOST_CHECK_EQUAL(bounded_, x.release()); + CHECK_EQUAL(CORBA::ULong(0), x.length()); + CHECK_EQUAL(bounded_, x.release()); tested_sequence y; - BOOST_CHECK_MESSAGE(a.expect(0), a); + FAIL_RETURN_IF_NOT(a.expect(0), a); y = x; - BOOST_CHECK_MESSAGE(a.expect(bounded_ ? 1 : 0), a); - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 1 : 0), f); - BOOST_CHECK_EQUAL(x.maximum(), y.maximum()); - BOOST_CHECK_EQUAL(x.length(), y.length()); - BOOST_CHECK_EQUAL(x.release(), y.release()); + FAIL_RETURN_IF_NOT(a.expect(bounded_ ? 1 : 0), a); + FAIL_RETURN_IF_NOT(f.expect(bounded_ ? 1 : 0), f); + CHECK_EQUAL(x.maximum(), y.maximum()); + CHECK_EQUAL(x.length(), y.length()); + CHECK_EQUAL(x.release(), y.release()); } - BOOST_CHECK_MESSAGE(f.expect(bounded_ ? 2 : 0), f); + FAIL_RETURN_IF_NOT(f.expect(bounded_ ? 2 : 0), f); + return 0; } - void test_assignment_values() + int test_assignment_values() { tested_sequence a; a.length(16); @@ -148,17 +153,18 @@ struct value_sequence_tester tested_sequence b; b = a; - BOOST_CHECK_EQUAL(a.maximum(), b.maximum()); - BOOST_CHECK_EQUAL(a.length(), b.length()); - BOOST_CHECK_EQUAL(a.release(), b.release()); + CHECK_EQUAL(a.maximum(), b.maximum()); + CHECK_EQUAL(a.length(), b.length()); + CHECK_EQUAL(a.release(), b.release()); for(CORBA::ULong i = 0; i != a.length(); ++i) { - BOOST_CHECK_MESSAGE(a[i] == b[i], + FAIL_RETURN_IF_NOT(a[i] == b[i], "Mismatched elements at index " << i); } + return 0; } - void test_exception_in_copy_constructor() + int test_exception_in_copy_constructor() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -167,13 +173,14 @@ struct value_sequence_tester expected_calls a(tested_allocation_traits::allocbuf_calls); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(tested_sequence y(x), testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); + CHECK_THROW(tested_sequence y(x), testing_exception); + FAIL_RETURN_IF_NOT(a.expect(1), a); } - BOOST_CHECK_MESSAGE(f.expect(1), f); + FAIL_RETURN_IF_NOT(f.expect(1), f); + return 0; } - void test_exception_in_assignment() + int test_exception_in_assignment() { expected_calls f(tested_allocation_traits::freebuf_calls); { @@ -184,17 +191,18 @@ struct value_sequence_tester expected_calls a(tested_allocation_traits::allocbuf_calls); f.reset(); tested_allocation_traits::allocbuf_calls.failure_countdown(1); - BOOST_CHECK_THROW(y = x, testing_exception); + CHECK_THROW(y = x, testing_exception); - BOOST_CHECK_MESSAGE(a.expect(1), a); - BOOST_CHECK_MESSAGE(f.expect(0), f); + FAIL_RETURN_IF_NOT(a.expect(1), a); + FAIL_RETURN_IF_NOT(f.expect(0), f); - BOOST_CHECK_EQUAL(CORBA::ULong(3), y.length()); + CHECK_EQUAL(CORBA::ULong(3), y.length()); } - BOOST_CHECK_MESSAGE(f.expect(2), f); + FAIL_RETURN_IF_NOT(f.expect(2), f); + return 0; } - void test_get_buffer_const() + int test_get_buffer_const() { tested_sequence a; a.length(4); tested_sequence const & b = a; @@ -202,70 +210,35 @@ struct value_sequence_tester value_type const * buffer = b.get_buffer(); a[0] = 1; a[1] = 4; a[2] = 9; a[3] = 16; - BOOST_CHECK_EQUAL(1, buffer[0]); - BOOST_CHECK_EQUAL(4, buffer[1]); - BOOST_CHECK_EQUAL(9, buffer[2]); - BOOST_CHECK_EQUAL(16, buffer[3]); + CHECK_EQUAL(1, buffer[0]); + CHECK_EQUAL(4, buffer[1]); + CHECK_EQUAL(9, buffer[2]); + CHECK_EQUAL(16, buffer[3]); + return 0; } - void add_all(boost::unit_test_framework::test_suite * ts) + int test_all() { - boost::shared_ptr<value_sequence_tester> shared_this(self_); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_default_constructor, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_copy_constructor_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_accessor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_modifier, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_index_checking, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_copy_constructor_values, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_assignment_from_default, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_assignment_values, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_exception_in_copy_constructor, - shared_this)); - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_exception_in_assignment, - shared_this)); - - ts->add(BOOST_CLASS_TEST_CASE( - &value_sequence_tester::test_get_buffer_const, - shared_this)); + int status = 0; + + status +=this->test_default_constructor(); + status +=this->test_copy_constructor_from_default(); + status +=this->test_index_accessor(); + status +=this->test_index_modifier(); + status +=this->test_index_checking(); + status +=this->test_copy_constructor_values(); + status +=this->test_assignment_from_default(); + status +=this->test_assignment_values(); + status +=this->test_exception_in_copy_constructor(); + status +=this->test_exception_in_assignment(); + status +=this->test_get_buffer_const(); + return status; } - - static boost::shared_ptr<value_sequence_tester> allocate(bool bounded = false) - { - boost::shared_ptr<value_sequence_tester> ptr( - new value_sequence_tester(bounded)); - ptr->self_ = ptr; - - return ptr; - } - -private: value_sequence_tester(bool bounded) : bounded_ (bounded) {} bool bounded_; - boost::weak_ptr<value_sequence_tester> self_; }; TAO_END_VERSIONED_NAMESPACE_DECL |