2 //=============================================================================
6 * tests unbounded strings
8 * @author Aniruddha Gokhale
10 //=============================================================================
14 #include "ub_string.h"
16 // ************************************************************************
17 // Test_Unbounded_String
18 // ************************************************************************
20 Test_Unbounded_String::Test_Unbounded_String ()
21 : opname_ (CORBA::string_dup ("test_unbounded_string"))
25 Test_Unbounded_String::~Test_Unbounded_String ()
27 CORBA::string_free (this->opname_
);
32 Test_Unbounded_String::opname () const
38 Test_Unbounded_String::init_parameters (Alt_Mapping_ptr
)
40 Generator
*gen
= GENERATOR::instance (); // value generator
42 this->in_
= gen
->gen_string ();
43 this->inout_
= this->in_
.c_str ();
49 Test_Unbounded_String::reset_parameters ()
51 this->inout_
= this->in_
.c_str ();
59 Test_Unbounded_String::run_sii_test (Alt_Mapping_ptr objref
)
63 this->ret_
= objref
->test_unbounded_string (this->in_
,
65 this->out_
);//str_out);
69 catch (const CORBA::Exception
& ex
)
71 ex
._tao_print_exception ("Test_Unbounded_String::run_sii_test\n");
78 Test_Unbounded_String::check_validity ()
80 CORBA::ULong len
= this->in_
.length ();
82 std::string first_half
= this->inout_
.substr (0, len
);
83 std::string second_half
= this->inout_
.substr (len
, len
);
85 return (this->in_
== this->out_
86 && this->in_
== this->ret_
87 && this->inout_
.length () == 2 * len
88 && this->in_
== first_half
89 && this->in_
== second_half
);
93 Test_Unbounded_String::check_validity (CORBA::Request_ptr
)
95 // No need to retrieve anything because, for all the args and
96 // the return, we provided the memory and we own it.
97 return this->check_validity ();
101 Test_Unbounded_String::print_values ()
103 ACE_DEBUG ((LM_DEBUG
,
105 "in with len (%d) = %s\n"
106 "inout with len (%d) = %s\n"
107 "out with len (%d) = %s\n"
108 "ret with len (%d) = %s\n"
112 this->inout_
.length (),
113 this->inout_
.c_str (),
114 this->out_
.length (),
116 this->ret_
.length (),
117 this->ret_
.c_str ()));