stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_c_test/src/c_test.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 16:46:38 +0300
changeset 18 47c74d1534e1
parent 0 e4d67989cc36
child 44 97b0fb8a2cc2
child 45 4b03adbd26ca
permissions -rw-r--r--
Revision: 201011 Kit: 201015

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/

#include <string>
#include <iostream>
#include <fstream>
#include <list>


#ifndef STLPORT
//#error You Did not get the STLport include files!
#endif

using namespace std;

int c_test (int/* argc*/, char **/*argv[]*/)
{

	#ifdef STLPORT
	string s2 = "STLport included";
	cout << s2 << endl;
	#else
	string s2 = "STLport NOT included!";
	cout << s2 << endl;
	#endif

	int failures = 0;

	string s = "hello";
	cout << s << endl;
	ofstream fstr("testfile");
	fstr << s << endl;

	list<int> L;
	for (int i = 0; i < 10; ++i) {
	L.push_back(i);
	}
	//for comparing results
	int i = 9;
	for (list<int>::const_reverse_iterator cri = L.rbegin();
	   cri != (list<int>::const_reverse_iterator) L.rend(); ++cri) {
	cout << *cri << endl;
	if(*cri != i)
		failures++;
	i--;
	}
#ifndef __SYMBIAN32__

	#ifdef STLPORT
	string s3 = "PASSED";
	if (strstr(argv[0], "nostlport"))
	s3 = "FAILED";
	cout << s3 << endl;
	#else
	string s3 = "PASSED";
	if (!strstr(argv[0], "nostlport"))
	s3 = "FAILED";
	cout << s3 << endl;
	#endif

#endif
	if (!failures)
    return 0;
  else
    return 1;

}