diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-03 23:25:34 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-03 23:25:34 +0000 |
commit | 586b48a06068a4b5fb5807cf4a2a83e1c8e143ad (patch) | |
tree | c846c233c6fb4a4344715f08b23e2d2430b6f71e /TAO/tests | |
parent | 32d038467318135bb1ab256d7523d1b148d591ba (diff) | |
download | ATCD-586b48a06068a4b5fb5807cf4a2a83e1c8e143ad.tar.gz |
ChangeLogTag:Wed May 3 15:30:15 2000 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/Param_Test/Makefile | 297 | ||||
-rw-r--r-- | TAO/tests/Param_Test/any.cpp | 61 | ||||
-rw-r--r-- | TAO/tests/Param_Test/any.h | 3 | ||||
-rw-r--r-- | TAO/tests/Param_Test/driver.cpp | 27 | ||||
-rw-r--r-- | TAO/tests/Param_Test/options.cpp | 2 | ||||
-rw-r--r-- | TAO/tests/Param_Test/options.h | 1 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test.idl | 12 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test_i.cpp | 39 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test_i.h | 7 | ||||
-rwxr-xr-x | TAO/tests/Param_Test/run_test.pl | 2 | ||||
-rw-r--r-- | TAO/tests/Param_Test/small_union.cpp | 208 | ||||
-rw-r--r-- | TAO/tests/Param_Test/small_union.h | 85 | ||||
-rw-r--r-- | TAO/tests/Param_Test/tests.h | 1 |
13 files changed, 734 insertions, 11 deletions
diff --git a/TAO/tests/Param_Test/Makefile b/TAO/tests/Param_Test/Makefile index ad30252dd79..a9f0f2433a7 100644 --- a/TAO/tests/Param_Test/Makefile +++ b/TAO/tests/Param_Test/Makefile @@ -64,6 +64,7 @@ CLI_FILES = param_testCli \ recursive_struct \ except \ big_union \ + small_union \ recursive_union \ multdim_array \ complex_any @@ -2204,7 +2205,8 @@ endif # ! ACE_HAS_GNUG_PRE_2_8 ulonglong.h typecode.h ub_any_seq.h ub_long_seq.h ub_objref_seq.h \ ub_short_seq.h ub_str_seq.h ub_wstr_seq.h ub_string.h ub_wstring.h \ ub_struct_seq.h ub_array_seq.h var_array.h var_struct.h except.h \ - big_union.h recursive_union.h complex_any.h multdim_array.h \ + big_union.h small_union.h recursive_union.h complex_any.h \ + multdim_array.h \ $(ACE_ROOT)/ace/Get_Opt.h \ $(ACE_ROOT)/ace/Get_Opt.i @@ -13065,6 +13067,299 @@ endif # ! ACE_HAS_GNUG_PRE_2_8 $(TAO_ROOT)/tao/MessagingS.i \ param_testCli.i big_union.h +.obj/small_union.o .obj/small_union.so .shobj/small_union.o .shobj/small_union.so: small_union.cpp helper.h param_testCli.h \ + $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/pre.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/post.h \ + $(ACE_ROOT)/ace/ace_wchar.h \ + $(ACE_ROOT)/ace/ACE_export.h \ + $(ACE_ROOT)/ace/svc_export.h \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Based_Pointer_T.h \ + $(ACE_ROOT)/ace/Based_Pointer_T.i \ + $(ACE_ROOT)/ace/Based_Pointer_T.cpp \ + $(ACE_ROOT)/ace/Based_Pointer_Repository.h \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers_T.h \ + $(ACE_ROOT)/ace/Containers_T.i \ + $(ACE_ROOT)/ace/Containers_T.cpp \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/Message_Block_T.h \ + $(ACE_ROOT)/ace/Message_Block_T.i \ + $(ACE_ROOT)/ace/Message_Block_T.cpp \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/try_macros.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/IOR_LookupTable.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager.h \ + $(ACE_ROOT)/ace/Functor.h \ + $(ACE_ROOT)/ace/Functor.i \ + $(ACE_ROOT)/ace/Functor_T.h \ + $(ACE_ROOT)/ace/Functor_T.i \ + $(ACE_ROOT)/ace/Functor_T.cpp \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ + $(ACE_ROOT)/ace/Service_Config.h \ + $(ACE_ROOT)/ace/Service_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.i \ + $(ACE_ROOT)/ace/Service_Object.i \ + $(ACE_ROOT)/ace/Service_Config.i \ + $(ACE_ROOT)/ace/Reactor.h \ + $(ACE_ROOT)/ace/Handle_Set.h \ + $(ACE_ROOT)/ace/Handle_Set.i \ + $(ACE_ROOT)/ace/Timer_Queue.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ + $(ACE_ROOT)/ace/Reactor.i \ + $(ACE_ROOT)/ace/Reactor_Impl.h \ + $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ + $(TAO_ROOT)/tao/Services.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Managed_Types.h \ + $(TAO_ROOT)/tao/Managed_Types.i \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/IORManipulation.h \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/IORS.h \ + $(TAO_ROOT)/tao/IORC.h \ + $(TAO_ROOT)/tao/CDR.h \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/IORC.i \ + $(TAO_ROOT)/tao/Servant_Base.h \ + $(TAO_ROOT)/tao/POAC.h \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/POAC.i \ + $(TAO_ROOT)/tao/Servant_Base.i \ + $(TAO_ROOT)/tao/IORS.i \ + $(TAO_ROOT)/tao/Interceptor.h \ + $(TAO_ROOT)/tao/InterceptorC.h \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/InterceptorC.i \ + $(TAO_ROOT)/tao/Interceptor.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/Request.h \ + $(TAO_ROOT)/tao/Context.h \ + $(TAO_ROOT)/tao/Context.i \ + $(TAO_ROOT)/tao/MessagingC.h \ + $(TAO_ROOT)/tao/ValueBase.h \ + $(TAO_ROOT)/tao/ValueBase.i \ + $(TAO_ROOT)/tao/ValueFactory.h \ + $(TAO_ROOT)/tao/ValueFactory.i \ + $(TAO_ROOT)/tao/TimeBaseC.h \ + $(TAO_ROOT)/tao/TimeBaseC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ + $(TAO_ROOT)/tao/Smart_Proxies.h \ + $(TAO_ROOT)/tao/Smart_Proxies.i \ + $(TAO_ROOT)/tao/MessagingC.i \ + $(TAO_ROOT)/tao/Request.i \ + $(TAO_ROOT)/tao/Server_Request.h \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/Server_Request.i \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/POA.h \ + $(TAO_ROOT)/tao/Object_Adapter.h \ + $(TAO_ROOT)/tao/Key_Adapters.h \ + $(ACE_ROOT)/ace/Map.h \ + $(ACE_ROOT)/ace/Map_T.h \ + $(ACE_ROOT)/ace/Pair.h \ + $(ACE_ROOT)/ace/Pair_T.h \ + $(ACE_ROOT)/ace/Pair_T.i \ + $(ACE_ROOT)/ace/Pair_T.cpp \ + $(ACE_ROOT)/ace/Map_Manager.h \ + $(ACE_ROOT)/ace/Map_Manager.i \ + $(ACE_ROOT)/ace/Map_Manager.cpp \ + $(ACE_ROOT)/ace/Active_Map_Manager.h \ + $(ACE_ROOT)/ace/Active_Map_Manager.i \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.cpp \ + $(ACE_ROOT)/ace/Map_T.i \ + $(ACE_ROOT)/ace/Map_T.cpp \ + $(TAO_ROOT)/tao/Key_Adapters.i \ + $(TAO_ROOT)/tao/Server_Strategy_Factory.h \ + $(TAO_ROOT)/tao/poa_macros.h \ + $(TAO_ROOT)/tao/POAS.h \ + $(TAO_ROOT)/tao/POA_CORBA.h \ + $(TAO_ROOT)/tao/DynAnyC.h \ + $(TAO_ROOT)/tao/DynAnyC.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/InterfaceC.h \ + $(TAO_ROOT)/tao/ifrfwd.h \ + $(TAO_ROOT)/tao/InterfaceC.i \ + $(TAO_ROOT)/tao/POAS.i \ + $(TAO_ROOT)/tao/Active_Object_Map.h \ + $(TAO_ROOT)/tao/Active_Object_Map.i \ + $(TAO_ROOT)/tao/Object_Adapter.i \ + $(TAO_ROOT)/tao/POAManager.h \ + $(TAO_ROOT)/tao/POAManager.i \ + $(TAO_ROOT)/tao/POA.i \ + $(TAO_ROOT)/tao/Stub.h \ + $(TAO_ROOT)/tao/Pluggable.h \ + $(ACE_ROOT)/ace/Message_Queue.h \ + $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ + $(ACE_ROOT)/ace/Message_Queue_T.h \ + $(ACE_ROOT)/ace/Message_Queue_T.i \ + $(ACE_ROOT)/ace/Message_Queue_T.cpp \ + $(ACE_ROOT)/ace/Strategies.h \ + $(ACE_ROOT)/ace/Strategies_T.h \ + $(ACE_ROOT)/ace/Synch_Options.h \ + $(ACE_ROOT)/ace/Synch_Options.i \ + $(ACE_ROOT)/ace/Thread_Manager.h \ + $(ACE_ROOT)/ace/Thread_Manager.i \ + $(ACE_ROOT)/ace/Strategies_T.i \ + $(ACE_ROOT)/ace/Strategies_T.cpp \ + $(ACE_ROOT)/ace/Service_Repository.h \ + $(ACE_ROOT)/ace/Service_Types.h \ + $(ACE_ROOT)/ace/Service_Types.i \ + $(ACE_ROOT)/ace/Service_Repository.i \ + $(ACE_ROOT)/ace/WFMO_Reactor.h \ + $(ACE_ROOT)/ace/WFMO_Reactor.i \ + $(ACE_ROOT)/ace/Strategies.i \ + $(ACE_ROOT)/ace/Message_Queue.i \ + $(TAO_ROOT)/tao/Pluggable.i \ + $(TAO_ROOT)/tao/MProfile.h \ + $(TAO_ROOT)/tao/Profile.h \ + $(TAO_ROOT)/tao/Tagged_Components.h \ + $(TAO_ROOT)/tao/CONV_FRAMEC.h \ + $(TAO_ROOT)/tao/CONV_FRAMEC.i \ + $(TAO_ROOT)/tao/Tagged_Components.i \ + $(TAO_ROOT)/tao/Profile.i \ + $(TAO_ROOT)/tao/MProfile.i \ + $(TAO_ROOT)/tao/Stub.i \ + $(TAO_ROOT)/tao/params.h \ + $(TAO_ROOT)/tao/params.i \ + $(TAO_ROOT)/tao/ORB_Core.h \ + $(TAO_ROOT)/tao/Policy_Manager.h \ + $(TAO_ROOT)/tao/Policy_Manager.i \ + $(TAO_ROOT)/tao/Resource_Factory.h \ + $(TAO_ROOT)/tao/Protocol_Factory.h \ + $(TAO_ROOT)/tao/ORB_Core.i \ + $(ACE_ROOT)/ace/Dynamic_Service.h \ + $(ACE_ROOT)/ace/Dynamic_Service.cpp \ + $(TAO_ROOT)/tao/Operation_Table.h \ + $(TAO_ROOT)/tao/debug.h \ + $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ + $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ + $(TAO_ROOT)/tao/GIOP_Message_State.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging_Utils.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging_Utils.i \ + $(TAO_ROOT)/tao/Pluggable_Messaging.i \ + $(TAO_ROOT)/tao/GIOP_Message_State.i \ + $(TAO_ROOT)/tao/Reply_Dispatcher.i \ + $(TAO_ROOT)/tao/TAOC.h \ + $(TAO_ROOT)/tao/TAOC.i \ + $(TAO_ROOT)/tao/operation_details.h \ + $(TAO_ROOT)/tao/target_specification.h \ + $(TAO_ROOT)/tao/target_specification.i \ + $(TAO_ROOT)/tao/operation_details.i \ + $(TAO_ROOT)/tao/Invocation.i \ + $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ + $(TAO_ROOT)/tao/DynAny_i.h \ + $(TAO_ROOT)/tao/ObjectIDList.h \ + $(TAO_ROOT)/tao/ObjectIDList.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/MessagingS.h \ + $(TAO_ROOT)/tao/TimeBaseS.h \ + $(TAO_ROOT)/tao/TimeBaseS_T.h \ + $(TAO_ROOT)/tao/TimeBaseS_T.i \ + $(TAO_ROOT)/tao/TimeBaseS_T.cpp \ + $(TAO_ROOT)/tao/TimeBaseS.i \ + $(TAO_ROOT)/tao/MessagingS_T.h \ + $(TAO_ROOT)/tao/MessagingS_T.i \ + $(TAO_ROOT)/tao/MessagingS_T.cpp \ + $(TAO_ROOT)/tao/MessagingS.i \ + param_testCli.i small_union.h + .obj/recursive_union.o .obj/recursive_union.so .shobj/recursive_union.o .shobj/recursive_union.so: recursive_union.cpp recursive_union.h \ param_testCli.h \ $(TAO_ROOT)/tao/corba.h \ diff --git a/TAO/tests/Param_Test/any.cpp b/TAO/tests/Param_Test/any.cpp index 6c90d73237c..1ff1377bcb2 100644 --- a/TAO/tests/Param_Test/any.cpp +++ b/TAO/tests/Param_Test/any.cpp @@ -216,7 +216,7 @@ Test_Any::reset_parameters (void) } break; - case Test_Any::ANY_UNION: + case Test_Any::ANY_BIG_UNION: { CORBA::Long x = gen->gen_long (); Param_Test::Big_Union the_union; @@ -230,7 +230,30 @@ Test_Any::reset_parameters (void) this->in_ >>= bu_in; this->inout_ >>= bu_inout; ACE_DEBUG ((LM_DEBUG, - "Param_Test: ANY_UNION subtest\n" + "Param_Test: ANY_BIG_UNION subtest\n" + " in %d\n" + " inout %d\n", + bu_in->the_long (), + bu_inout->the_long ())); + } + } + break; + + case Test_Any::ANY_SMALL_UNION: + { + CORBA::Long x = gen->gen_long (); + Param_Test::Small_Union the_union; + the_union.the_long (x); + this->in_ <<= the_union; + this->inout_ <<= the_union; + + if (TAO_debug_level > 0) + { + Param_Test::Small_Union *bu_in, *bu_inout; + this->in_ >>= bu_in; + this->inout_ >>= bu_inout; + ACE_DEBUG ((LM_DEBUG, + "Param_Test: ANY_SMALL_UNION subtest\n" " in %d\n" " inout %d\n", bu_in->the_long (), @@ -276,6 +299,7 @@ Test_Any::check_validity (void) Param_Test::Short_Seq *ubss_in, *ubss_inout, *ubss_out, *ubss_ret; Param_Test::Fixed_Struct *fs_in, *fs_inout, *fs_out, *fs_ret; Param_Test::Big_Union *bu_in, *bu_inout, *bu_out, *bu_ret; + Param_Test::Small_Union *su_in, *su_inout, *su_out, *su_ret; if ((this->in_ >>= short_in) && (this->inout_ >>= short_inout) && @@ -407,6 +431,39 @@ Test_Any::check_validity (void) } return 1; } + else if ((this->in_ >>= su_in) && + (this->inout_ >>= su_inout) && + (this->out_.in () >>= su_out) && + (this->ret_.in () >>= su_ret)) + { + if (su_in->_d () != Param_Test::A_LONG + || su_inout->_d () != Param_Test::A_LONG + || su_out->_d () != Param_Test::A_LONG + || su_ret->_d () != Param_Test::A_LONG) + { + ACE_DEBUG ((LM_DEBUG, + "Test_Any - not all unions contain a long\n")); + return 0; + } + + if (su_in->the_long () != su_inout->the_long () + || su_in->the_long () != su_out->the_long () + || su_in->the_long () != su_ret->the_long ()) + { + ACE_DEBUG ((LM_DEBUG, + "Test_Any - values mismatch\n" + " in %d\n" + " inout %d\n" + " out %d\n" + " ret %d\n", + su_in->the_long (), + su_inout->the_long (), + su_out->the_long (), + su_ret->the_long () )); + return 0; + } + return 1; + } else return 0; } diff --git a/TAO/tests/Param_Test/any.h b/TAO/tests/Param_Test/any.h index 6b792a408fb..921aa359526 100644 --- a/TAO/tests/Param_Test/any.h +++ b/TAO/tests/Param_Test/any.h @@ -42,7 +42,8 @@ public: ANY_SHORT_SEQ, ANY_BD_SHORT_SEQ, ANY_STRUCT, - ANY_UNION, + ANY_BIG_UNION, + ANY_SMALL_UNION, ANY_LAST_TEST_ITEM }; diff --git a/TAO/tests/Param_Test/driver.cpp b/TAO/tests/Param_Test/driver.cpp index 7cc48ec6147..645cf856148 100644 --- a/TAO/tests/Param_Test/driver.cpp +++ b/TAO/tests/Param_Test/driver.cpp @@ -72,8 +72,8 @@ Driver::init (int argc, char **argv) ACE_TRY { ACE_OS::strcpy (exception_string, "ORB Initialization"); - - // Retrieve the underlying ORB + + // Retrieve the underlying ORB this->orb_ = CORBA::ORB_init (argc, argv, "internet", @@ -88,7 +88,7 @@ Driver::init (int argc, char **argv) -1); // Retrieve a Param_Test object reference ACE_OS::strcpy (exception_string,"ORB::string_to_object() failed."); - + CORBA::Object_var temp = this->orb_->string_to_object (opt->param_test_ior (), ACE_TRY_ENV); @@ -99,10 +99,10 @@ Driver::init (int argc, char **argv) "ORB::string_to_object() returned null object for IOR <%s>\n", opt->param_test_ior ()), -1); - + // Get the object reference ACE_OS::strcpy (exception_string,"Param_Test::_narrow () failed."); - + this->objref_ = Param_Test::_narrow (temp.in(), ACE_TRY_ENV); ACE_TRY_CHECK; @@ -114,7 +114,7 @@ Driver::init (int argc, char **argv) } ACE_ENDTRY; ACE_CHECK_RETURN (-1); - + return 0; } @@ -557,6 +557,19 @@ Driver::run (void) delete client; } break; + case Options::TEST_SMALL_UNION: + { + Param_Test_Client<Test_Small_Union> *client = new + Param_Test_Client<Test_Small_Union> (this->orb_.in (), + this->objref_.in(), + new Test_Small_Union); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; case Options::TEST_RECURSIVE_UNION: { Param_Test_Client<Test_Recursive_Union> *client = new @@ -654,6 +667,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_Small_Union>; template class Param_Test_Client<Test_Recursive_Union>; template class Param_Test_Client<Test_Complex_Any>; template class Param_Test_Client<Test_Multdim_Array>; @@ -693,6 +707,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_Small_Union> #pragma instantiate Param_Test_Client<Test_Recursive_Union> #pragma instantiate Param_Test_Client<Test_Complex_Any> #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 9e2240cb79e..725e0eeb5e6 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, "small_union")) + this->test_type_ = Options::TEST_SMALL_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")) diff --git a/TAO/tests/Param_Test/options.h b/TAO/tests/Param_Test/options.h index a35e3b3991f..26738972170 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_SMALL_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 ce69c42eae8..8a3471ff0f6 100644 --- a/TAO/tests/Param_Test/param_test.idl +++ b/TAO/tests/Param_Test/param_test.idl @@ -306,6 +306,18 @@ interface Param_Test inout Big_Union u2, out Big_Union u3); + enum Small_Union_Switch { A_LONG, A_SHORT }; + union Small_Union switch (Small_Union_Switch) + { + case A_LONG: + long the_long; + case A_SHORT: + short the_short; + }; + Small_Union test_small_union (in Small_Union u1, + inout Small_Union u2, + out Small_Union u3); + // The following two structs are used to help compose // a complex Any for the test function below. struct level4 diff --git a/TAO/tests/Param_Test/param_test_i.cpp b/TAO/tests/Param_Test/param_test_i.cpp index fbf1f86db35..aafc54f6de4 100644 --- a/TAO/tests/Param_Test/param_test_i.cpp +++ b/TAO/tests/Param_Test/param_test_i.cpp @@ -769,6 +769,7 @@ Param_Test_i::test_any (const CORBA::Any &a1, Param_Test::Bounded_Short_Seq *bd_short_sequence; Param_Test::Fixed_Struct *fixed_structure; Param_Test::Big_Union *big_union; + Param_Test::Small_Union *small_union; a2 = a1; a3 = new CORBA::Any (a1); @@ -884,6 +885,32 @@ Param_Test_i::test_any (const CORBA::Any &a1, bu_out->the_long (), bu_ret->the_long () )); } + else if (a1 >>= small_union) + { + Param_Test::Small_Union *bu_in, *bu_inout, *bu_out, *bu_ret; + a1 >>= bu_in; + + // Insert copies.... + a2 <<= *bu_in; + *a3 <<= *bu_in; + *ret <<= *bu_in; + + // Extract the value to compare... + a2 >>= bu_inout; + *a3 >>= bu_out; + *ret >>= bu_ret; + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "Received Small Union\n" + " in %d\n" + " inout %d\n" + " out %d\n" + " ret %d\n", + bu_in->the_long (), + bu_inout->the_long (), + bu_out->the_long (), + bu_ret->the_long () )); + } else { ACE_DEBUG ((LM_DEBUG, "Received UNKNOWN type\n")); @@ -966,6 +993,18 @@ Param_Test_i::test_big_union (const Param_Test::Big_Union& u1, return ret._retn (); } +Param_Test::Small_Union +Param_Test_i::test_small_union (const Param_Test::Small_Union& u1, + Param_Test::Small_Union& u2, + Param_Test::Small_Union_out u3, + CORBA::Environment &) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + u2 = u1; + u3 = u1; + return u1; +} + Param_Test::Recursive_Union* Param_Test_i::test_recursive_union (const Param_Test::Recursive_Union& ru1, Param_Test::Recursive_Union& ru2, diff --git a/TAO/tests/Param_Test/param_test_i.h b/TAO/tests/Param_Test/param_test_i.h index cfa7443d367..e523a86d71b 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::Small_Union + test_small_union (const Param_Test::Small_Union& u1, + Param_Test::Small_Union& u2, + Param_Test::Small_Union_out u3, + 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, diff --git a/TAO/tests/Param_Test/run_test.pl b/TAO/tests/Param_Test/run_test.pl index 1b6d31605ce..a5ff8189fa1 100755 --- a/TAO/tests/Param_Test/run_test.pl +++ b/TAO/tests/Param_Test/run_test.pl @@ -71,7 +71,7 @@ sub run_test "ub_short_sequence", "ub_long_sequence", "bd_short_sequence", "bd_long_sequence", "fixed_array", "var_array", "typecode", "exception", - "big_union", "recursive_union", "complex_any"); + "big_union", "small_union", "recursive_union", "complex_any"); ACE::checkForTarget($cwd); diff --git a/TAO/tests/Param_Test/small_union.cpp b/TAO/tests/Param_Test/small_union.cpp new file mode 100644 index 00000000000..d2036b5cb41 --- /dev/null +++ b/TAO/tests/Param_Test/small_union.cpp @@ -0,0 +1,208 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Param_Test +// +// = FILENAME +// small_union.cpp +// +// = DESCRIPTION +// tests Small_Unions +// +// = AUTHORS +// Aniruddha Gokhale +// +// ============================================================================ + +#include "helper.h" +#include "small_union.h" + +ACE_RCSID(Param_Test, small_union, "$Id$") + +// ************************************************************************ +// Test_Small_Union +// ************************************************************************ + +size_t Test_Small_Union::counter = 0; + +Test_Small_Union::Test_Small_Union (void) + : opname_ (CORBA::string_dup ("test_small_union")) +{ +} + +Test_Small_Union::~Test_Small_Union (void) +{ + CORBA::string_free (this->opname_); + this->opname_ = 0; +} + +const char * +Test_Small_Union::opname (void) const +{ + return this->opname_; +} + +void +Test_Small_Union::dii_req_invoke (CORBA::Request *req, + CORBA::Environment &ACE_TRY_ENV) +{ + req->add_in_arg ("s1") <<= this->in_; + req->add_inout_arg ("s2") <<= this->inout_; + req->add_out_arg ("s3") <<= this->out_.in (); + + req->set_return_type (Param_Test::_tc_Small_Union); + + req->invoke (ACE_TRY_ENV); + ACE_CHECK; + + Param_Test::Small_Union *tmp; + req->return_value () >>= tmp; + this->ret_ = new Param_Test::Small_Union (*tmp); + + CORBA::NamedValue_ptr o2 = + req->arguments ()->item (1, ACE_TRY_ENV); + ACE_CHECK; + *o2->value () >>= tmp; + this->inout_ = *tmp; + + CORBA::NamedValue_ptr o3 = + req->arguments ()->item (2, ACE_TRY_ENV); + ACE_CHECK; + *o3->value () >>= tmp; + this->out_ = new Param_Test::Small_Union (*tmp); +} + +int +Test_Small_Union::init_parameters (Param_Test_ptr objref, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_TRY + { + // get access to a Coffee Object + this->cobj_ = objref->make_coffee (ACE_TRY_ENV); + ACE_TRY_CHECK; + + this->reset_parameters (); + return 0; + } + ACE_CATCH (CORBA::SystemException, sysex) + { + ACE_PRINT_EXCEPTION (sysex,"System Exception doing make_coffee"); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "An exception caught in make_coffee"); + } + ACE_ENDTRY; + return -1; +} + +int +Test_Small_Union::reset_parameters (void) +{ + Generator *gen = GENERATOR::instance (); // value generator + CORBA::ULong index = (counter++ % 2); + + switch (index) + { + case 0: + { + CORBA::Long l = gen->gen_long (); + this->in_.the_long (l); + this->inout_.the_long (l); + } + break; + default: + case 1: + { + CORBA::Short s = gen->gen_short (); + this->in_.the_short (s); + this->inout_.the_short (s); + } + break; + } + this->out_ = new Param_Test::Small_Union (this->in_); + this->ret_ = new Param_Test::Small_Union (this->in_); + return 0; +} + +int +Test_Small_Union::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_TRY + { + this->ret_ = objref->test_small_union (this->in_, + this->inout_, + this->out_, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + return 0; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Test_Small_Union::run_sii_test\n"); + + } + ACE_ENDTRY; + return -1; +} + +CORBA::Boolean +Test_Small_Union::check_validity (void) +{ + if (this->in_._d () != this->inout_._d () + || this->in_._d () != this->out_->_d () + || this->in_._d () != this->ret_->_d ()) + { + ACE_DEBUG ((LM_DEBUG, "mismatch of discriminators\n")); + return 0; + } + + + switch (this->in_._d ()) + { + case Param_Test::A_LONG: + { + CORBA::Long in = this->in_.the_long (); + CORBA::Long inout = this->inout_.the_long (); + CORBA::Long out = this->out_->the_long (); + CORBA::Long ret = this->ret_->the_long (); + if (in != out || in != inout || in != ret) + return 0; + } + break; + + case Param_Test::A_SHORT: + { + CORBA::Short in = this->in_.the_short (); + CORBA::Short inout = this->inout_.the_short (); + CORBA::Short out = this->out_->the_short (); + CORBA::Short ret = this->ret_->the_short (); + if (in != out || in != inout || in != ret) + return 0; + } + break; + + default: + return 0; + } + + return 1; +} + +CORBA::Boolean +Test_Small_Union::check_validity (CORBA::Request_ptr /*req*/) +{ + //ACE_UNUSED_ARG (req); + return this->check_validity (); +} + +void +Test_Small_Union::print_values (void) +{ +} diff --git a/TAO/tests/Param_Test/small_union.h b/TAO/tests/Param_Test/small_union.h new file mode 100644 index 00000000000..f4b3bc22981 --- /dev/null +++ b/TAO/tests/Param_Test/small_union.h @@ -0,0 +1,85 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Param_Test +// +// = FILENAME +// small_union.h +// +// = DESCRIPTION +// Tests Anys +// +// = AUTHORS +// Aniruddha Gokhale +// +// ============================================================================ + +#ifndef PARAM_TEST_SMALL_UNION_H +#define PARAM_TEST_SMALL_UNION_H + +#include "param_testCli.h" + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test Anys +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +class Test_Small_Union +{ +public: + Test_Small_Union (void); + // ctor + + ~Test_Small_Union (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + 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 + + Coffee_var cobj_; + // Coffee object used to test Small_Union with object. + + static size_t counter; + // test counter. + + Param_Test::Small_Union in_; + // in parameter + + Param_Test::Small_Union inout_; + // inout parameter + + Param_Test::Small_Union_var out_; + // out parameter + + Param_Test::Small_Union_var ret_; + // return value +}; + +#endif /* PARAM_TEST_SMALL_UNION_H */ diff --git a/TAO/tests/Param_Test/tests.h b/TAO/tests/Param_Test/tests.h index 92b2329b877..c042cad74fa 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 "small_union.h" #include "recursive_union.h" #include "complex_any.h" #include "multdim_array.h" |