summaryrefslogtreecommitdiff
path: root/TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2009-03-24 06:43:11 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2009-03-24 06:43:11 +0000
commitab01ea435b1fcd3e1579a5de9b73955a47c4fd0b (patch)
tree8f7720a8e4e91c029ab857d2b0d9dc32b8a01f44 /TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp
parent2c8fee233a4ac700e3e41f2ec581bc41bc6d7135 (diff)
downloadATCD-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
Diffstat (limited to 'TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp')
-rw-r--r--TAO/tests/Sequence_Unit_Tests/value_sequence_tester.hpp201
1 files changed, 87 insertions, 114 deletions
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