stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_c_test/src/c_test.cpp
changeset 31 ce057bb09d0b
child 34 5fae379060a7
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     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 #include <string>
       
    19 #include <iostream>
       
    20 #include <fstream>
       
    21 #include <list>
       
    22 
       
    23 
       
    24 #ifndef STLPORT
       
    25 //#error You Did not get the STLport include files!
       
    26 #endif
       
    27 
       
    28 using namespace std;
       
    29 
       
    30 int c_test (int/* argc*/, char **/*argv[]*/)
       
    31 {
       
    32 
       
    33 	#ifdef STLPORT
       
    34 	string s2 = "STLport included";
       
    35 	cout << s2 << endl;
       
    36 	#else
       
    37 	string s2 = "STLport NOT included!";
       
    38 	cout << s2 << endl;
       
    39 	#endif
       
    40 
       
    41 	int failures = 0;
       
    42 
       
    43 	string s = "hello";
       
    44 	cout << s << endl;
       
    45 	ofstream fstr("testfile");
       
    46 	fstr << s << endl;
       
    47 
       
    48 	list<int> L;
       
    49 	for (int i = 0; i < 10; ++i) {
       
    50 	L.push_back(i);
       
    51 	}
       
    52 	//for comparing results
       
    53 	int i = 9;
       
    54 	for (list<int>::const_reverse_iterator cri = L.rbegin();
       
    55 	   cri != (list<int>::const_reverse_iterator) L.rend(); ++cri) {
       
    56 	cout << *cri << endl;
       
    57 	if(*cri != i)
       
    58 		failures++;
       
    59 	i--;
       
    60 	}
       
    61 #ifndef __SYMBIAN32__
       
    62 
       
    63 	#ifdef STLPORT
       
    64 	string s3 = "PASSED";
       
    65 	if (strstr(argv[0], "nostlport"))
       
    66 	s3 = "FAILED";
       
    67 	cout << s3 << endl;
       
    68 	#else
       
    69 	string s3 = "PASSED";
       
    70 	if (!strstr(argv[0], "nostlport"))
       
    71 	s3 = "FAILED";
       
    72 	cout << s3 << endl;
       
    73 	#endif
       
    74 
       
    75 #endif
       
    76 	if (!failures)
       
    77     return 0;
       
    78   else
       
    79     return 1;
       
    80 
       
    81 }
       
    82 
       
    83 
       
    84 
       
    85 
       
    86 
       
    87 
       
    88 
       
    89 
       
    90 
       
    91