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
65
66
67
68
69
70
71
72
73
|
// $Id$
// ============================================================================
//
// = LIBRARY
// tests
//
// = FILENAME
// Capabilities_Test.cpp
//
// = DESCRIPTION
// This is a test that makes sure the <ACE_Capabililties> class
// works correctly.
//
// = AUTHOR
// Arturo Montes <mitosys@colomsat.net.co>
//
// ============================================================================
ACE_RCSID(tests, Capabilities_Test, "$Id$")
#if defined(__BORLANDC__) && __BORLANDC__ >= 0x0530
USELIB("..\ace\aced.lib");
//---------------------------------------------------------------------------
#endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */
#include "ace/Capabilities.h"
static int
load_config (void)
{
char *config = "captest.cfg";
ACE_Capabilities caps;
if (caps.getent (config,
"Config") == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"Can't read %s",
config),
1);
int b = 0;
caps.getval ("bool", b);
ACE_DEBUG ((LM_DEBUG,
"bool = %d\n",
b));
int n = 0;
caps.getval ("integer", n);
ACE_DEBUG ((LM_DEBUG,
"integer = %d\n",
n));
ACE_CString s;
caps.getval ("string", s);
ACE_DEBUG ((LM_DEBUG,
"string = %s\n",
s.c_str ()));
return 0;
}
int
main (int argc, char *argv[])
{
ACE_START_TEST (ASYS_TEXT ("Capabilities_Test"));
int result = load_config ();
ACE_END_TEST;
return result;
}
|