equal
deleted
inserted
replaced
|
1 // STLport regression testsuite component. |
|
2 // To compile as a separate example, please #define MAIN. |
|
3 |
|
4 #include <iostream> |
|
5 #include <vector> |
|
6 #include <algorithm> |
|
7 |
|
8 #ifdef MAIN |
|
9 #define vec8_test main |
|
10 #endif |
|
11 |
|
12 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
13 using namespace std; |
|
14 #endif |
|
15 int vec8_test(int, char**) |
|
16 { |
|
17 int failures=0; |
|
18 cout<<"Results of vec8_test:"<<endl; |
|
19 vector<int> v; |
|
20 cout << "capacity = " << v.capacity() << endl; |
|
21 |
|
22 if(0!=v.capacity()) |
|
23 failures++; |
|
24 |
|
25 v.push_back(42); |
|
26 cout << "capacity = " << v.capacity() << endl; |
|
27 |
|
28 if(1!=v.capacity()) |
|
29 failures++; |
|
30 v.reserve(5000); |
|
31 cout << "capacity = " << v.capacity() << endl; |
|
32 |
|
33 if(5000!=v.capacity()) |
|
34 failures++; |
|
35 |
|
36 if(failures) |
|
37 return 1; |
|
38 else |
|
39 return 0; |
|
40 } |
|
41 /*Results of vec8_test: |
|
42 capacity = 0 |
|
43 capacity = 1 |
|
44 capacity = 5000 |
|
45 */ |