diff options
Diffstat (limited to 'tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp')
-rw-r--r-- | tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp | 79 |
1 files changed, 44 insertions, 35 deletions
diff --git a/tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp b/tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp index 79a93c10ed1..743b3c76b62 100644 --- a/tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp +++ b/tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp @@ -9,6 +9,7 @@ * @author Carlos O'Ryan */ #include "tao/Unbounded_Value_Sequence_T.h" +#include "ace/Log_Msg.h" struct Foo { @@ -17,53 +18,61 @@ struct Foo int ACE_TMAIN (int, ACE_TCHAR *[]) { - typedef TAO::unbounded_value_sequence<int> int_sequence; + try + { + typedef TAO::unbounded_value_sequence<int> int_sequence; - int_sequence a; - int_sequence b(23); + int_sequence a; + int_sequence b(23); - int_sequence c(32, 0, int_sequence::allocbuf(32), true); + int_sequence c(32, 0, int_sequence::allocbuf(32), true); - a = b; + a = b; - a.length(c.maximum()); - if (a.release()) - { - b.length(a.length()); - } - a[0] = 0; - b[0] = a[0]; + a.length(c.maximum()); + if (a.release()) + { + b.length(a.length()); + } + a[0] = 0; + b[0] = a[0]; - int_sequence const & d = a; - try - { - c[0] = d[0]; + int_sequence const & d = a; + try + { + c[0] = d[0]; #if defined (TAO_CHECKED_SEQUENCE_INDEXING) && (TAO_CHECKED_SEQUENCE_INDEXING == 1) - return 1; + return 1; #endif - } - catch (const ::CORBA::BAD_PARAM &) - { - // c has length = 0, so there is an exception when we try - // to access element above length. - } + } + catch (const ::CORBA::BAD_PARAM &) + { + // c has length = 0, so there is an exception when we try + // to access element above length. + } - b.replace(64, 0, int_sequence::allocbuf(64), true); + b.replace(64, 0, int_sequence::allocbuf(64), true); - int const * x = d.get_buffer(); - if (x != 0) - { - int_sequence::freebuf(a.get_buffer(true)); - } - x = b.get_buffer(); + int const * x = d.get_buffer(); + if (x != 0) + { + int_sequence::freebuf(a.get_buffer(true)); + } + x = b.get_buffer(); - int_sequence e(c); + int_sequence e(c); - typedef TAO::unbounded_value_sequence<Foo> Foo_sequence; + typedef TAO::unbounded_value_sequence<Foo> Foo_sequence; - Foo_sequence u; - Foo_sequence v(32); - u = v; + Foo_sequence u; + Foo_sequence v(32); + u = v; + } + catch (const ::CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR, "Caught unexpected exception\n")); + return 1; + } return 0; } |