summaryrefslogtreecommitdiff
path: root/TAO/tests
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-10-02 23:11:19 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-10-02 23:11:19 +0000
commit1cc6ee589507c372d8a27ab9648651a69bc4a00e (patch)
treeeeaf8cc4a887769c6e79c9d4a2f51c7e8bae693a /TAO/tests
parent94212c0b4f808b4a10b8f953d8213e63e0590350 (diff)
downloadATCD-1cc6ee589507c372d8a27ab9648651a69bc4a00e.tar.gz
New recursive union test.
Diffstat (limited to 'TAO/tests')
-rw-r--r--TAO/tests/Param_Test/Makefile1
-rw-r--r--TAO/tests/Param_Test/bd_array_seq.cpp15
-rw-r--r--TAO/tests/Param_Test/client.dsp8
-rw-r--r--TAO/tests/Param_Test/driver.cpp15
-rw-r--r--TAO/tests/Param_Test/options.cpp2
-rw-r--r--TAO/tests/Param_Test/options.h1
-rw-r--r--TAO/tests/Param_Test/param_test.idl19
-rw-r--r--TAO/tests/Param_Test/param_test_i.cpp13
-rw-r--r--TAO/tests/Param_Test/param_test_i.h7
-rw-r--r--TAO/tests/Param_Test/recursive_struct.cpp6
-rw-r--r--TAO/tests/Param_Test/recursive_struct.h5
-rw-r--r--TAO/tests/Param_Test/recursive_union.cpp428
-rw-r--r--TAO/tests/Param_Test/recursive_union.h103
-rwxr-xr-xTAO/tests/Param_Test/run_test.pl2
-rw-r--r--TAO/tests/Param_Test/tests.h1
15 files changed, 617 insertions, 9 deletions
diff --git a/TAO/tests/Param_Test/Makefile b/TAO/tests/Param_Test/Makefile
index 5a160255ddc..ce2236f1244 100644
--- a/TAO/tests/Param_Test/Makefile
+++ b/TAO/tests/Param_Test/Makefile
@@ -63,6 +63,7 @@ CLI_FILES = param_testCli \
recursive_struct \
except \
big_union \
+ recursive_union \
multdim_array \
complex_any
diff --git a/TAO/tests/Param_Test/bd_array_seq.cpp b/TAO/tests/Param_Test/bd_array_seq.cpp
index 30e24e31626..adf020a221d 100644
--- a/TAO/tests/Param_Test/bd_array_seq.cpp
+++ b/TAO/tests/Param_Test/bd_array_seq.cpp
@@ -56,16 +56,25 @@ Test_Bounded_Array_Sequence::dii_req_invoke (CORBA::Request *req,
int
Test_Bounded_Array_Sequence::init_parameters (Param_Test_ptr,
- CORBA::Environment &)
+ CORBA::Environment &)
{
Generator *gen = GENERATOR::instance (); // value generator
// set the length of the sequence
this->in_.length (MAX_ARRAYSEQ_LEN);
+ // different from in_.
+ this->inout_->length (1);
// now set each individual element
Param_Test::Fixed_Array tmp;
+ for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
+ {
+ tmp[j] = gen->gen_long ();
+ }
+
+ Param_Test::Fixed_Array_copy (this->inout_[0], tmp);
+
for (CORBA::ULong i = 0; i < this->in_.length (); i++)
{
// Generate some arbitrary array to be filled into the ith
@@ -120,8 +129,8 @@ Test_Bounded_Array_Sequence::run_sii_test (Param_Test_ptr objref,
int
Test_Bounded_Array_Sequence::add_args (CORBA::NVList_ptr param_list,
- CORBA::NVList_ptr retval,
- CORBA::Environment &ACE_TRY_ENV)
+ CORBA::NVList_ptr retval,
+ CORBA::Environment &ACE_TRY_ENV)
{
ACE_TRY
{
diff --git a/TAO/tests/Param_Test/client.dsp b/TAO/tests/Param_Test/client.dsp
index aebf83ad52b..3036894e6e8 100644
--- a/TAO/tests/Param_Test/client.dsp
+++ b/TAO/tests/Param_Test/client.dsp
@@ -179,6 +179,10 @@ SOURCE=.\recursive_struct.cpp
# End Source File
# Begin Source File
+SOURCE=.\recursive_union.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\results.cpp
# End Source File
# Begin Source File
@@ -347,6 +351,10 @@ SOURCE=.\recursive_struct.h
# End Source File
# Begin Source File
+SOURCE=.\recursive_union.h
+# End Source File
+# Begin Source File
+
SOURCE=.\results.h
# End Source File
# Begin Source File
diff --git a/TAO/tests/Param_Test/driver.cpp b/TAO/tests/Param_Test/driver.cpp
index d5d8af6213f..38c23120898 100644
--- a/TAO/tests/Param_Test/driver.cpp
+++ b/TAO/tests/Param_Test/driver.cpp
@@ -557,6 +557,19 @@ Driver::run (void)
delete client;
}
break;
+ case Options::TEST_RECURSIVE_UNION:
+ {
+ Param_Test_Client<Test_Recursive_Union> *client = new
+ Param_Test_Client<Test_Recursive_Union> (this->orb_.in (),
+ this->objref_.in(),
+ new Test_Recursive_Union);
+ if (opt->invoke_type () == Options::SII)
+ retstatus = client->run_sii_test ();
+ else
+ retstatus = client->run_dii_test ();
+ delete client;
+ }
+ break;
case Options::TEST_COMPLEX_ANY:
{
Param_Test_Client<Test_Complex_Any> *client = new
@@ -643,6 +656,7 @@ template class Param_Test_Client<Test_Fixed_Array>;
template class Param_Test_Client<Test_Var_Array>;
template class Param_Test_Client<Test_Exception>;
template class Param_Test_Client<Test_Big_Union>;
+template class Param_Test_Client<Test_Recursive_Union>;
template class Param_Test_Client<Test_Complex_Any>;
#if 0
template class Param_Test_Client<Test_Multdim_Array>;
@@ -683,6 +697,7 @@ template class Param_Test_Client<Test_Multdim_Array>;
#pragma instantiate Param_Test_Client<Test_Var_Array>
#pragma instantiate Param_Test_Client<Test_Exception>
#pragma instantiate Param_Test_Client<Test_Big_Union>
+#pragma instantiate Param_Test_Client<Test_Recursive_Union>
#pragma instantiate Param_Test_Client<Test_Complex_Any>
#if 0
#pragma instantiate Param_Test_Client<Test_Multdim_Array>
diff --git a/TAO/tests/Param_Test/options.cpp b/TAO/tests/Param_Test/options.cpp
index e9c876d1ad0..9e2240cb79e 100644
--- a/TAO/tests/Param_Test/options.cpp
+++ b/TAO/tests/Param_Test/options.cpp
@@ -153,6 +153,8 @@ Options::parse_args (int argc, char **argv)
this->test_type_ = Options::TEST_EXCEPTION;
else if (!ACE_OS::strcmp (get_opts.optarg, "big_union"))
this->test_type_ = Options::TEST_BIG_UNION;
+ else if (!ACE_OS::strcmp (get_opts.optarg, "recursive_union"))
+ this->test_type_ = Options::TEST_RECURSIVE_UNION;
else if (!ACE_OS::strcmp (get_opts.optarg, "complex_any"))
this->test_type_ = Options::TEST_COMPLEX_ANY;
break;
diff --git a/TAO/tests/Param_Test/options.h b/TAO/tests/Param_Test/options.h
index 0afdafef89c..a35e3b3991f 100644
--- a/TAO/tests/Param_Test/options.h
+++ b/TAO/tests/Param_Test/options.h
@@ -67,6 +67,7 @@ public:
TEST_MULTDIM_ARRAY,
TEST_EXCEPTION,
TEST_BIG_UNION,
+ TEST_RECURSIVE_UNION,
TEST_COMPLEX_ANY
};
diff --git a/TAO/tests/Param_Test/param_test.idl b/TAO/tests/Param_Test/param_test.idl
index 8564ce7f775..67d24e513ac 100644
--- a/TAO/tests/Param_Test/param_test.idl
+++ b/TAO/tests/Param_Test/param_test.idl
@@ -340,6 +340,25 @@ interface Param_Test
inout Recursive_Struct rs2,
out Recursive_Struct rs3);
+ // Recursive unions. We have one recursive union nested in a different
+ // recursive union.
+
+ union nested_rec_union switch (short)
+ {
+ case 0: long value;
+ case 1: sequence<nested_rec_union> nested_rec_member;
+ };
+
+ union Recursive_Union switch (short)
+ {
+ case 0: sequence<Recursive_Union> rec_member;
+ case 1: nested_rec_union nested_member;
+ };
+
+ Recursive_Union test_recursive_union (in Recursive_Union ru1,
+ inout Recursive_Union ru2,
+ out Recursive_Union ru3);
+
// multidimensional arrays (fixed). The following will give rise to a 3
// dimensional array. The following will define a 3-dimensional array of size
// DIM1 X DIM2 X DIM3
diff --git a/TAO/tests/Param_Test/param_test_i.cpp b/TAO/tests/Param_Test/param_test_i.cpp
index 015a18c2d98..271f6e6624f 100644
--- a/TAO/tests/Param_Test/param_test_i.cpp
+++ b/TAO/tests/Param_Test/param_test_i.cpp
@@ -958,6 +958,19 @@ Param_Test_i::test_big_union (const Param_Test::Big_Union& u1,
return ret._retn ();
}
+Param_Test::Recursive_Union*
+Param_Test_i::test_recursive_union (const Param_Test::Recursive_Union& ru1,
+ Param_Test::Recursive_Union& ru2,
+ Param_Test::Recursive_Union_out ru3,
+ CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ Param_Test::Recursive_Union_var ret (new Param_Test::Recursive_Union (ru1));
+ ru2 = ru1;
+ ru3 = new Param_Test::Recursive_Union (ru1);
+ return ret._retn ();
+}
+
CORBA::Any*
Param_Test_i::test_complex_any (const CORBA::Any &a1,
CORBA::Any &a2,
diff --git a/TAO/tests/Param_Test/param_test_i.h b/TAO/tests/Param_Test/param_test_i.h
index 272bce69dbb..36d58ad31ab 100644
--- a/TAO/tests/Param_Test/param_test_i.h
+++ b/TAO/tests/Param_Test/param_test_i.h
@@ -299,6 +299,13 @@ public:
CORBA::Environment &env)
ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual Param_Test::Recursive_Union*
+ test_recursive_union (const Param_Test::Recursive_Union& ru1,
+ Param_Test::Recursive_Union& ru2,
+ Param_Test::Recursive_Union_out ru3,
+ CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
virtual CORBA::Any*
test_complex_any (const CORBA::Any &a1,
CORBA::Any &a2,
diff --git a/TAO/tests/Param_Test/recursive_struct.cpp b/TAO/tests/Param_Test/recursive_struct.cpp
index 9e3d99db4c9..641975a6281 100644
--- a/TAO/tests/Param_Test/recursive_struct.cpp
+++ b/TAO/tests/Param_Test/recursive_struct.cpp
@@ -18,7 +18,7 @@
#include "recursive_struct.h"
-ACE_RCSID(Param_Test, var_struct, "$Id$")
+ACE_RCSID(Param_Test, recursive_struct, "$Id$")
const CORBA::ULong MAX_DEPTH = 5;
const CORBA::ULong MAX_SEQ_LENGTH = 3;
@@ -215,7 +215,7 @@ Test_Recursive_Struct::check_validity (void)
}
CORBA::Boolean
-Test_Recursive_Struct::check_validity (CORBA::Request_ptr )
+Test_Recursive_Struct::check_validity (CORBA::Request_ptr)
{
return this->check_validity ();
}
@@ -225,7 +225,7 @@ Test_Recursive_Struct::print_values (void)
{
}
-// Private helper function to recursively initiialize the struct.
+// Private helper function to recursively initialize the struct.
void
Test_Recursive_Struct::deep_init (Param_Test::Recursive_Struct &rs,
Generator *gen,
diff --git a/TAO/tests/Param_Test/recursive_struct.h b/TAO/tests/Param_Test/recursive_struct.h
index 1f58516e0e7..0ba2ba048e8 100644
--- a/TAO/tests/Param_Test/recursive_struct.h
+++ b/TAO/tests/Param_Test/recursive_struct.h
@@ -62,7 +62,8 @@ public:
void print_values (void);
// print all the values
- void dii_req_invoke (CORBA::Request *, CORBA::Environment &);
+ void dii_req_invoke (CORBA::Request *,
+ CORBA::Environment &);
// invoke DII request with appropriate exception handling.
private:
@@ -88,7 +89,7 @@ private:
// helper function for init_parameters
CORBA::Boolean deep_check (const Param_Test::Recursive_Struct &in_struct,
- const Param_Test::Recursive_Struct &test_strcut);
+ const Param_Test::Recursive_Struct &test_struct);
// helper function for check_validity
};
diff --git a/TAO/tests/Param_Test/recursive_union.cpp b/TAO/tests/Param_Test/recursive_union.cpp
new file mode 100644
index 00000000000..b3fb513a692
--- /dev/null
+++ b/TAO/tests/Param_Test/recursive_union.cpp
@@ -0,0 +1,428 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Param_Test
+//
+// = FILENAME
+// recursive_union.cpp
+//
+// = DESCRIPTION
+// test union that contains a sequence of itself
+//
+// = AUTHORS
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "recursive_union.h"
+
+ACE_RCSID(Param_Test, recursive_union, "$Id$")
+
+const CORBA::ULong MAX_DEPTH = 3;
+const CORBA::ULong MAX_SEQ_LENGTH = 2;
+
+// ************************************************************************
+// Test_Recursive_Union
+// ************************************************************************
+
+Test_Recursive_Union::Test_Recursive_Union (void)
+ : opname_ (CORBA::string_dup ("test_recursive_union"))
+{
+}
+
+Test_Recursive_Union::~Test_Recursive_Union (void)
+{
+ CORBA::string_free (this->opname_);
+ this->opname_ = 0;
+ // the other data members will be freed as they are "_var"s and objects
+ // (rather than pointers to objects)
+}
+
+const char *
+Test_Recursive_Union::opname (void) const
+{
+ return this->opname_;
+}
+
+void
+Test_Recursive_Union::dii_req_invoke (CORBA::Request *req,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ req->invoke (ACE_TRY_ENV);
+}
+
+int
+Test_Recursive_Union::init_parameters (Param_Test_ptr ,
+ CORBA::Environment &)
+{
+ // The client calls init_parameters() before the first
+ // call and reset_parameters() after each call. For this
+ // test, we want the same thing to happen each time.
+ return this->reset_parameters ();
+}
+
+int
+Test_Recursive_Union::reset_parameters (void)
+{
+ // Since these are _vars, we do this the first call and
+ // every call thereafter (if any).
+ this->inout_ = new Param_Test::Recursive_Union;
+ this->out_ = new Param_Test::Recursive_Union;
+ this->ret_ = new Param_Test::Recursive_Union;
+
+ // value generator
+ Generator *gen = GENERATOR::instance ();
+
+ // Set the depth of recursion.
+ CORBA::ULong depth =
+ (CORBA::ULong) (gen->gen_long () % MAX_DEPTH) + 1;
+
+ // Create a nested union to put in inout_.
+ Param_Test::nested_rec_union nru;
+
+ nru.value (0);
+
+ this->inout_->nested_member (nru);
+
+ // Call the recursive helper function. to initialize in_.
+ this->deep_init (this->in_,
+ gen,
+ depth);
+
+ return 0;
+}
+
+int
+Test_Recursive_Union::run_sii_test (Param_Test_ptr objref,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_TRY
+ {
+ Param_Test::Recursive_Union_out out (this->out_.out ());
+
+ this->ret_ = objref->test_recursive_union (this->in_,
+ this->inout_.inout (),
+ out,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ return 0;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Recursive_Union::run_sii_test\n");
+
+ }
+ ACE_ENDTRY;
+ return -1;
+}
+
+int
+Test_Recursive_Union::add_args (CORBA::NVList_ptr param_list,
+ CORBA::NVList_ptr retval,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_TRY
+ {
+ CORBA::Any in_arg (Param_Test::_tc_Recursive_Union,
+ &this->in_,
+ 0);
+
+ CORBA::Any inout_arg (Param_Test::_tc_Recursive_Union,
+ &this->inout_.inout (), // .out () causes crash
+ 0);
+
+ CORBA::Any out_arg (Param_Test::_tc_Recursive_Union,
+ &this->out_.inout (),
+ 0);
+
+ // add parameters
+ param_list->add_value ("ru1",
+ in_arg,
+ CORBA::ARG_IN,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ param_list->add_value ("ru2",
+ inout_arg,
+ CORBA::ARG_INOUT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ param_list->add_value ("ru3",
+ out_arg,
+ CORBA::ARG_OUT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // add return value
+ CORBA::NamedValue *item = retval->item (0,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ item->value ()->replace (Param_Test::_tc_Recursive_Union,
+ &this->ret_.inout (), // see above
+ 0, // does not own
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ return 0;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Recursive_Union::add_args\n");
+
+ }
+ ACE_ENDTRY;
+ return -1;
+}
+
+
+CORBA::Boolean
+Test_Recursive_Union::check_validity (void)
+{
+ // Pair in_ with each of the returned values and call the
+ // helper function with that pair.
+
+ if (this->deep_check (this->in_, this->inout_.in ()) == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of inout arg\n"));
+
+ return 0;
+ }
+
+ if (this->deep_check (this->in_, this->out_.in ()) == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of out arg\n"));
+
+ return 0;
+ }
+
+ if (this->deep_check (this->in_, this->ret_.in ()) == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of ret value\n"));
+
+ return 0;
+ }
+
+ // If we get this far, all is correct.
+ return 1;
+}
+
+CORBA::Boolean
+Test_Recursive_Union::check_validity (CORBA::Request_ptr)
+{
+ return this->check_validity ();
+}
+
+void
+Test_Recursive_Union::print_values (void)
+{
+}
+
+// Private helper function to recursively initialize the union.
+void
+Test_Recursive_Union::deep_init (Param_Test::Recursive_Union &ru,
+ Generator *gen,
+ CORBA::ULong level)
+{
+ if (level == 1)
+ // No more recursion, just insert a nested_rec_union.
+ {
+ CORBA::ULong nested_depth =
+ (CORBA::ULong) (gen->gen_long () % MAX_DEPTH) + 1;
+
+ Param_Test::nested_rec_union nru;
+
+ this->deep_init_nested (nru,
+ gen,
+ nested_depth);
+
+ ru.nested_member (nru);
+
+ Param_Test::Recursive_Union::_rec_member_seq tmp (MAX_SEQ_LENGTH);
+
+ ru.rec_member (tmp);
+
+ return;
+ }
+ else
+ {
+ // Generate a member sequence.
+ CORBA::ULong len =
+ (CORBA::ULong) (gen->gen_long () % MAX_SEQ_LENGTH) + 1;
+
+ Param_Test::Recursive_Union::_rec_member_seq tmp (MAX_SEQ_LENGTH);
+
+ tmp.length (len);
+
+ ru.rec_member (tmp);
+
+ // We recurse for each element of the member sequence.
+ for (CORBA::ULong i = 0; i < len; i++)
+ {
+ this->deep_init (ru.rec_member ()[i],
+ gen,
+ level - 1);
+ }
+ }
+}
+
+// Private helper function to recursively initialize the nested union.
+void
+Test_Recursive_Union::deep_init_nested (Param_Test::nested_rec_union &nu,
+ Generator *gen,
+ CORBA::ULong level)
+{
+ if (level == 1)
+ // No more recursion
+ {
+ nu.value (gen->gen_long ());
+
+ return;
+ }
+ else
+ {
+ // Generate a sequence length.
+ CORBA::ULong len =
+ (CORBA::ULong) (gen->gen_long () % MAX_SEQ_LENGTH) + 1;
+
+ Param_Test::nested_rec_union::_nested_rec_member_seq tmp (MAX_SEQ_LENGTH);
+
+ tmp.length (len);
+
+ nu.nested_rec_member (tmp);
+
+ // We recurse for each element of the member sequence.
+ for (CORBA::ULong i = 0; i < len; i++)
+ {
+ this->deep_init_nested (nu.nested_rec_member ()[i],
+ gen,
+ level - 1);
+ }
+ }
+}
+
+// Private helper function for check_validity (so we can recurse).
+CORBA::Boolean
+Test_Recursive_Union::deep_check (const Param_Test::Recursive_Union &in_union,
+ const Param_Test::Recursive_Union &test_union)
+{
+ // Do the discriminators match?
+ if (in_union._d () != test_union._d ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of Recursive_Union discriminators\n"));
+
+ return 0;
+ }
+
+ switch (in_union._d ())
+ {
+ // Active member is the Recursive_Union sequence.
+ case 0:
+ {
+ // Do the sequence lengths match?
+ if (in_union.rec_member ().length () !=
+ test_union.rec_member ().length ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of Recursive_Union member sequence lengths\n"));
+
+ return 0;
+ }
+
+ for (CORBA::ULong i = 0; i < in_union.rec_member ().length (); i++)
+ {
+ if (!this->deep_check (in_union.rec_member ()[i],
+ test_union.rec_member ()[i]))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of contained Recursive_Unions\n"));
+
+ return 0;
+ }
+ }
+
+ break;
+ }
+
+ // Active member is the nested union.
+ case 1:
+ return this->deep_check_nested (in_union.nested_member (),
+ test_union.nested_member ());
+ break;
+
+ default:
+ ACE_DEBUG ((LM_DEBUG,
+ "bad discriminator value\n"));
+
+ break;
+ }
+
+ return 1;
+}
+
+CORBA::Boolean
+Test_Recursive_Union::deep_check_nested (const Param_Test::nested_rec_union &in,
+ const Param_Test::nested_rec_union &test)
+{
+ if (in._d () != test._d ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of nested union discriminators\n"));
+
+ return 0;
+ }
+
+ switch (in._d ())
+ {
+ // Active member is the long integer.
+ case 0:
+ // Do the nested_rec_union member values match?
+ if (in.value () != test.value ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of nested_rec_union member values\n"));
+
+ return 0;
+ }
+
+ break;
+
+ // Active member is the recursive sequence.
+ case 1:
+ {
+ // Do the sequence lengths match?
+ if (in.nested_rec_member ().length () !=
+ test.nested_rec_member ().length ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of nested_rec_union member sequence lengths\n"));
+
+ return 0;
+ }
+
+ for (CORBA::ULong i = 0; i < in.nested_rec_member ().length (); i++)
+ {
+ if (!this->deep_check_nested (in.nested_rec_member ()[i],
+ test.nested_rec_member ()[i]))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "mismatch of contained nested_rec_unions\n"));
+
+ return 0;
+ }
+ }
+ }
+ }
+
+ return 1;
+}
diff --git a/TAO/tests/Param_Test/recursive_union.h b/TAO/tests/Param_Test/recursive_union.h
new file mode 100644
index 00000000000..0b371d5489b
--- /dev/null
+++ b/TAO/tests/Param_Test/recursive_union.h
@@ -0,0 +1,103 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Param_Test
+//
+// = FILENAME
+// recursive_union.h
+//
+// = DESCRIPTION
+// Tests a union that contains a sequence of itself
+//
+// = AUTHORS
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef PARAM_TEST_RECURSIVE_UNION_H
+#define PARAM_TEST_RECURSIVE_UNION_H
+
+#include "param_testCli.h"
+#include "helper.h"
+
+// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+// test recursive unions
+// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+
+class Test_Recursive_Union
+{
+public:
+ Test_Recursive_Union (void);
+ // ctor
+
+ ~Test_Recursive_Union (void);
+ // dtor
+
+ int run_sii_test (Param_Test_ptr objref,
+ CORBA::Environment &env);
+ // run the SII test
+
+ int add_args (CORBA::NVList_ptr nvlist,
+ CORBA::NVList_ptr retval,
+ CORBA::Environment &env);
+ // add args to NVList for DII
+ const char *opname (void) const;
+ // return operation name
+
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
+ // set values for parameters
+
+ int reset_parameters (void);
+ // reset values for CORBA
+
+ CORBA::Boolean check_validity (void);
+ // check if results are valid
+
+ CORBA::Boolean check_validity (CORBA::Request_ptr req);
+ // check if results are valid. This is used for DII results
+
+ void print_values (void);
+ // print all the values
+
+ void dii_req_invoke (CORBA::Request *,
+ CORBA::Environment &);
+ // invoke DII request with appropriate exception handling.
+
+private:
+ char *opname_;
+ // operation name
+
+ Param_Test::Recursive_Union in_;
+ // in parameter
+
+ // these need memory management
+ Param_Test::Recursive_Union_var inout_;
+ // inout parameter
+
+ Param_Test::Recursive_Union_var out_;
+ // out parameter
+
+ Param_Test::Recursive_Union_var ret_;
+ // return value
+
+ void deep_init (Param_Test::Recursive_Union &u,
+ Generator *gen,
+ CORBA::ULong level);
+
+ void deep_init_nested (Param_Test::nested_rec_union &nu,
+ Generator *gen,
+ CORBA::ULong level);
+ // helper functions for init_parameters
+
+ CORBA::Boolean deep_check (const Param_Test::Recursive_Union &in_union,
+ const Param_Test::Recursive_Union &test_union);
+
+ CORBA::Boolean deep_check_nested (const Param_Test::nested_rec_union &in,
+ const Param_Test::nested_rec_union &test);
+ // helper functions for check_validity
+};
+
+#endif /* PARAM_TEST_RECURSIVE_UNION_H */
diff --git a/TAO/tests/Param_Test/run_test.pl b/TAO/tests/Param_Test/run_test.pl
index c1d57444cba..dd9e0527bce 100755
--- a/TAO/tests/Param_Test/run_test.pl
+++ b/TAO/tests/Param_Test/run_test.pl
@@ -67,7 +67,7 @@ sub run_test
"ub_short_sequence", "ub_long_sequence",
"bd_short_sequence", "bd_long_sequence",
"fixed_array", "var_array", "typecode", "exception",
- "big_union", "complex_any");
+ "big_union", "recursive_union", "complex_any");
for ($i = 0; $i <= $#ARGV; $i++)
{
diff --git a/TAO/tests/Param_Test/tests.h b/TAO/tests/Param_Test/tests.h
index 6c873bea043..dc6cbaf44d8 100644
--- a/TAO/tests/Param_Test/tests.h
+++ b/TAO/tests/Param_Test/tests.h
@@ -51,6 +51,7 @@
#include "var_struct.h"
#include "except.h"
#include "big_union.h"
+#include "recursive_union.h"
#include "complex_any.h"
#if 0
#include "multdim_array.h"