Update contrib.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\buffer\t_versio.cpp
16 // Test the version information class.
20 // - Test the version name for different versions as expected.
21 // - Compare the major, minor, build version number of current version and
22 // specified version and verify that error message is popped when version
24 // Platforms/Drives/Compatibility:
26 // Assumptions/Requirement/Pre-requisites:
27 // Failures and causes:
28 // Base Port information:
34 const TInt KNumTVersions=1+3*3*3;
36 class RTvTest : public RTest
42 void Start(const TDesC &aHeading) {Printf(aHeading);Push();}
44 TBool QVS(TInt i,TInt j);
46 TVersion* iTV[KNumTVersions];
47 TVersion iDefTV; // tests default constructor
50 LOCAL_D const TText* Names[]=
86 : RTest(_L("T_VERSIO"))
100 iTV[i++]=new TVersion(major,minor,build);
103 build=(build==1? 999: 1);
107 minor=(minor==1? 99: 1);
111 major=(major==1? 99: 1);
115 void RTvTest::TestName()
117 // Test the version name
121 Next(_L("Testing TVersion::Name()"));
122 for (TInt i=0; i<KNumTVersions; i++)
124 TPtrC Name=(TPtrC)Names[i];
125 if (iTV[i]->Name().Compare(Name))
130 TBool RTvTest::QVS(TInt aCurrent,TInt aRequested)
132 // An independent calculation of what QueryVersionSupported should return
142 return(aCurrent>=aRequested);
145 void RTvTest::TestQVS()
147 // Check QueryVersionSupported()
151 Next(_L("Testing User::QueryVersionSupported()"));
152 for (TInt i=0; i<KNumTVersions; i++)
154 for (TInt j=0; j<KNumTVersions; j++)
156 if (User::QueryVersionSupported(*iTV[i],*iTV[j])!=QVS(i,j))
157 Panic(_L("Query version supported failed"));
162 GLDEF_C TInt E32Main()
164 // Test TVersion class.
170 test.Start(_L("Testing TVersion\n"));
173 test.Printf(_L("TVersion passed testing\n"));