summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_4082_Regression/Bug_4082_Regression.cpp
blob: 3e8425915dd857be91eaa92e0bead32dc1c30cd3 (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
// $Id$
#include "Bug_4082_RegressionC.h"
#include "tao/AnyTypeCode/TypeCode.h"
#include "tao/AnyTypeCode/Any.h"

int ACE_TMAIN (int, ACE_TCHAR *[])
{
  MyLongSeq mls (2);
  mls.length (2);
  mls[0] = 0;
  mls[1] = 1;
  CORBA::Any a;
  a <<= mls;

  CORBA::TypeCode_var tc = a.type ();
  if (!tc->equivalent (CORBA::_tc_LongSeq) || tc->equal (CORBA::_tc_LongSeq))
    {
      ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: Test precondition not met\n")));
      return 1;
    }

  const CORBA::LongSeq *cls = 0;
  if (!(a >>= cls))
    {
      ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: Failed to extract\n")));
      return 1;
    }

  if (!cls || cls->length () != 2 || (*cls)[0] != 0 || (*cls)[1] != 1)
    {
      ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: Extract invalid data\n")));
      return 1;
    }

  return 0;
}