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 <iostream> |
|
23 #include <vector> |
|
24 #include <algorithm> |
|
25 |
|
26 #ifdef MAIN |
|
27 #define iter1_test main |
|
28 #endif |
|
29 |
|
30 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
31 using namespace std; |
|
32 #endif |
|
33 int iter1_test(int, char**) |
|
34 { |
|
35 cout<<"Results of iter1_test:"<<endl; |
|
36 int failures = 0; |
|
37 vector<const char*> v; // Vector of character strings. |
|
38 const char* array[2]; |
|
39 int j =0 ; |
|
40 v.push_back((char*) "zippy"); // First element. |
|
41 v.push_back((char*) "motorboy"); // Second element. |
|
42 typedef vector<const char*> vec; |
|
43 vec::iterator i = v.begin(); // Position at end. |
|
44 for(i = v.begin(); i != v.end(); i++) |
|
45 { |
|
46 cout << *i << endl; // Display item. |
|
47 array[j++] = *i; |
|
48 } |
|
49 if(array[0] != "zippy") |
|
50 failures++; |
|
51 if(array[1] != "motorboy") |
|
52 failures++; |
|
53 |
|
54 return failures; |
|
55 } |