summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/ImR/Combined_Service/test.cpp
blob: 1605d2caf21d4a7a6d8f76a8ad7467d3bfd65766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// $Id$
// This is a simple test of an ImR using the corba interfaces

#include "testC.h"

#include <stdexcept>
#include <sstream>

#define assertTrue(CONDITION) \
    if (CONDITION == false) { \
    std::ostringstream oss; \
      oss << "Error : "#CONDITION" "__FILE__":" << __LINE__; \
      throw std::runtime_error(oss.str()); \
    } \

using namespace CORBA;

int main(int argc, char* argv[]) {

  try {
 
    ORB_var orb = ORB_init(argc, argv);

    Object_var obj = orb->resolve_initial_references("Test");
    test_var test = test::_narrow(obj.in());
    assertTrue(! is_nil(test.in()));

    Long n = test->get();
    Long m = test->get();
    assertTrue(m == n + 1);
 
    ACE_DEBUG((LM_DEBUG, "All tests ran successfully.\n"));

    return 0;
  } catch (CORBA::Exception& e) {
    ACE_PRINT_EXCEPTION(e, "test:");
  }
  return 1;
}