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 |
|
19 // STLport regression testsuite component. |
|
20 // To compile as a separate example, please #define MAIN. |
|
21 |
|
22 #include <vector> |
|
23 #include <algorithm> |
|
24 #include <iostream> |
|
25 |
|
26 #ifdef MAIN |
|
27 #define equal1_test main |
|
28 #endif |
|
29 |
|
30 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
31 using namespace std; |
|
32 #endif |
|
33 int equal1_test(int, char**) |
|
34 { |
|
35 |
|
36 cout<<"Results of equal1_test:"<<endl; |
|
37 vector <int> v1(10); |
|
38 for(int i = 0; i < v1.size(); i++) |
|
39 v1[i] = i; |
|
40 vector <int> v2(10); |
|
41 |
|
42 int failures = 0; |
|
43 if(equal(v1.begin(), v1.end(), v2.begin())) |
|
44 { |
|
45 cout << "v1 is equal to v2" << endl; |
|
46 failures++; |
|
47 } |
|
48 else |
|
49 { |
|
50 cout << "v1 is not equal to v2" << endl; |
|
51 } |
|
52 copy(v1.begin(), v1.end(), v2.begin()); |
|
53 if(equal(v1.begin(), v1.end(), v2.begin())) |
|
54 { |
|
55 cout << "v1 is equal to v2" << endl; |
|
56 } |
|
57 else |
|
58 { |
|
59 cout << "v1 is not equal to v2" << endl; |
|
60 failures++; |
|
61 } |
|
62 |
|
63 if(!failures) |
|
64 return 0; |
|
65 else |
|
66 return 1; |
|
67 |
|
68 } |