summaryrefslogtreecommitdiff
path: root/examples/Export/test.cpp
blob: e447dbec3f52441292fe9a575905f099143dba77 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// $Id$

#include "dll.h"
#include <iostream>

int
ACE_TMAIN (int, ACE_TCHAR *[])
{
  int failure_count = 0;
  test_class my_test_class;

  // Tet out the export of a class.  I don't see
  // How this can fail at runtime (rather it would
  // probably give link errors), but just in case...

  std::cout << "Method Test: ";
  if (my_test_class.method () != RETVAL)
    {
      std::cout << "Failed" << std::endl;
      ++failure_count;
    }
  else
    std::cout << "Succeeded" << std::endl;

  // Test out the export of a function.  Like above,
  // I don't know how this can fail at runtime.

  std::cout << "Function Test: ";
  if (test_function () != RETVAL)
    {
      std::cout << "Failed" << std::endl;
      ++failure_count;
    }
  else
    std::cout << "Succeeded" << std::endl;

  // Also test out the export of data.

  std::cout << "Variable Test: ";
  if (test_variable != RETVAL)
    {
      std::cout << "Failed" << std::endl;
      ++failure_count;
    }
  else
    std::cout << "Succeeded" << std::endl;


  // Test out the ACE_Singleton export by checking to see
  // that we have the same instance pointer as the DLL does.
  // This can fail at runtime.

  std::cout << "Singleton Test: ";
  if (TEST_SINGLETON::instance () != get_dll_singleton ())
    {
      std::cout << "Failed" << std::endl;
      ++failure_count;
    }
  else
    std::cout << "Succeeded" << std::endl;

  // Return the number of failures
  return failure_count;
}