Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Sequence_Unit_Tests / Unbounded_Octet.cpp
blob45eafc4840e212714fc5c70612e4edde2fcf4f3f
1 /**
2 * @file
4 * @brief Smoke test (basically just compile) the unbounded sequences
5 * for octets.
7 * @author Johnny Willemsen <jwillemsen@remedy.nl>
8 */
9 #include "tao/Basic_Types.h"
10 #include "tao/Unbounded_Octet_Sequence_T.h"
11 #include "ace/Log_Msg.h"
13 typedef TAO::unbounded_value_sequence <CORBA::Octet> s_sequence;
15 int ACE_TMAIN (int, ACE_TCHAR *[])
17 try
19 s_sequence a;
20 s_sequence b(23);
22 s_sequence c(32, 0, s_sequence::allocbuf(32), true);
23 a = b;
25 a.length(c.maximum());
26 if (a.release())
28 b.length(a.length());
31 a[0] = 'a';
32 b[0] = a[0];
34 s_sequence const & d = a;
35 try
37 c[0] = d[0];
38 #if defined (TAO_CHECKED_SEQUENCE_INDEXING) && (TAO_CHECKED_SEQUENCE_INDEXING == 1)
39 return 1;
40 #endif
42 catch (const ::CORBA::BAD_PARAM &)
44 // c has length = 0, so there is an exception when we try
45 // to access element above length.
48 b.replace(64, 0, s_sequence::allocbuf(64), true);
50 CORBA::Octet const * x = d.get_buffer();
51 if (x != 0)
53 s_sequence::freebuf(a.get_buffer(true));
55 x = b.get_buffer();
57 if (d.length())
59 s_sequence::freebuf(s_sequence::allocbuf(64));
62 s_sequence e(c);
64 catch (const ::CORBA::Exception &)
66 ACE_ERROR ((LM_ERROR, "Caught unexpected exception\n"));
67 return 1;
70 return 0;