Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / examples / ImR / Combined_Service / test.cpp
blob985e5be1557753aa1ff7e30bab75ca937ca62fce
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
27 ORB_var orb = ORB_init (argc, argv);
29 Object_var obj = orb->resolve_initial_references ("Test");
30 test_var test = test::_narrow (obj.in ());
31 assertTrue (!is_nil (test.in ()));
33 Long n = test->get ();
34 Long m = test->get ();
35 assertTrue (m == (n + 1));
37 ACE_DEBUG ((LM_DEBUG, "All tests ran successfully.\n"));
39 return 0;
41 catch (const CORBA::Exception& e)
43 e._tao_print_exception ("test:");
45 return 1;