blob: 79a134b37e6efa588605b0eb3ac21cd97a6d76d5 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// $Id$
// ============================================================================
//
// = LIBRARY
// tests
//
// = FILENAME
// Vector_Test.cpp
//
// = DESCRIPTION
// This is a simple test of the ACE_Vector class and its iterators.
//
// = AUTHOR
// Gonzalo A. Diethelm <gonzalo.diethelm@aditiva.com>
//
// ============================================================================
#include "test_config.h"
ACE_RCSID(tests, Vector_Test, "$Id$")
#include "ace/Vector_T.h"
typedef int DATA;
typedef ACE_Vector<DATA> VECTOR;
typedef ACE_Vector<DATA>::Iterator ITERATOR;
const int TOP = 100;
const int LEFT = 10;
int main (int, ACE_TCHAR *[])
{
ACE_START_TEST (ACE_TEXT ("Vector_Test"));
VECTOR vector;
int i;
for (i = 0; i < TOP; ++i)
vector.push_back (i);
ACE_ASSERT (vector.size () == TOP);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Size: %d\n"),
vector.size ()));
for (i = (TOP - 1); i >= 0; --i)
ACE_ASSERT (vector[i] == i);
for (i = 0; i < (TOP - LEFT); ++i)
vector.pop_back ();
ACE_ASSERT (vector.size () == LEFT);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Size: %d\n"),
vector.size ()));
for (i = 0; i < LEFT; ++i)
ACE_ASSERT (vector[i] == i);
vector.clear ();
ACE_ASSERT (vector.size () == 0);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Size: %d\n"),
vector.size ()));
ACE_END_TEST;
return 0;
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Vector<DATA>;
template class ACE_Array<DATA>;
template class ACE_Array_Base<DATA>;
template class ACE_Array_Iterator<DATA>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Vector<DATA>
#pragma instantiate ACE_Array<DATA>
#pragma instantiate ACE_Array_Base<DATA>
#pragma instantiate ACE_Array_Iterator<DATA>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
|