1 #include "tao/StringSeqC.h"
3 #if defined (__BORLANDC__) && (__BORLANDC__ >= 0x660) && (__BORLANDC__ <= 0x760)
4 # pragma option push -w-8011
8 ACE_TMAIN (int, ACE_TCHAR
*[])
10 char const *str
= "Some string";
14 for (CORBA::ULong i
= 0; i
< seq
.length (); ++i
)
19 // Save a pointer to the whole buffer.
20 char const * const *wholebuf
= seq
.get_buffer ();
22 // This call should reinitialize the the 100th element
23 // (the fact that the shrunk elements are reinitialized is TAO
24 // specific but we test for it).
26 // No reallocation should happen for the buffer.
27 ACE_TEST_ASSERT (seq
.get_buffer () == wholebuf
);
28 // And set the length to the same value
30 ACE_TEST_ASSERT (seq
.get_buffer () == wholebuf
);
31 // We cannot be sure that the pointer to the reinitialized 100th
32 // element is different from the old one since memory manager can
33 // return the same pointer that we've just released but it must
34 // not be 0 and it must be an empty string.
35 ACE_TEST_ASSERT (wholebuf
[99] != 0);
36 ACE_TEST_ASSERT (ACE_OS::strcmp (wholebuf
[99], "") == 0);
38 // Extend the sequence to the original size.
40 // No reallocation should happen for the buffer.
41 ACE_TEST_ASSERT (seq
.get_buffer () == wholebuf
);
42 // And now we can test absolutely legally that the 100th
43 // element was reinitialized as CORBA spec requires.
44 ACE_TEST_ASSERT (seq
[99].in () != 0);
45 ACE_TEST_ASSERT (ACE_OS::strcmp (seq
[99].in (), "") == 0);
47 // Reallocation should happen for the buffer.
48 ACE_TEST_ASSERT (seq
.get_buffer () != wholebuf
);
49 ACE_TEST_ASSERT (seq
[100].in () != 0);
50 ACE_TEST_ASSERT (ACE_OS::strcmp (seq
[100].in (), "") == 0);
55 #if defined (__BORLANDC__) && (__BORLANDC__ >= 0x660) && (__BORLANDC__ <= 0x760)