31
|
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 <slist>
|
|
23 |
#include <iterator>
|
|
24 |
|
|
25 |
#ifdef MAIN
|
|
26 |
#define slist1_test main
|
|
27 |
#endif
|
|
28 |
|
|
29 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
30 |
using namespace std;
|
|
31 |
#endif
|
|
32 |
|
|
33 |
int slist1_test(int, char**)
|
|
34 |
{
|
|
35 |
cout<<"Results of slist1_test:"<<endl;
|
|
36 |
char array [] = { 'x', 'l', 'x', 't', 's', 's' };
|
|
37 |
ostream_iterator<char> o(cout,"");
|
|
38 |
slist<char> str(array+0, array + 6);
|
|
39 |
std::slist<char>::iterator i;
|
|
40 |
cout << "original: ";
|
|
41 |
copy(str.begin(), str.end(),o);
|
|
42 |
cout << endl;
|
|
43 |
cout << "reversed: ";
|
|
44 |
str.reverse();
|
|
45 |
for(i = str.begin(); i != str.end(); i++)
|
|
46 |
cout << *i;
|
|
47 |
cout << endl;
|
|
48 |
cout << "removed: ";
|
|
49 |
str.remove('x');
|
|
50 |
for(i = str.begin(); i != str.end(); i++)
|
|
51 |
cout << *i;
|
|
52 |
cout << endl;
|
|
53 |
cout << "uniqued: ";
|
|
54 |
str.unique();
|
|
55 |
for(i = str.begin(); i != str.end(); i++)
|
|
56 |
cout << *i;
|
|
57 |
cout << endl;
|
|
58 |
cout << "sorted: ";
|
|
59 |
str.sort();
|
|
60 |
for(i = str.begin(); i != str.end(); i++)
|
|
61 |
cout << *i;
|
|
62 |
cout << endl;
|
|
63 |
return 0;
|
|
64 |
}
|