31
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// STLport regression testsuite component.
|
|
19 |
// To compile as a separate example, please #define MAIN.
|
|
20 |
|
|
21 |
#include <iostream>
|
|
22 |
#include <algorithm>
|
|
23 |
#include <deque>
|
|
24 |
#include <queue>
|
|
25 |
|
|
26 |
#ifdef MAIN
|
|
27 |
#define pqueue1_test main
|
|
28 |
#endif
|
|
29 |
|
|
30 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
31 |
using namespace std;
|
|
32 |
#endif
|
|
33 |
int pqueue1_test(int, char**)
|
|
34 |
{
|
|
35 |
int failures=0,i=0;
|
|
36 |
int arr[3];
|
|
37 |
cout<<"Results of pqueue1_test:"<<endl;
|
|
38 |
priority_queue<int, deque<int>, less<int> > q;
|
|
39 |
q.push(42);
|
|
40 |
q.push(101);
|
|
41 |
q.push(69);
|
|
42 |
while(!q.empty())
|
|
43 |
{
|
|
44 |
arr[i]=q.top();
|
|
45 |
cout << q.top() << endl;
|
|
46 |
q.pop();
|
|
47 |
i++;
|
|
48 |
}
|
|
49 |
|
|
50 |
if(101 !=arr[0])
|
|
51 |
failures++;
|
|
52 |
else if(69 !=arr[1])
|
|
53 |
failures++;
|
|
54 |
else if(42 !=arr[2])
|
|
55 |
failures++;
|
|
56 |
|
|
57 |
if(failures)
|
|
58 |
return 1;
|
|
59 |
else
|
|
60 |
return 0;
|
|
61 |
}
|