31
|
1 |
|
|
2 |
|
|
3 |
// STLport regression testsuite component.
|
|
4 |
// To compile as a separate example, please #define MAIN.
|
|
5 |
|
|
6 |
#include <iostream>
|
|
7 |
#include <deque>
|
|
8 |
#include <algorithm>
|
|
9 |
|
|
10 |
|
|
11 |
#ifdef MAIN
|
|
12 |
#define alg5_test main
|
|
13 |
#endif
|
|
14 |
|
|
15 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
16 |
using namespace std;
|
|
17 |
#endif
|
|
18 |
int alg5_test(int, char**)
|
|
19 |
{
|
|
20 |
|
|
21 |
cout<<"Results of alg5_test:"<<endl;
|
|
22 |
int failures = 0;
|
|
23 |
//result array
|
|
24 |
int res_arr[4] = { 1962, 1992, 2001, 1999};
|
|
25 |
|
|
26 |
deque<int> years;
|
|
27 |
years.push_back(1962);
|
|
28 |
years.push_back(1992);
|
|
29 |
years.push_back(2001);
|
|
30 |
years.push_back(1999);
|
|
31 |
deque<int>::iterator i;
|
|
32 |
int j = 0;
|
|
33 |
for(i = years.begin(); i != years.end(); i++, j++)
|
|
34 |
{
|
|
35 |
cout << *i << endl;
|
|
36 |
if (*i != res_arr[j])
|
|
37 |
failures++;
|
|
38 |
}
|
|
39 |
|
|
40 |
if (!failures)
|
|
41 |
return 0;
|
|
42 |
else
|
|
43 |
return 1;
|
|
44 |
}
|