|
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 remif1_test main |
|
26 #endif |
|
27 static bool odd(int a_) |
|
28 { |
|
29 return a_ % 2; |
|
30 } |
|
31 |
|
32 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
33 using namespace std; |
|
34 #endif |
|
35 int remif1_test(int, char**) |
|
36 { |
|
37 int failures=0; |
|
38 cout<<"Results of remif1_test:"<<endl; |
|
39 |
|
40 int numbers[6] = { 0, 0, 1, 1, 2, 2 }; |
|
41 |
|
42 remove_if((int*)numbers, (int*)numbers + 6, odd); |
|
43 for(int i = 0; i < 6; i++) |
|
44 cout << numbers[i] << ' '; |
|
45 cout << endl; |
|
46 |
|
47 if(0!=numbers[0]) |
|
48 failures++; |
|
49 else if(0!=numbers[1]) |
|
50 failures++; |
|
51 else if(2!=numbers[2]) |
|
52 failures++; |
|
53 else if(2!=numbers[3]) |
|
54 failures++; |
|
55 else if(2!=numbers[4]) |
|
56 failures++; |
|
57 else if(2!=numbers[5]) |
|
58 failures++; |
|
59 |
|
60 if(failures) |
|
61 return 1; |
|
62 else |
|
63 return 0; |
|
64 } |
|
65 |
|
66 |
|
67 |