summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_2795_Regression/client.cpp
blob: 2a7fe98c7f591655b11e99d83e8e225b2253a624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// $Id$

#include "tao/ORB_Core.h"
#include "tao/StringSeqC.h"

ACE_RCSID(Bug_2795_Regression,
          client,
          "$Id$")

void
StringOutTest (CORBA::String_out so)
{
  CORBA::String_var sv;
  sv = "StringOutTest";
  so = sv._retn ();
}

void
StringInoutTest (char *& so)
{
  CORBA::string_free (so);
  so = CORBA::string_dup ("StringInoutTest");
}

int
main (int argc, char *argv[])
{
  try
    {
      CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

      CORBA::StringSeq ts;
      ts.length (1);
      ts[0] = CORBA::string_dup ("Hello World");

      StringOutTest (ts[0].out());
      ACE_ASSERT (ACE_OS::strcmp (ts[0].in(), "StringOutTest") == 0);

      StringInoutTest (ts[0].inout());
      ACE_ASSERT (ACE_OS::strcmp (ts[0].in(), "StringInoutTest") == 0);

      CORBA::String_var sv = ts[0]._retn ();
      ACE_ASSERT (ACE_OS::strcmp (ts[0].in(), "") == 0);

      ts[0] = CORBA::string_dup ("Hello Again");
    }
  catch (const CORBA::Exception &ex)
    {
      ACE_ERROR ((LM_ERROR, "Exception caught: %s\"%s\"\n"
      , ex._name(), ex._rep_id ()));
      return 1;
    }

  return 0;

  return 0;
}