diff options
Diffstat (limited to 'TAO/tests/Param_Test/ub_any_seq.cpp')
-rw-r--r-- | TAO/tests/Param_Test/ub_any_seq.cpp | 99 |
1 files changed, 43 insertions, 56 deletions
diff --git a/TAO/tests/Param_Test/ub_any_seq.cpp b/TAO/tests/Param_Test/ub_any_seq.cpp index b71f846c94e..26e160ef039 100644 --- a/TAO/tests/Param_Test/ub_any_seq.cpp +++ b/TAO/tests/Param_Test/ub_any_seq.cpp @@ -20,7 +20,6 @@ #include "ub_any_seq.h" const CORBA::ULong TEST_SEQ_LENGTH = 5; -const CORBA::ULong NUM_TEST_TYPES = 4; ACE_RCSID(Param_Test, ub_any_seq, "$Id$") @@ -67,17 +66,15 @@ Test_AnySeq::init_parameters (Param_Test_ptr objref, for (CORBA::ULong i=0; i < this->in_->length (); i++) { - CORBA::ULong index = - (CORBA::ULong) (gen->gen_short () % NUM_TEST_TYPES); + CORBA::ULong index = (CORBA::ULong) (gen->gen_short () % 4); switch (index) { case 0: { CORBA::Short s; s = gen->gen_short (); - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "setting short = %d\n", s)); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "setting short = %d\n", s)); this->in_[i] <<= s; this->inout_[i] <<= 0; // different from in_ } @@ -86,17 +83,15 @@ Test_AnySeq::init_parameters (Param_Test_ptr objref, { char *str = gen->gen_string (); if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "setting string = %s\n", str)); + ACE_DEBUG ((LM_DEBUG, "setting string = %s\n", str)); this->in_[i] <<= str; this->inout_[i] <<= 0; // different from in_ } break; case 2: { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "setting coffee object \n" )); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "setting coffee object \n" )); ACE_TRY { // get access to a Coffee Object @@ -109,8 +104,7 @@ Test_AnySeq::init_parameters (Param_Test_ptr objref, } ACE_CATCH (CORBA::SystemException, sysex) { - ACE_PRINT_EXCEPTION (sysex, - "System Exception doing make_coffee"); + ACE_PRINT_EXCEPTION (sysex,"System Exception doing make_coffee"); return -1; } ACE_ENDTRY; @@ -118,10 +112,13 @@ Test_AnySeq::init_parameters (Param_Test_ptr objref, break; case 3: if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "setting constant string \n" )); - this->in_[i] <<= "Const string"; - this->inout_[i] <<= 0; // different from in_ + ACE_DEBUG ((LM_DEBUG, "setting constant string \n" )); + this->in_[i] <<= "Const string"; + this->inout_[i] <<= 0; // different from in_ + break; + case 4: + break; + case 5: break; } } @@ -136,8 +133,7 @@ Test_AnySeq::reset_parameters (void) for (CORBA::ULong i=0; i < this->in_->length (); i++) { - CORBA::ULong index = - (CORBA::ULong) (gen->gen_long () % NUM_TEST_TYPES); + CORBA::ULong index = (CORBA::ULong) (gen->gen_long () % 4); switch (index) { @@ -162,8 +158,12 @@ Test_AnySeq::reset_parameters (void) } break; case 3: - this->in_[i] <<= "Const string"; - this->inout_[i] <<= "Const string"; + this->in_[i] <<= "Const string"; + this->inout_[i] <<= "Const string"; + break; + case 4: + break; + case 5: break; } } @@ -181,7 +181,7 @@ Test_AnySeq::run_sii_test (Param_Test_ptr objref, this->inout_.inout (), out, ACE_TRY_ENV); - return (ACE_TRY_ENV.exception () ? -1 : 0); + return (ACE_TRY_ENV.exception () ? -1:0); } int @@ -241,61 +241,49 @@ Test_AnySeq::check_validity (void) (this->out_[i] >>= short_out) && (this->ret_[i] >>= short_ret)) { - ACE_DEBUG ((LM_DEBUG, - "Received shorts: in = %d, " + ACE_DEBUG ((LM_DEBUG, "Received shorts: in = %d, " "inout = %d, out = %d, ret = %d\n", - short_in, - short_inout, - short_out, - short_ret)); - - if ((short_in != short_inout) || - (short_in != short_out) || - (short_in != short_ret)) + short_in, short_inout, short_out, short_ret)); + + if ((short_in == short_inout) && + (short_in == short_out) && + (short_in == short_ret)) + return 1; + else { - ACE_DEBUG ((LM_DEBUG, - "mismatch of short values\n")); + ACE_DEBUG ((LM_DEBUG, "mismatch of short values\n")); return 0; } - else - continue; } else if ((this->in_[i] >>= str_in) && (this->inout_[i] >>= str_inout) && (this->out_[i] >>= str_out) && (this->ret_[i] >>= str_ret)) { - if (ACE_OS::strcmp (str_in, str_inout) || - ACE_OS::strcmp (str_in, str_out) || - ACE_OS::strcmp (str_in, str_ret)) + if (!ACE_OS::strcmp (str_in, str_inout) && + !ACE_OS::strcmp (str_in, str_out) && + !ACE_OS::strcmp (str_in, str_ret)) + return 1; + else { - ACE_DEBUG ((LM_DEBUG, - "mismatch of string values\n")); + ACE_DEBUG ((LM_DEBUG, "mismatch of string values\n")); return 0; } - else - continue; } else if ((this->in_[i] >>= obj_in) && (this->inout_[i] >>= obj_inout) && (this->out_[i] >>= obj_out) && (this->ret_[i] >>= obj_ret)) { - if (!(obj_in->_is_equivalent (obj_inout)) || - !(obj_in->_is_equivalent (obj_out)) || - !(obj_in->_is_equivalent (obj_ret))) - { - ACE_DEBUG ((LM_DEBUG, - "mismatch of Coffee values\n")); - return 0; - } + // all the >>= operators returned true so we are OK. + return 1; } else - continue; + return 0; } - // Everything checks out. - return 1; + // Should never reach this. + return 0; } CORBA::Boolean @@ -349,6 +337,5 @@ Test_AnySeq::print_sequence (const Param_Test::AnySeq &s) "\td = %f\n", i, vs.l, vs.c, vs.s, vs.o, vs.f, vs.b, vs.d)); - */ - } + */ } } |