31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <iostream>
|
|
6 |
#include <algorithm>
|
|
7 |
#include <queue>
|
|
8 |
#include <list>
|
|
9 |
|
|
10 |
#ifdef MAIN
|
|
11 |
#define queue1_test main
|
|
12 |
#endif
|
|
13 |
|
|
14 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
15 |
using namespace std;
|
|
16 |
#endif
|
|
17 |
int queue1_test(int, char**)
|
|
18 |
{
|
|
19 |
int failures=0,i=0;
|
|
20 |
int arr[3];
|
|
21 |
cout<<"Results of queue1_test:"<<endl;
|
|
22 |
queue<int, list<int> > q;
|
|
23 |
q.push(42);
|
|
24 |
q.push(101);
|
|
25 |
q.push(69);
|
|
26 |
while(!q.empty())
|
|
27 |
{
|
|
28 |
arr[i]=q.front();
|
|
29 |
cout << q.front() << endl;
|
|
30 |
q.pop();
|
|
31 |
i++;
|
|
32 |
}
|
|
33 |
if(42!=arr[0])
|
|
34 |
failures++;
|
|
35 |
else if(101!=arr[1])
|
|
36 |
failures++;
|
|
37 |
else if(69!=arr[2])
|
|
38 |
failures++;
|
|
39 |
|
|
40 |
if(failures)
|
|
41 |
return 1;
|
|
42 |
else
|
|
43 |
return 0;
|
|
44 |
}
|
|
45 |
|