equal
deleted
inserted
replaced
|
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 <queue> |
|
24 #include <deque> |
|
25 #include <stack> |
|
26 |
|
27 |
|
28 #ifdef MAIN |
|
29 #define stack1_test main |
|
30 #endif |
|
31 |
|
32 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
33 using namespace std; |
|
34 #endif |
|
35 int stack1_test(int, char**) |
|
36 { |
|
37 int failures=0,i=0; |
|
38 int arr[3]; |
|
39 cout<<"Results of stack1_test:"<<endl; |
|
40 stack<int, deque<int> > s; |
|
41 s.push(42); |
|
42 s.push(101); |
|
43 s.push(69); |
|
44 while(!s.empty()) |
|
45 { |
|
46 arr[i]=s.top(); |
|
47 cout << s.top() << endl; |
|
48 s.pop(); |
|
49 i++; |
|
50 } |
|
51 |
|
52 if(69!=arr[0]) |
|
53 failures++; |
|
54 else if(101!=arr[1]) |
|
55 failures++; |
|
56 else if(42!=arr[2]) |
|
57 failures++; |
|
58 |
|
59 if(failures) |
|
60 return 1; |
|
61 else |
|
62 return 0; |
|
63 } |