Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / examples / ImR / Combined_Service / test.cpp
blob6fe2b8a3ed5c9017bcff0ec29067be20daa9639b
1 // This is a simple test of an ImR using the corba interfaces
3 #include "testC.h"
5 #include "ace/SString.h"
6 #include "ace/Log_Msg.h"
7 #include "ace/OS_NS_stdio.h"
8 #include <stdexcept>
9 #include <string>
11 #define assertTrue(CONDITION) \
12 if (!(CONDITION)) { \
13 ACE_CString str ("Error : "#CONDITION" :"); \
14 char line[32]; \
15 ACE_OS::sprintf (line, "%d", __LINE__); \
16 throw std::runtime_error (str.c_str ()); \
19 using namespace CORBA;
21 int
22 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
24 try
26 ORB_var orb = ORB_init (argc, argv);
28 Object_var obj = orb->resolve_initial_references ("Test");
29 test_var test = test::_narrow (obj.in ());
30 assertTrue (!is_nil (test.in ()));
32 Long n = test->get ();
33 Long m = test->get ();
34 assertTrue (m == (n + 1));
36 ACE_DEBUG ((LM_DEBUG, "All tests ran successfully.\n"));
38 return 0;
40 catch (const CORBA::Exception& e)
42 e._tao_print_exception ("test:");
44 return 1;