ACE+TAO-6_5_14
[ACE_TAO.git] / TAO / tests / Param_Test / ulonglong.cpp
blob25d28f270681b13e099c312ef3660d453eb2068b
2 //=============================================================================
3 /**
4 * @file ulonglong.cpp
6 * tests 64 bit longs
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
13 #include "helper.h"
14 #include "ulonglong.h"
16 Test_ULongLong::Test_ULongLong (void)
17 : opname_ (CORBA::string_dup ("test_ulonglong"))
21 Test_ULongLong::~Test_ULongLong (void)
23 CORBA::string_free (this->opname_);
24 this->opname_ = 0;
27 const char *
28 Test_ULongLong::opname (void) const
30 return this->opname_;
33 void
34 Test_ULongLong::dii_req_invoke (CORBA::Request *req)
36 req->add_in_arg ("s1") <<= this->in_;
37 req->add_inout_arg ("s2") <<= this->inout_;
38 req->add_out_arg ("s3") <<= this->out_;
40 req->set_return_type (CORBA::_tc_ulonglong);
42 req->invoke ();
44 req->return_value () >>= this->ret_;
46 CORBA::NamedValue_ptr o2 =
47 req->arguments ()->item (1);
48 *o2->value () >>= this->inout_;
50 CORBA::NamedValue_ptr o3 =
51 req->arguments ()->item (2);
52 *o3->value () >>= this->out_;
55 int
56 Test_ULongLong::init_parameters (Param_Test_ptr)
58 Generator *gen = GENERATOR::instance (); // value generator
60 this->in_ = gen->gen_long ();
61 this->inout_ = 0;
62 return 0;
65 int
66 Test_ULongLong::reset_parameters (void)
68 this->inout_ = 0;
69 this->out_ = 0;
70 this->ret_ = 0;
71 return 0;
74 int
75 Test_ULongLong::run_sii_test (Param_Test_ptr objref)
77 try
79 this->ret_ = objref->test_ulonglong (this->in_,
80 this->inout_,
81 this->out_);
84 return 0;
86 catch (const CORBA::Exception& ex)
88 ex._tao_print_exception ("Test_ULongLong::run_sii_test\n");
91 return -1;
94 CORBA::Boolean
95 Test_ULongLong::check_validity (void)
97 if (this->inout_ == this->in_ * 2 &&
98 this->out_ == this->in_ * 3 &&
99 this->ret_ == this->in_ * 4)
100 return 1; // success
101 else
102 return 0;
105 CORBA::Boolean
106 Test_ULongLong::check_validity (CORBA::Request_ptr )
108 return this->check_validity ();
111 void
112 Test_ULongLong::print_values (void)
114 ACE_DEBUG ((LM_DEBUG,
115 "\n=*=*=*=*=*=*\n"
116 "in = %Q, "
117 "inout = %Q, "
118 "out = %Q, "
119 "ret = %Q\n"
120 "\n=*=*=*=*=*=*\n",
121 this->in_,
122 this->inout_,
123 this->out_,
124 this->ret_));