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 <algorithm> |
|
22 #include <iostream> |
|
23 |
|
24 #ifdef MAIN |
|
25 #define mkheap0_test main |
|
26 #endif |
|
27 |
|
28 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
29 using namespace std; |
|
30 #endif |
|
31 int mkheap0_test(int, char**) |
|
32 { |
|
33 cout<<"Results of mkheap0_test:"<<endl; |
|
34 int numbers[6] = { 5, 10, 4, 13, 11, 19 }; |
|
35 int array[6]; |
|
36 int failures = 0,a = 0; |
|
37 make_heap(numbers, numbers + 6); |
|
38 for(int i = 6; i >= 1; i--) |
|
39 { |
|
40 cout << numbers[0] << endl; |
|
41 array[a++] = numbers[0]; |
|
42 pop_heap(numbers, numbers + i); |
|
43 } |
|
44 if(array[0] != 19) |
|
45 failures++; |
|
46 if(array[1] != 13) |
|
47 failures++; |
|
48 if(array[2] != 11) |
|
49 failures++; |
|
50 if(array[3] != 10) |
|
51 failures++; |
|
52 if(array[4] != 5) |
|
53 failures++; |
|
54 if(array[5] != 4) |
|
55 failures++; |
|
56 |
|
57 |
|
58 return failures; |
|
59 } |