os/kernelhwsrv/kerneltest/e32test/buffer/t_lex.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/buffer/t_lex.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1550 @@
     1.4 +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\buffer\t_lex.cpp
    1.18 +// Overview:
    1.19 +// Test TLex and TLexMark classes.
    1.20 +// API Information:
    1.21 +// TLex, TLexMark.
    1.22 +// Details:
    1.23 +// - For Unicode, non Unicode and build independent variant of TLex class
    1.24 +// - Test that string-parsing methods are present.
    1.25 +// - Test the constructors with no parameter, by a string, with an empty TLex class, 
    1.26 +// non-empty TLex class is as expected.
    1.27 +// - Test assignment operator of TLex, by initializing with TLex reference, string, 
    1.28 +// TBuf reference and check it is as expected.
    1.29 +// - Check that Eos, Inc, Mark, Get, Peek, UnGet, SkipSpace, SkipSpaceAndMark, 
    1.30 +// SkipCharacters, TokenLength, MarkedToken methods are as expected.
    1.31 +// - Initialize Lex string, assign different values, Parse to extract signed, 
    1.32 +// unsigned integer of different lengths, using specified radix and verify 
    1.33 +// that the return value is KErrNone when a valid string is parsed, KErrGeneral 
    1.34 +// when invalid string is parsed, KErrOverflow when converted value is greater 
    1.35 +// than the limit. 
    1.36 +// - Refresh the contents with the system's locale settings, separate whole number from 
    1.37 +// it's fractional part, change locale settings then parse a 64-bit floating point 
    1.38 +// number and check that results are as expected.
    1.39 +// Platforms/Drives/Compatibility:
    1.40 +// All 
    1.41 +// Assumptions/Requirement/Pre-requisites:
    1.42 +// Failures and causes:
    1.43 +// Base Port information:
    1.44 +// 
    1.45 +//
    1.46 +
    1.47 +#include <e32test.h>
    1.48 +
    1.49 +LOCAL_D RTest test(_L("T_LEX")); 
    1.50 +
    1.51 +struct TLexMark8Dump
    1.52 +	{
    1.53 +	const TUint8* iPtr;
    1.54 +	};
    1.55 +
    1.56 +struct TLexMark16Dump
    1.57 +	{
    1.58 +	const TUint16* iPtr;
    1.59 +	};
    1.60 +
    1.61 +void TLexMark8::__DbgTest(void *pTLexMark8Dump) const 
    1.62 +	{
    1.63 +	((TLexMark8Dump*)pTLexMark8Dump)->iPtr=iPtr;
    1.64 +	}
    1.65 +
    1.66 +void TLexMark16::__DbgTest(void *pTLexMark16Dump) const 
    1.67 +	{
    1.68 +	((TLexMark16Dump*)pTLexMark16Dump)->iPtr=iPtr;
    1.69 +	}
    1.70 +
    1.71 +struct TLex8Dump
    1.72 +	{
    1.73 +	const TUint8* iNext;
    1.74 +	const TUint8* iBuf;
    1.75 +	const TUint8* iEnd;
    1.76 +	TLexMark8Dump iMark;
    1.77 +	};
    1.78 +
    1.79 +struct TLex16Dump
    1.80 +	{
    1.81 +	const TUint16* iNext;
    1.82 +	const TUint16* iBuf;
    1.83 +	const TUint16* iEnd;
    1.84 +	TLexMark16Dump iMark;
    1.85 +	};
    1.86 +
    1.87 +
    1.88 +void TLex8::__DbgTest(void* pTLex8Dump) const
    1.89 +	{
    1.90 +	((TLex8Dump*)pTLex8Dump)->iNext=iNext;
    1.91 +	((TLex8Dump*)pTLex8Dump)->iBuf=iBuf;
    1.92 +	((TLex8Dump*)pTLex8Dump)->iEnd=iEnd;
    1.93 +	iMark.__DbgTest(&((TLex8Dump*)pTLex8Dump)->iMark);
    1.94 +	}
    1.95 +
    1.96 +void TLex16::__DbgTest(void* pTLex16Dump) const
    1.97 +	{
    1.98 +	((TLex16Dump*)pTLex16Dump)->iNext=iNext;
    1.99 +	((TLex16Dump*)pTLex16Dump)->iBuf=iBuf;
   1.100 +	((TLex16Dump*)pTLex16Dump)->iEnd=iEnd;
   1.101 +	iMark.__DbgTest(&((TLex16Dump*)pTLex16Dump)->iMark);
   1.102 +	}
   1.103 +
   1.104 +
   1.105 +LOCAL_C	void TestDes(const TUint16* start1, const TUint16* start2, const TUint16* end1, const TUint16* end2)
   1.106 +	{
   1.107 +	TPtrC16 des1(start1, end1-start1);
   1.108 +	TPtrC16 des2(start2, end2-start2);
   1.109 +	test(des1==des2);
   1.110 +	}
   1.111 +LOCAL_C	void TestDes(const TUint8* start1, const TUint8* start2, const TUint8* end1, const TUint8* end2)
   1.112 +	{
   1.113 +	TPtrC8 des1(start1, end1-start1);
   1.114 +	TPtrC8 des2(start2, end2-start2);
   1.115 +	test(des1==des2);
   1.116 +	}
   1.117 +LOCAL_C void TestDes(const TUint16* start, const TUint16* end, const TUint16* string)
   1.118 +	{
   1.119 +	TPtrC16 des1(start, end-start);
   1.120 +	TPtrC16 des2(string);
   1.121 +	test(des1==des2);
   1.122 +	}
   1.123 +LOCAL_C void TestDes(const TUint8* start, const TUint8* end, const TUint8* string)
   1.124 +	{
   1.125 +	TPtrC8 des1(start, end-start);
   1.126 +	TPtrC8 des2(string);
   1.127 +	test(des1==des2);
   1.128 +	}
   1.129 +
   1.130 +
   1.131 +void _LL(TText8 array[], TText8 string[])
   1.132 +	{
   1.133 +
   1.134 +	TInt index=0;
   1.135 +	for(;string[index]; index++)
   1.136 +		array[index]=string[index];
   1.137 +	array[index]='\0';
   1.138 +	}		
   1.139 +
   1.140 +void _LL(TText16 array[], TText8 string[])
   1.141 +	{
   1.142 +
   1.143 +	TInt index=0;
   1.144 +	for(;string[index]; index++)
   1.145 +		array[index]=string[index];
   1.146 +	array[index]='\0';
   1.147 +	}
   1.148 +  
   1.149 +template<class TDesType, class TLexType, class TLexMarkType, class TBufType, class DumpType, class MarkDumpType, class S>
   1.150 +class TestTLex
   1.151 +	{
   1.152 +public:
   1.153 +	void Test1();
   1.154 +	void Test2();
   1.155 +	void Test3();
   1.156 +	void Test4();
   1.157 +	void Test5();
   1.158 +protected:
   1.159 +	void TestList(TLexType* object, TUint param, ...);
   1.160 +	};
   1.161 +
   1.162 +
   1.163 +//*********************************
   1.164 +// Test that methods are in the DLL
   1.165 +//*********************************
   1.166 +template<class TDesType, class TLexType, class TLexMarkType, class TBufType, class DumpType, class MarkDumpType, class S>
   1.167 +GLDEF_C void TestTLex<TDesType, TLexType, TLexMarkType, TBufType, DumpType, MarkDumpType, S>::Test1()
   1.168 +	{
   1.169 +	test.Start(_L("Constructors"));
   1.170 +	S String[100];
   1.171 +	_LL(&String[0], (TText8*)"hello");
   1.172 +	TBufType aTBufObject;
   1.173 +	TLexType a;								
   1.174 +	TLexType b(a);						   
   1.175 +	TLexType c(&String[0]);					
   1.176 +	TLexType d(aTBufObject);
   1.177 +    d.Offset(); // Avoids 'unused' warning
   1.178 +	TLexMarkType mark;
   1.179 +
   1.180 +	test.Next(_L("Assignment operations"));
   1.181 +	a=b;							
   1.182 +	a=&String[0];					
   1.183 +	a=aTBufObject;					
   1.184 +
   1.185 +	test.Next(_L("Assorted"));
   1.186 +	c.Eos();
   1.187 +	c.Mark(mark);
   1.188 +	c.Mark();
   1.189 +	c.Inc();
   1.190 +	c.Get();
   1.191 +	(S)c.Peek();
   1.192 +	c.UnGet();
   1.193 +	c.UnGetToMark(mark);
   1.194 +	c.UnGetToMark();
   1.195 +	c.SkipSpace();
   1.196 +	c.SkipSpaceAndMark(mark);
   1.197 +	c.SkipSpaceAndMark();
   1.198 +	c.SkipCharacters();
   1.199 +	c.TokenLength(mark);
   1.200 +	c.TokenLength();
   1.201 +	aTBufObject=c.MarkedToken(mark);
   1.202 +	aTBufObject=c.MarkedToken();
   1.203 +	aTBufObject=c.NextToken();
   1.204 +	aTBufObject=c.Remainder();
   1.205 +	aTBufObject=c.RemainderFromMark(mark);
   1.206 +	aTBufObject=c.RemainderFromMark();
   1.207 +	c.Offset();
   1.208 +	c.MarkedOffset(mark);
   1.209 +	c.MarkedOffset();
   1.210 +
   1.211 +	test.Next(_L("Val"));  
   1.212 +	TInt TI=1;
   1.213 +	c.Val(TI);
   1.214 +	TInt8 TI8='a';
   1.215 +	c.Val(TI8);
   1.216 +	TInt16 TI16=1;
   1.217 +	c.Val(TI16);
   1.218 +	TInt32 TI32=1;
   1.219 +	c.Val(TI32);
   1.220 +	TInt64 TI64=1;
   1.221 +	c.Val(TI64);
   1.222 +	TUint TU=1;
   1.223 +	c.Val(TU);
   1.224 +	TReal32 TR32=1.0F;
   1.225 +	c.Val(TR32);
   1.226 +	TReal64 TR64=1.0;
   1.227 +	c.Val(TR64);
   1.228 +	TUint8 TU8='a';
   1.229 +	TUint32 TU32=1;
   1.230 +	TRadix TR=(TRadix)EDecimal;
   1.231 +	TUint16 TU16=1;
   1.232 +
   1.233 +	c.Val(TU8, TR);
   1.234 +	c.Val(TU16, TR);  	
   1.235 +	c.BoundedVal(TI32, TU);
   1.236 +	c.BoundedVal(TU32, TR, TU);
   1.237 +	c.BoundedVal(TI64, TR, TU);
   1.238 +
   1.239 +	test.Next(_L("Assign"));
   1.240 +	c.Assign(b);
   1.241 +	c.Assign(&String[0]);
   1.242 +	c.Assign(aTBufObject);	
   1.243 +
   1.244 +	test.Next(_L("Test Dumps"));
   1.245 +	MarkDumpType mDump;
   1.246 +	mark.__DbgTest(&mDump);
   1.247 +
   1.248 +	DumpType dump;
   1.249 +	c.__DbgTest(&dump);
   1.250 +	test.End();
   1.251 +	} 
   1.252 +		
   1.253 +
   1.254 +///////////////////////////////////////
   1.255 +// Test calling Convert() with  a list
   1.256 +///////////////////////////////////////
   1.257 +template<class TDesType, class TLexType, class TLexMarkType, class TBufType, class DumpType, class MarkDumpType, class S>
   1.258 +GLDEF_C void TestTLex<TDesType, TLexType, TLexMarkType, TBufType, DumpType, MarkDumpType, S>::TestList(TLexType *object, TUint param, ...)
   1.259 +	{
   1.260 +	VA_LIST l;
   1.261 +	TBufType b;
   1.262 +
   1.263 +	VA_START(l, param);
   1.264 +	object->Convert(b, l);
   1.265 +	}
   1.266 +
   1.267 +
   1.268 +/////////////////////////
   1.269 +// Test the constructors
   1.270 +////////////////////////
   1.271 +template<class TDesType, class TLexType, class TLexMarkType, class TBufType, class DumpType, class MarkDumpType, class S>
   1.272 +GLDEF_C void TestTLex<TDesType, TLexType, TLexMarkType, TBufType, DumpType, MarkDumpType, S>::Test2()
   1.273 +	{
   1.274 +	// Test constructors  NOTE: there's no getters for iMark or iBuf
   1.275 +	DumpType dump, dump2;
   1.276 +	S String[40];
   1.277 +
   1.278 +	test.Start(_L("Constructors:"));	// TLexx::TLexx()
   1.279 +	test.Next(_L("By default"));
   1.280 +	TLexType a; 
   1.281 +	a.__DbgTest(&dump);
   1.282 +	test(dump.iBuf==NULL);
   1.283 + 	
   1.284 +	test.Next(_L("By string"));		 	// TLexx::TLexx(const TUintx*)
   1.285 +	_LL(&String[0], (TText8*)"AB");
   1.286 +	TLexType b(&String[0]);
   1.287 +	b.__DbgTest(&dump);
   1.288 +	TestDes(dump.iNext, dump.iEnd, &String[0]);
   1.289 +	TestDes(dump.iBuf, dump.iEnd, &String[0]);
   1.290 +	TestDes(dump.iMark.iPtr, dump.iEnd, &String[0]);
   1.291 +
   1.292 +	test.Next(_L("By TLex reference"));	// TLexx::TLexx(const TLexx&)
   1.293 +	// Test with an empty class
   1.294 +	TLexType c, d(c);
   1.295 +	c.__DbgTest(&dump);
   1.296 +	d.__DbgTest(&dump2);
   1.297 +	TestDes(dump.iNext, dump2.iNext, dump.iEnd, dump2.iEnd);
   1.298 +	test(dump.iBuf==NULL);
   1.299 +	test(dump.iBuf==dump2.iBuf); 
   1.300 +	TestDes(dump.iMark.iPtr, dump2.iMark.iPtr, dump.iEnd, dump2.iEnd);
   1.301 +
   1.302 +	//Test with a non empty class
   1.303 +	_LL(&String[0], (TText8*)"XYZ");
   1.304 +	TLexType e(&String[0]), f(e);
   1.305 +	e.__DbgTest(&dump);
   1.306 +	f.__DbgTest(&dump2);
   1.307 +	TestDes(dump.iNext, dump.iEnd, &String[0]);
   1.308 +	TestDes(dump.iNext, dump2.iNext, dump.iEnd, dump2.iEnd);
   1.309 +	TestDes(dump.iBuf, dump2.iBuf, dump.iEnd, dump2.iEnd);
   1.310 +	TestDes(dump.iMark.iPtr, dump2.iMark.iPtr, dump.iEnd, dump2.iEnd);
   1.311 +	
   1.312 +	test.Next(_L("By TBuf reference"));	//TLexx::TLexx(const TBufBasex&)
   1.313 +	_LL(&String[0], (TText8*)"Hello");
   1.314 +	TBufType aBuf(&String[0]);
   1.315 +	TLexType g(aBuf);
   1.316 +	g.__DbgTest(&dump);
   1.317 +	TestDes(dump.iNext, dump.iEnd, &String[0]);
   1.318 +	TestDes(dump.iBuf, dump.iEnd, &String[0]);
   1.319 +	TestDes(dump.iMark.iPtr, dump.iEnd, &String[0]);
   1.320 +
   1.321 +	test.End();
   1.322 +	}
   1.323 +
   1.324 +
   1.325 +//*********************************
   1.326 +// Test the = methods
   1.327 +//*********************************
   1.328 +template<class TDesType, class TLexType, class TLexMarkType, class TBufType, class DumpType, class MarkDumpType, class S>
   1.329 +GLDEF_C void TestTLex<TDesType, TLexType, TLexMarkType, TBufType, DumpType, MarkDumpType, S>::Test3()
   1.330 +	{
   1.331 +	DumpType dump, dump2;
   1.332 +	S String[40];
   1.333 +
   1.334 +	test.Start(_L("= operators"));
   1.335 +	test.Next(_L("by TLex reference"));	//TLexx::operator=(const TLexx&)
   1.336 +	_LL(&String[0], (TText8*)"MNO");
   1.337 +	TLexType a(&String[0]), b;
   1.338 +	b=a;	
   1.339 +	a.__DbgTest(&dump);
   1.340 +	b.__DbgTest(&dump2);  
   1.341 +	TestDes(dump.iNext, dump2.iNext, dump.iEnd, dump2.iEnd); 
   1.342 +	TestDes(dump.iMark.iPtr, dump2.iMark.iPtr, dump.iEnd, dump2.iEnd);
   1.343 +	TestDes(dump.iBuf, dump2.iBuf, dump.iEnd, dump2.iEnd);
   1.344 +
   1.345 +	test.Next(_L("by string"));			//TLexx::operator=(const TUintx*)
   1.346 +	TLexType c;
   1.347 +	_LL(&String[0], (TText8*)" abc");
   1.348 +	c=&String[0];
   1.349 +	c.__DbgTest(&dump);
   1.350 +	TestDes(dump.iNext, dump.iEnd, &String[0]);	
   1.351 +	TestDes(dump.iBuf, dump.iEnd, &String[0]);
   1.352 +	TestDes(dump.iMark.iPtr, dump.iEnd, &String[0]);
   1.353 +
   1.354 +	test.Next(_L("by TBuf reference"));	//TLexx::operator=(const TBufx&);
   1.355 +	_LL(&String[0], (TText8*)"PQ R ");
   1.356 +	TLexType d;
   1.357 +	TBufType e(&String[0]);
   1.358 +	d=e;
   1.359 +	d.__DbgTest(&dump);
   1.360 +	TestDes(dump.iNext, dump.iEnd, &String[0]);	
   1.361 +	TestDes(dump.iBuf, dump.iEnd, &String[0]);
   1.362 +	TestDes(dump.iMark.iPtr, dump.iEnd, &String[0]);	
   1.363 +	test.End();	 		 
   1.364 +	}
   1.365 +
   1.366 +
   1.367 +//*********************************
   1.368 +// Test supporting methods
   1.369 +//*********************************
   1.370 +template<class TDesType, class TLexType, class TLexMarkType, class TBufType, class DumpType, class MarkDumpType, class S>
   1.371 +GLDEF_C void TestTLex<TDesType, TLexType, TLexMarkType, TBufType, DumpType, MarkDumpType, S>::Test4()
   1.372 +	{
   1.373 +	S String[40];
   1.374 +	DumpType dump1,dump2;
   1.375 +	MarkDumpType mDump;
   1.376 +
   1.377 +	test.Start(_L("Supporting methods"));
   1.378 +	test.Next(_L("Eos()"));
   1.379 +	_LL(&String[0], (TText8*)"GGG");
   1.380 +	TLexType a, b(&String[0]);
   1.381 +	test(a.Eos()==TRUE);
   1.382 +	test(b.Eos()==FALSE);
   1.383 +
   1.384 +	test.Next(_L("Inc()"));	   // Inc() increments iNext
   1.385 +	_LL(&String[0], (TText8*)"mno");
   1.386 +	TLexType c(&String[0]);
   1.387 +	c.__DbgTest(&dump1);
   1.388 +
   1.389 +	TestDes(dump1.iNext, dump1.iEnd, &String[0]);
   1.390 +	c.Inc();
   1.391 +	test((S)c.Peek()==String[1]);
   1.392 +	c.Inc();
   1.393 +	test((S)c.Peek()==String[2]);
   1.394 +
   1.395 +	test.Next(_L("Mark()"));		//	Mark() sets iMark=iNext
   1.396 +	_LL(&String[0], (TText8*)"pqr");
   1.397 +	TLexType d(&String[0]);
   1.398 +	d.Inc();
   1.399 +	d.__DbgTest(&dump1);
   1.400 +	d.Mark();
   1.401 +	d.__DbgTest(&dump2);
   1.402 +	TestDes(dump2.iMark.iPtr, dump1.iNext, dump2.iEnd, dump1.iEnd);
   1.403 +
   1.404 +	test.Next(_L("Mark(mark)")); //	Mark(aMark) sets aMark=iNext
   1.405 +	_LL(&String[0], (TText8*)"pqr");
   1.406 +	TLexType d1(&String[0]);
   1.407 +	TLexMarkType dm;
   1.408 +	d1.Inc();
   1.409 +	d1.__DbgTest(&dump1);
   1.410 +	d1.Mark(dm);
   1.411 +	dm.__DbgTest(&mDump);
   1.412 +	TestDes(mDump.iPtr, dump1.iNext, dump1.iEnd, dump1.iEnd);
   1.413 +
   1.414 +
   1.415 +	test.Next(_L("Get()")); 	// Get() is {TChar c(*iNext);Inc(); return(c);}
   1.416 +	_LL(&String[0], (TText8*)"s");
   1.417 +	TLexType e(&String[0]);
   1.418 +	TChar temp=e.Get();
   1.419 +	test(temp=='s');
   1.420 +	e.Inc();
   1.421 +	temp=e.Get();
   1.422 +	test(temp==0);
   1.423 +
   1.424 +
   1.425 +	test.Next(_L("Peek()"));	// Peek() returns *iNext
   1.426 +	TLexType f;
   1.427 +	test(f.Peek()==0);
   1.428 +	_LL(&String[0], (TText8*)"ab");
   1.429 +	TLexType g(&String[0]);
   1.430 +	test((S)g.Peek()==String[0]);
   1.431 +
   1.432 +	test.Next(_L("UnGet()"));	//  UnGet() is effectively if(iNext!=iBuf) iNext--;
   1.433 +	_LL(&String[0], (TText8*)"abc");
   1.434 +	TLexType h(&String[0]);
   1.435 +	h.Inc();
   1.436 +	test((S)h.Peek()==String[1]);
   1.437 +	h.UnGet();
   1.438 +	test((S)h.Peek()==String[0]);
   1.439 +
   1.440 +	test.Next(_L("SkipSpace()"));	// SkipSpace() 	is while(Peek.IsSpace()) iNext++;
   1.441 +	_LL(&String[0], (TText8*)"  j  kl");
   1.442 +	TLexType i(&String[0]);
   1.443 +	i.SkipSpace();
   1.444 +	test((S)i.Peek()==String[2]);
   1.445 +	i.Inc();
   1.446 +	i.SkipSpace();
   1.447 +	test((S)i.Peek()==String[5]);
   1.448 +
   1.449 +	test.Next(_L("SkipSpaceAndMark()"));	// while(Peek.IsSpace()) iNext++;	iMark=iNext;
   1.450 +	_LL(&String[0], (TText8*)"    aaa");
   1.451 +	TLexType j(&String[0]);
   1.452 +	j.SkipSpaceAndMark();
   1.453 +	j.__DbgTest(&dump1);
   1.454 +	_LL(&String[0], (TText8*)"aaa");
   1.455 +	TestDes(dump1.iNext, dump1.iEnd, &String[0]);
   1.456 +	TestDes(dump1.iMark.iPtr, dump1.iEnd, &String[0]);
   1.457 +
   1.458 +	test.Next(_L("SkipSpaceAndMark(aMark)"));	// while(Peek.IsSpace()) iNext++;	iMark=iNext;
   1.459 +	_LL(&String[0], (TText8*)"    aaa");
   1.460 +	TLexType j1(&String[0]);
   1.461 +	TLexMarkType jm;
   1.462 +	j1.SkipSpaceAndMark(jm);
   1.463 +	j1.__DbgTest(&dump1);
   1.464 +	jm.__DbgTest(&mDump);
   1.465 +	_LL(&String[0], (TText8*)"aaa");
   1.466 +	TestDes(dump1.iNext, dump1.iEnd, &String[0]);
   1.467 +	TestDes(mDump.iPtr, dump1.iEnd, &String[0]);
   1.468 +
   1.469 +	test.Next(_L("SkipCharacters()"));	// Skips non whitespace characters
   1.470 +	_LL(&String[0], (TText8*)"abc   ");
   1.471 +	TLexType k(&String[0]);
   1.472 +	k.SkipCharacters();
   1.473 +	test((S)k.Peek()==String[3]);
   1.474 +
   1.475 +	test.Next(_L("TokenLength()"));		// returns iNext-iMark
   1.476 +	_LL(&String[0], (TText8*)"GGG");
   1.477 +	TLexType l(&String[0]);
   1.478 +	test(l.TokenLength()==0);
   1.479 +	l.Inc();
   1.480 +	test(l.TokenLength()==1); 
   1.481 +
   1.482 +	test.Next(_L("MarkedToken()"));		// Extract a marked token
   1.483 +	_LL(&String[0], (TText8*)"ABCD");
   1.484 +	TLexType m(&String[0]);
   1.485 +	TBufType Buf;
   1.486 +	TLexMarkType mm;
   1.487 +	m.Inc();
   1.488 +	m.Mark();
   1.489 +	m.Inc();
   1.490 +	m.Mark(mm);
   1.491 +	m.Inc();
   1.492 +	Buf=m.MarkedToken();
   1.493 +	S String2[4];
   1.494 +	_LL(&String2[0], (TText8*)"BC");
   1.495 +	test(TDesType(&String2[0])==Buf); 
   1.496 +	_LL(&String2[0], (TText8*)"C");
   1.497 +	Buf=m.MarkedToken(mm);
   1.498 +	test(TDesType(&String2[0])==Buf); 
   1.499 +
   1.500 +	test.End();
   1.501 +	}
   1.502 +
   1.503 +
   1.504 +//*********************************
   1.505 +// Test Val()
   1.506 +//*********************************
   1.507 +template<class TDesType, class TLexType, class TLexMarkType, class TBufType, class DumpType, class MarkDumpType, class S>
   1.508 +GLDEF_C void TestTLex<TDesType, TLexType, TLexMarkType, TBufType, DumpType, MarkDumpType, S>::Test5()
   1.509 +	{
   1.510 +	S String[66];
   1.511 +	TInt ret; 
   1.512 +	TLexType Lex;
   1.513 +	test.Start(_L("Val()"));
   1.514 +
   1.515 +	//////////////////
   1.516 +	// Test Val(TInt8)
   1.517 +	/////////////////
   1.518 +	test.Next(_L("Val(TInt8)"));
   1.519 +	TInt8 T8;
   1.520 +	_LL(&String[0], (TText8*)"");
   1.521 +	Lex=&String[0];
   1.522 +	test((ret=Lex.Val(T8))==KErrGeneral);
   1.523 +
   1.524 +	_LL(&String[0], (TText8*)"abc");
   1.525 +	Lex=&String[0];
   1.526 +	test((ret=Lex.Val(T8))==KErrGeneral);
   1.527 +
   1.528 +	_LL(&String[0], (TText8*)"-abc-");
   1.529 +	Lex=&String[0];
   1.530 +	test((ret=Lex.Val(T8))==KErrGeneral);
   1.531 +	
   1.532 +	_LL(&String[0], (TText8*)"+abc+");
   1.533 +	Lex=&String[0];
   1.534 +	test((ret=Lex.Val(T8))==KErrGeneral);
   1.535 +
   1.536 +	_LL(&String[0], (TText8*)"0000000123abc");
   1.537 +	Lex=&String[0];
   1.538 +	test((ret=Lex.Val(T8))==KErrNone);
   1.539 +	test(T8==123);
   1.540 +
   1.541 +	_LL(&String[0], (TText8*)"000");
   1.542 +	Lex=&String[0];
   1.543 +	test((ret=Lex.Val(T8))==KErrNone);
   1.544 +	test(T8==0);
   1.545 +
   1.546 +	_LL(&String[0], (TText8*)"+0");
   1.547 +	Lex=&String[0];
   1.548 +	test((ret=Lex.Val(T8))==KErrNone);
   1.549 +	test(T8==0);
   1.550 +
   1.551 +	_LL(&String[0], (TText8*)"-0");
   1.552 +	Lex=&String[0];
   1.553 +	test((ret=Lex.Val(T8))==KErrNone);
   1.554 +	test(T8==0);
   1.555 +
   1.556 +	_LL(&String[0], (TText8*)"+1 ");
   1.557 +	Lex=&String[0];
   1.558 +	test((ret=Lex.Val(T8))==KErrNone);
   1.559 +	test(T8==1);
   1.560 +
   1.561 +	_LL(&String[0], (TText8*)"-1 ");
   1.562 +	Lex=&String[0];
   1.563 +	test((ret=Lex.Val(T8))==KErrNone);
   1.564 +	test(T8==-1);
   1.565 +
   1.566 +	_LL(&String[0], (TText8*)"127");
   1.567 +	Lex=&String[0];
   1.568 +	test((ret=Lex.Val(T8))==KErrNone);
   1.569 +	test(T8==127);
   1.570 +
   1.571 +	_LL(&String[0], (TText8*)"128");
   1.572 +	Lex=&String[0];
   1.573 +	test((ret=Lex.Val(T8))==KErrOverflow);
   1.574 +
   1.575 +	_LL(&String[0], (TText8*)"-128");
   1.576 +	Lex=&String[0];
   1.577 +	test((ret=Lex.Val(T8))==KErrNone);
   1.578 +	test(T8==-128);
   1.579 +
   1.580 +	_LL(&String[0], (TText8*)"-129");
   1.581 +	Lex=&String[0];
   1.582 +	test((ret=Lex.Val(T8))==KErrOverflow);
   1.583 +
   1.584 +
   1.585 +	///////////////////
   1.586 +	// Test Val(TInt16)
   1.587 +	///////////////////
   1.588 +	test.Next(_L("Val(TInt16)"));
   1.589 +	TInt16 T16;
   1.590 +	_LL(&String[0], (TText8*)"");
   1.591 +	Lex=&String[0];
   1.592 +	test((ret=Lex.Val(T16))==KErrGeneral);
   1.593 +
   1.594 +	_LL(&String[0], (TText8*)"32767");
   1.595 +	Lex=&String[0];
   1.596 +	test((ret=Lex.Val(T16))==KErrNone);
   1.597 +	test(T16==32767);
   1.598 +
   1.599 +	_LL(&String[0], (TText8*)"32768");
   1.600 +	Lex=&String[0];
   1.601 +	test((ret=Lex.Val(T16))==KErrOverflow);
   1.602 +
   1.603 +	_LL(&String[0], (TText8*)"-32768");
   1.604 +	Lex=&String[0];
   1.605 +	test((ret=Lex.Val(T16))==KErrNone);
   1.606 +	test(T16==-32768);
   1.607 +
   1.608 +	_LL(&String[0], (TText8*)"-32769");
   1.609 +	Lex=&String[0];
   1.610 +	test((ret=Lex.Val(T16))==KErrOverflow);
   1.611 +
   1.612 +
   1.613 +	///////////////////
   1.614 +	// Test Val(TInt32)
   1.615 +	///////////////////
   1.616 +	test.Next(_L("Val(TInt32)"));
   1.617 +	TInt32 T32;
   1.618 +	_LL(&String[0], (TText8*)"");
   1.619 +	Lex=&String[0];
   1.620 +	test((ret=Lex.Val(T32))==KErrGeneral);
   1.621 +
   1.622 +	_LL(&String[0], (TText8*)"2147483647");
   1.623 +	Lex=&String[0];
   1.624 +	test((ret=Lex.Val(T32))==KErrNone);
   1.625 +	test(T32==2147483647L);
   1.626 +
   1.627 +	_LL(&String[0], (TText8*)"2147483648");
   1.628 +	Lex=&String[0];
   1.629 +	test((ret=Lex.Val(T32))==KErrOverflow);
   1.630 +
   1.631 +	_LL(&String[0], (TText8*)"-2147483648");
   1.632 +	Lex=&String[0];
   1.633 +	test((ret=Lex.Val(T32))==KErrNone);
   1.634 +	test(T32==-2147483647-1);  // the -1 prevents a (bug?) warning
   1.635 +
   1.636 +	_LL(&String[0], (TText8*)"-2147483649");
   1.637 +	Lex=&String[0];
   1.638 +	test((ret=Lex.Val(T32))==KErrOverflow);
   1.639 +
   1.640 +
   1.641 +	/////////////////
   1.642 +	// Test Val(TInt)
   1.643 +	/////////////////
   1.644 +	test.Next(_L("Val(TInt)"));
   1.645 +	TInt T;
   1.646 +	_LL(&String[0], (TText8*)"");
   1.647 +	Lex=&String[0];
   1.648 +	test((ret=Lex.Val(T))==KErrGeneral);
   1.649 +
   1.650 +	_LL(&String[0], (TText8*)"2147483647");
   1.651 +	Lex=&String[0];
   1.652 +	test((ret=Lex.Val(T))==KErrNone);
   1.653 +	test(T==2147483647L);
   1.654 +
   1.655 +	_LL(&String[0], (TText8*)"2147483648");
   1.656 +	Lex=&String[0];
   1.657 +	test((ret=Lex.Val(T))==KErrOverflow);
   1.658 +
   1.659 +	_LL(&String[0], (TText8*)"-2147483648");
   1.660 +	Lex=&String[0];
   1.661 +	test((ret=Lex.Val(T))==KErrNone);
   1.662 +	test(T==-2147483647-1);  // the -1 prevents a (bug?) warning
   1.663 +
   1.664 +	_LL(&String[0], (TText8*)"-2147483649");
   1.665 +	Lex=&String[0];
   1.666 +	test((ret=Lex.Val(T))==KErrOverflow);
   1.667 +
   1.668 +	/////////////////
   1.669 +	// Test Val(TInt64)
   1.670 +	/////////////////
   1.671 +	test.Next(_L("Val(TInt64)"));
   1.672 +	TInt64 T64;
   1.673 +	_LL(&String[0], (TText8*)"");
   1.674 +	Lex=&String[0];
   1.675 +	test((ret=Lex.Val(T64))==KErrGeneral);
   1.676 +
   1.677 +	_LL(&String[0], (TText8*)"2147483647");
   1.678 +	Lex=&String[0];
   1.679 +	test((ret=Lex.Val(T64))==KErrNone);
   1.680 +	test(T64==TInt(2147483647L));
   1.681 +
   1.682 +	_LL(&String[0], (TText8*)"2147483648");
   1.683 +	Lex=&String[0];
   1.684 +	test((ret=Lex.Val(T64))==KErrNone);
   1.685 +	test(T64==MAKE_TINT64(0,0x80000000u));
   1.686 +
   1.687 +	_LL(&String[0], (TText8*)"-2147483648");
   1.688 +	Lex=&String[0];
   1.689 +	test((ret=Lex.Val(T64))==KErrNone);
   1.690 +	test(T64==-2147483647-1);  // the -1 prevents a (bug?) warning
   1.691 +
   1.692 +	_LL(&String[0], (TText8*)"-2147483649");
   1.693 +	Lex=&String[0];
   1.694 +	test((ret=Lex.Val(T64))==KErrNone);
   1.695 +	test(T64==MAKE_TINT64(0xffffffffu,0x7fffffffu));
   1.696 +
   1.697 +	_LL(&String[0], (TText8*)"9223372036854775807");
   1.698 +	Lex=&String[0];
   1.699 +	ret=Lex.Val(T64);
   1.700 +	test.Printf(_L("ret=%d\n"),ret);
   1.701 +	test(ret==KErrNone);
   1.702 +	test.Printf(_L("%lx\n"),T64);
   1.703 +	test(T64==MAKE_TINT64(0x7fffffffu,0xffffffffu));
   1.704 +
   1.705 +	_LL(&String[0], (TText8*)"9223372036854775808");
   1.706 +	Lex=&String[0];
   1.707 +	test((ret=Lex.Val(T64))==KErrOverflow);
   1.708 +
   1.709 +	_LL(&String[0], (TText8*)"-9223372036854775808");
   1.710 +	Lex=&String[0];
   1.711 +	test((ret=Lex.Val(T64))==KErrNone);
   1.712 +	test(T64==MAKE_TINT64(0x80000000u,0x0));
   1.713 +
   1.714 +	_LL(&String[0], (TText8*)"-9223372036854775809");
   1.715 +	Lex=&String[0];
   1.716 +	test((ret=Lex.Val(T64))==KErrOverflow);
   1.717 +
   1.718 +	////////////////////					
   1.719 +	// Test Val(TReal32)
   1.720 +	/////////////////////
   1.721 +//	test.Next(_L("Val(TReal32)"));
   1.722 +//	TReal32 TR32;
   1.723 +//	test((ret=Lex.Val(TR32))==KErrNotSupported);
   1.724 +
   1.725 +
   1.726 +	////////////////////
   1.727 +	// Test Val(TReal64)
   1.728 +	///////////////////
   1.729 +//	test.Next(_L("Val(TReal64)"));
   1.730 +//	TReal64 TR64;
   1.731 +//	test((ret=Lex.Val(TR64))==KErrNotSupported);
   1.732 +
   1.733 +
   1.734 +	///////////////////////////
   1.735 +	// Test Val(TUint8, TRadix)
   1.736 +	///////////////////////////
   1.737 +	test.Next(_L("Val(TUint8, TRadix)"));
   1.738 +	TUint8 TU8;
   1.739 +
   1.740 +	_LL(&String[0], (TText8*)"00");
   1.741 +	Lex=&String[0];
   1.742 +	test((ret=Lex.Val(TU8, (TRadix)EBinary))==KErrNone);
   1.743 +	test(TU8==0);
   1.744 +
   1.745 +	_LL(&String[0], (TText8*)"01");
   1.746 +	Lex=&String[0];
   1.747 +	test((ret=Lex.Val(TU8, (TRadix)EBinary))==KErrNone);
   1.748 +	test(TU8==1);
   1.749 +
   1.750 +	_LL(&String[0], (TText8*)"11111111");
   1.751 +	Lex=&String[0];
   1.752 +	test((ret=Lex.Val(TU8, (TRadix)EBinary))==KErrNone);
   1.753 +	test(TU8==255);
   1.754 +
   1.755 +	_LL(&String[0], (TText8*)"100000000");
   1.756 +	Lex=&String[0];
   1.757 +	test((ret=Lex.Val(TU8, (TRadix)EBinary))==KErrOverflow);
   1.758 +
   1.759 +	_LL(&String[0], (TText8*)"00");
   1.760 +	Lex=&String[0];
   1.761 +	test((ret=Lex.Val(TU8, (TRadix)EOctal))==KErrNone);
   1.762 +	test(TU8==0);
   1.763 +
   1.764 +	_LL(&String[0], (TText8*)"01");
   1.765 +	Lex=&String[0];
   1.766 +	test((ret=Lex.Val(TU8, (TRadix)EOctal))==KErrNone);
   1.767 +	test(TU8==1);
   1.768 +
   1.769 +	_LL(&String[0], (TText8*)"377");
   1.770 +	Lex=&String[0];
   1.771 +	test((ret=Lex.Val(TU8, (TRadix)EOctal))==KErrNone);
   1.772 +	test(TU8==255);
   1.773 +
   1.774 +	_LL(&String[0], (TText8*)"400");
   1.775 +	Lex=&String[0];			
   1.776 +	test((ret=Lex.Val(TU8, (TRadix)EOctal))==KErrOverflow);
   1.777 +
   1.778 +	_LL(&String[0], (TText8*)"00");
   1.779 +	Lex=&String[0];
   1.780 +	test((ret=Lex.Val(TU8, (TRadix)EDecimal))==KErrNone);
   1.781 +	test(TU8==0);
   1.782 +
   1.783 +	_LL(&String[0], (TText8*)"01");
   1.784 +	Lex=&String[0];
   1.785 +	test((ret=Lex.Val(TU8, (TRadix)EDecimal))==KErrNone);
   1.786 +	test(TU8==1);
   1.787 +
   1.788 +	_LL(&String[0], (TText8*)"255");
   1.789 +	Lex=&String[0];
   1.790 +	test((ret=Lex.Val(TU8, (TRadix)EDecimal))==KErrNone);
   1.791 +	test(TU8==255);
   1.792 +
   1.793 +	_LL(&String[0], (TText8*)"256");
   1.794 +	Lex=&String[0];			
   1.795 +	test((ret=Lex.Val(TU8, (TRadix)EDecimal))==KErrOverflow);
   1.796 +
   1.797 +	_LL(&String[0], (TText8*)"00");
   1.798 +	Lex=&String[0];
   1.799 +	test((ret=Lex.Val(TU8, (TRadix)EHex))==KErrNone);
   1.800 +	test(TU8==0);
   1.801 +
   1.802 +	_LL(&String[0], (TText8*)"01");
   1.803 +	Lex=&String[0];
   1.804 +	test((ret=Lex.Val(TU8, (TRadix)EHex))==KErrNone);
   1.805 +	test(TU8==1);
   1.806 +
   1.807 +	_LL(&String[0], (TText8*)"Ff");
   1.808 +	Lex=&String[0];
   1.809 +	test((ret=Lex.Val(TU8, (TRadix)EHex))==KErrNone);
   1.810 +	test(TU8==255);
   1.811 +
   1.812 +	_LL(&String[0], (TText8*)"100");
   1.813 +	Lex=&String[0];			
   1.814 +	test((ret=Lex.Val(TU8, (TRadix)EHex))==KErrOverflow);
   1.815 +
   1.816 +
   1.817 +
   1.818 +	////////////////////////////
   1.819 +	// Test Val(TUint16, TRadix)
   1.820 +	////////////////////////////
   1.821 +	test.Next(_L("Val(TUint16, TRadix)"));
   1.822 +	TUint16 TU16;
   1.823 +
   1.824 +	_LL(&String[0], (TText8*)"00");
   1.825 +	Lex=&String[0];
   1.826 +	test((ret=Lex.Val(TU16, (TRadix)EBinary))==KErrNone);
   1.827 +	test(TU16==0);
   1.828 +
   1.829 +	_LL(&String[0], (TText8*)"01");
   1.830 +	Lex=&String[0];
   1.831 +	test((ret=Lex.Val(TU16, (TRadix)EBinary))==KErrNone);
   1.832 +	test(TU16==1);
   1.833 +
   1.834 +	_LL(&String[0], (TText8*)"1111111111111111");
   1.835 +	Lex=&String[0];
   1.836 +	test((ret=Lex.Val(TU16, (TRadix)EBinary))==KErrNone);
   1.837 +	test(TU16==65535);
   1.838 +
   1.839 +	_LL(&String[0], (TText8*)"10000000000000000");
   1.840 +	Lex=&String[0];
   1.841 +	test((ret=Lex.Val(TU16, (TRadix)EBinary))==KErrOverflow);
   1.842 +
   1.843 +	_LL(&String[0], (TText8*)"00");
   1.844 +	Lex=&String[0];
   1.845 +	test((ret=Lex.Val(TU16, (TRadix)EOctal))==KErrNone);
   1.846 +	test(TU16==0);
   1.847 +
   1.848 +	_LL(&String[0], (TText8*)"01");
   1.849 +	Lex=&String[0];
   1.850 +	test((ret=Lex.Val(TU16, (TRadix)EOctal))==KErrNone);
   1.851 +	test(TU16==1);
   1.852 +
   1.853 +	_LL(&String[0], (TText8*)"177777");
   1.854 +	Lex=&String[0];
   1.855 +	test((ret=Lex.Val(TU16, (TRadix)EOctal))==KErrNone);
   1.856 +	test(TU16==65535);
   1.857 +
   1.858 +	_LL(&String[0], (TText8*)"200000");
   1.859 +	Lex=&String[0];
   1.860 +	test((ret=Lex.Val(TU16, (TRadix)EOctal))==KErrOverflow);
   1.861 +
   1.862 +	_LL(&String[0], (TText8*)"00");
   1.863 +	Lex=&String[0];
   1.864 +	test((ret=Lex.Val(TU16, (TRadix)EDecimal))==KErrNone);
   1.865 +	test(TU16==0);
   1.866 +
   1.867 +	_LL(&String[0], (TText8*)"01");
   1.868 +	Lex=&String[0];
   1.869 +	test((ret=Lex.Val(TU16, (TRadix)EDecimal))==KErrNone);
   1.870 +	test(TU16==1);
   1.871 +
   1.872 +	_LL(&String[0], (TText8*)"65535");
   1.873 +	Lex=&String[0];
   1.874 +	test((ret=Lex.Val(TU16, (TRadix)EDecimal))==KErrNone);
   1.875 +	test(TU16==65535);
   1.876 +
   1.877 +	_LL(&String[0], (TText8*)"65536");
   1.878 +	Lex=&String[0];			
   1.879 +	test((ret=Lex.Val(TU16, (TRadix)EDecimal))==KErrOverflow);
   1.880 +
   1.881 +	_LL(&String[0], (TText8*)"00");
   1.882 +	Lex=&String[0];
   1.883 +	test((ret=Lex.Val(TU16, (TRadix)EHex))==KErrNone);
   1.884 +	test(TU16==0);
   1.885 +
   1.886 +	_LL(&String[0], (TText8*)"01");
   1.887 +	Lex=&String[0];
   1.888 +	test((ret=Lex.Val(TU16, (TRadix)EHex))==KErrNone);
   1.889 +	test(TU16==1);
   1.890 +
   1.891 +	_LL(&String[0], (TText8*)"ffFf");
   1.892 +	Lex=&String[0];
   1.893 +	test((ret=Lex.Val(TU16, (TRadix)EHex))==KErrNone);
   1.894 +	test(TU16==65535);
   1.895 +
   1.896 +	_LL(&String[0], (TText8*)"10000");
   1.897 +	Lex=&String[0];			
   1.898 +	test((ret=Lex.Val(TU16, (TRadix)EHex))==KErrOverflow);
   1.899 +
   1.900 +
   1.901 +
   1.902 +	////////////////////////////
   1.903 +	// Test Val(TUint32, TRadix)
   1.904 +	////////////////////////////
   1.905 +	test.Next(_L("Val(TUint32, TRadix)"));
   1.906 +	TUint32 TU32;
   1.907 +
   1.908 +	_LL(&String[0], (TText8*)"00");
   1.909 +	Lex=&String[0];
   1.910 +	test((ret=Lex.Val(TU32, (TRadix)EBinary))==KErrNone);
   1.911 +	test(TU32==0);
   1.912 +
   1.913 +	_LL(&String[0], (TText8*)"01");
   1.914 +	Lex=&String[0];
   1.915 +	test((ret=Lex.Val(TU32, (TRadix)EBinary))==KErrNone);
   1.916 +	test(TU32==1);
   1.917 +
   1.918 +	_LL(&String[0], (TText8*)"11111111111111111111111111111111");
   1.919 +	Lex=&String[0];
   1.920 +	test((ret=Lex.Val(TU32, (TRadix)EBinary))==KErrNone);
   1.921 +	test(TU32==4294967295u);
   1.922 +
   1.923 +	_LL(&String[0], (TText8*)"100000000000000000000000000000000");
   1.924 +	Lex=&String[0];
   1.925 +	test((ret=Lex.Val(TU32, (TRadix)EBinary))==KErrOverflow);
   1.926 +
   1.927 +	_LL(&String[0], (TText8*)"00");
   1.928 +	Lex=&String[0];
   1.929 +	test((ret=Lex.Val(TU32, (TRadix)EOctal))==KErrNone);
   1.930 +	test(TU32==0);
   1.931 +
   1.932 +	_LL(&String[0], (TText8*)"01");
   1.933 +	Lex=&String[0];
   1.934 +	test((ret=Lex.Val(TU32, (TRadix)EOctal))==KErrNone);
   1.935 +	test(TU32==1);
   1.936 +
   1.937 +	_LL(&String[0], (TText8*)"37777777777");
   1.938 +	Lex=&String[0];
   1.939 +	test((ret=Lex.Val(TU32, (TRadix)EOctal))==KErrNone);
   1.940 +	test(TU32==4294967295u);
   1.941 +
   1.942 +	_LL(&String[0], (TText8*)"40000000000");
   1.943 +	Lex=&String[0];			
   1.944 +	test((ret=Lex.Val(TU32, (TRadix)EOctal))==KErrOverflow);
   1.945 +
   1.946 +	_LL(&String[0], (TText8*)"00");
   1.947 +	Lex=&String[0];
   1.948 +	test((ret=Lex.Val(TU32, (TRadix)EDecimal))==KErrNone);
   1.949 +	test(TU32==0);
   1.950 +
   1.951 +	_LL(&String[0], (TText8*)"01");
   1.952 +	Lex=&String[0];
   1.953 +	test((ret=Lex.Val(TU32, (TRadix)EDecimal))==KErrNone);
   1.954 +	test(TU32==1);
   1.955 +
   1.956 +	_LL(&String[0], (TText8*)"4294967295");
   1.957 +	Lex=&String[0];
   1.958 +	test((ret=Lex.Val(TU32, (TRadix)EDecimal))==KErrNone);
   1.959 +	test(TU32==4294967295u);
   1.960 +
   1.961 +	_LL(&String[0], (TText8*)"4294967296");
   1.962 +	Lex=&String[0];			
   1.963 +	test((ret=Lex.Val(TU32, (TRadix)EDecimal))==KErrOverflow);
   1.964 +
   1.965 +	_LL(&String[0], (TText8*)"00");
   1.966 +	Lex=&String[0];
   1.967 +	test((ret=Lex.Val(TU32, (TRadix)EHex))==KErrNone);
   1.968 +	test(TU32==0);
   1.969 +
   1.970 +	_LL(&String[0], (TText8*)"01");
   1.971 +	Lex=&String[0];
   1.972 +	test((ret=Lex.Val(TU32, (TRadix)EHex))==KErrNone);
   1.973 +	test(TU32==1);
   1.974 +
   1.975 +	_LL(&String[0], (TText8*)"FFFFFFFF");
   1.976 +	Lex=&String[0];
   1.977 +	test((ret=Lex.Val(TU32, (TRadix)EHex))==KErrNone);
   1.978 +	test(TU32==4294967295u);
   1.979 +
   1.980 +	_LL(&String[0], (TText8*)"100000000");
   1.981 +	Lex=&String[0];			
   1.982 +	test((ret=Lex.Val(TU32, (TRadix)EHex))==KErrOverflow);
   1.983 +
   1.984 + 	///////////////////////////////////
   1.985 +	// Test Val(TInt64, TRadix)
   1.986 +	///////////////////////////////////
   1.987 +	test.Next(_L("Val(TInt64,TRadix)"));
   1.988 +	TInt64 TI64;
   1.989 +
   1.990 +	_LL(&String[0], (TText8*)"00");
   1.991 +	Lex=&String[0];
   1.992 +	test((ret=Lex.Val(TI64, (TRadix)EBinary))==KErrNone);
   1.993 +	test(TI64==0);
   1.994 +
   1.995 +	_LL(&String[0], (TText8*)"01");
   1.996 +	Lex=&String[0];
   1.997 +	test((ret=Lex.Val(TI64, (TRadix)EBinary))==KErrNone);
   1.998 +	test(TI64==1);
   1.999 +
  1.1000 +	_LL(&String[0], (TText8*)"11111111111111111111111111111111");
  1.1001 +	Lex=&String[0];
  1.1002 +	test((ret=Lex.Val(TI64, (TRadix)EBinary))==KErrNone);
  1.1003 +	test(TI64==TInt64(0xffffffffu));
  1.1004 +
  1.1005 +	_LL(&String[0], (TText8*)"100000000000000000000000000000000");
  1.1006 +	Lex=&String[0];
  1.1007 +	test((ret=Lex.Val(TI64, (TRadix)EBinary))==KErrNone);
  1.1008 +	test(TI64==MAKE_TINT64(0x1,0x0));
  1.1009 +
  1.1010 + 	_LL(&String[0], (TText8*)"1111111111111111111111111111111111111111111111111111111111111111");
  1.1011 +	Lex=&String[0];
  1.1012 +	test((ret=Lex.Val(TI64, (TRadix)EBinary))==KErrNone);
  1.1013 +	test(TI64==MAKE_TINT64(0xffffffffu,0xffffffffu));
  1.1014 +
  1.1015 +	_LL(&String[0], (TText8*)"10000000000000000000000000000000000000000000000000000000000000000");
  1.1016 +	Lex=&String[0];
  1.1017 +	test((ret=Lex.Val(TI64, (TRadix)EBinary))==KErrOverflow);
  1.1018 +
  1.1019 +	_LL(&String[0], (TText8*)"00");
  1.1020 +	Lex=&String[0];
  1.1021 +	test((ret=Lex.Val(TI64, (TRadix)EOctal))==KErrNone);
  1.1022 +	test(TI64==0);
  1.1023 +
  1.1024 +	_LL(&String[0], (TText8*)"01");
  1.1025 +	Lex=&String[0];
  1.1026 +	test((ret=Lex.Val(TI64, (TRadix)EOctal))==KErrNone);
  1.1027 +	test(TI64==1);
  1.1028 +
  1.1029 +	_LL(&String[0], (TText8*)"37777777777");
  1.1030 +	Lex=&String[0];
  1.1031 +	test((ret=Lex.Val(TI64, (TRadix)EOctal))==KErrNone);
  1.1032 +	test(TI64==TInt64(0xffffffffu));
  1.1033 +
  1.1034 +	_LL(&String[0], (TText8*)"40000000000");
  1.1035 +	Lex=&String[0];			
  1.1036 +	test((ret=Lex.Val(TI64, (TRadix)EOctal))==KErrNone);
  1.1037 +	test(TI64==MAKE_TINT64(0x1,0x0));
  1.1038 +
  1.1039 +	_LL(&String[0], (TText8*)"1777777777777777777777");
  1.1040 +	Lex=&String[0];
  1.1041 +	test((ret=Lex.Val(TI64, (TRadix)EOctal))==KErrNone);
  1.1042 +	test(TI64==MAKE_TINT64(0xffffffffu,0xffffffffu));
  1.1043 +
  1.1044 +	_LL(&String[0], (TText8*)"2000000000000000000000");
  1.1045 +	Lex=&String[0];			
  1.1046 +	test((ret=Lex.Val(TI64, (TRadix)EOctal))==KErrOverflow);
  1.1047 +
  1.1048 +	_LL(&String[0], (TText8*)"00");
  1.1049 +	Lex=&String[0];				
  1.1050 +	test((ret=Lex.Val(TI64, (TRadix)EDecimal))==KErrNone);
  1.1051 +	test(TI64==0);
  1.1052 +
  1.1053 +	_LL(&String[0], (TText8*)"00");
  1.1054 +	Lex=&String[0]; //************** iNext is set to "" by Val
  1.1055 +	test((ret=Lex.Val(TI64))==KErrNone);	
  1.1056 +	test(TI64==0);
  1.1057 +
  1.1058 +	_LL(&String[0], (TText8*)"01");
  1.1059 +	Lex=&String[0];
  1.1060 +	test((ret=Lex.Val(TI64, (TRadix)EDecimal))==KErrNone);
  1.1061 +	test(TI64==1);
  1.1062 +	_LL(&String[0], (TText8*)"01");
  1.1063 +	Lex=&String[0];
  1.1064 +	test((ret=Lex.Val(TI64))==KErrNone);
  1.1065 +	test(TI64==1);
  1.1066 +
  1.1067 +	_LL(&String[0], (TText8*)"4294967295");
  1.1068 +	Lex=&String[0];
  1.1069 +	test((ret=Lex.Val(TI64, (TRadix)EDecimal))==KErrNone);
  1.1070 +	test(TI64==TInt64(0xffffffffu));
  1.1071 +	_LL(&String[0], (TText8*)"4294967295");
  1.1072 +	Lex=&String[0];
  1.1073 +	test((ret=Lex.Val(TI64))==KErrNone);
  1.1074 +	test(TI64==TInt64(0xffffffffu));
  1.1075 +
  1.1076 +	_LL(&String[0], (TText8*)"4294967296");
  1.1077 +	Lex=&String[0];			
  1.1078 +	test((ret=Lex.Val(TI64, (TRadix)EDecimal))==KErrNone);
  1.1079 +	test(TI64==MAKE_TINT64(1,0)); 
  1.1080 +	_LL(&String[0], (TText8*)"4294967296");
  1.1081 +	Lex=&String[0];
  1.1082 +	test((ret=Lex.Val(TI64))==KErrNone);   
  1.1083 +	test(TI64==MAKE_TINT64(1,0)); 
  1.1084 +
  1.1085 +	_LL(&String[0], (TText8*)"18446744073709551615");
  1.1086 +	Lex=&String[0];
  1.1087 +	test((ret=Lex.Val(TI64, (TRadix)EDecimal))==KErrNone);
  1.1088 +	test(TI64==MAKE_TINT64(0xffffffffu,0xffffffffu));
  1.1089 +	_LL(&String[0], (TText8*)"18446744073709551616");
  1.1090 +	Lex=&String[0];
  1.1091 +	test((ret=Lex.Val(TI64))==KErrOverflow);
  1.1092 +
  1.1093 +	_LL(&String[0], (TText8*)"-1");
  1.1094 +	Lex=&String[0];			
  1.1095 +	test((ret=Lex.Val(TI64, (TRadix)EDecimal))==KErrGeneral);
  1.1096 +
  1.1097 +	_LL(&String[0], (TText8*)"00");
  1.1098 +	Lex=&String[0];
  1.1099 +	test((ret=Lex.Val(TI64, (TRadix)EHex))==KErrNone);
  1.1100 +	test(TI64==0);
  1.1101 +
  1.1102 +	_LL(&String[0], (TText8*)"01");
  1.1103 +	Lex=&String[0];
  1.1104 +	test((ret=Lex.Val(TI64, (TRadix)EHex))==KErrNone);
  1.1105 +	test(TI64==1);
  1.1106 +
  1.1107 +	_LL(&String[0], (TText8*)"FFFFFFFF");
  1.1108 +	Lex=&String[0];
  1.1109 +	test((ret=Lex.Val(TI64, (TRadix)EHex))==KErrNone);
  1.1110 +	test(TI64==TInt64(0xffffffffu));
  1.1111 +
  1.1112 +	_LL(&String[0], (TText8*)"100000000");
  1.1113 +	Lex=&String[0];			
  1.1114 +	test((ret=Lex.Val(TI64, (TRadix)EHex))==KErrNone);
  1.1115 +	test(TI64==MAKE_TINT64(1,0)); 
  1.1116 +
  1.1117 +	_LL(&String[0], (TText8*)"FFFFFFFFffffffff");
  1.1118 +	Lex=&String[0];
  1.1119 +	test((ret=Lex.Val(TI64, (TRadix)EHex))==KErrNone);
  1.1120 +	test(TI64==MAKE_TINT64(0xffffffffu,0xffffffffu));
  1.1121 +
  1.1122 +	_LL(&String[0], (TText8*)"10000000000000000");
  1.1123 +	Lex=&String[0];			
  1.1124 +	test((ret=Lex.Val(TI64, (TRadix)EHex))==KErrOverflow);
  1.1125 +
  1.1126 +
  1.1127 +	///////////////////////////////////
  1.1128 +	// Test Val(TUint, TRadix=(TRadix)EDecimal)
  1.1129 +	///////////////////////////////////
  1.1130 +	test.Next(_L("Val(TUint, TRadix=(TRadix)EDecimal)"));
  1.1131 +	TUint TU;
  1.1132 +
  1.1133 +	_LL(&String[0], (TText8*)"00");
  1.1134 +	Lex=&String[0];
  1.1135 +	test((ret=Lex.Val(TU, (TRadix)EBinary))==KErrNone);
  1.1136 +	test(TU==0);
  1.1137 +
  1.1138 +	_LL(&String[0], (TText8*)"01");
  1.1139 +	Lex=&String[0];
  1.1140 +	test((ret=Lex.Val(TU, (TRadix)EBinary))==KErrNone);
  1.1141 +	test(TU==1);
  1.1142 +
  1.1143 +	_LL(&String[0], (TText8*)"11111111111111111111111111111111");
  1.1144 +	Lex=&String[0];
  1.1145 +	test((ret=Lex.Val(TU, (TRadix)EBinary))==KErrNone);
  1.1146 +	test(TU==4294967295u);
  1.1147 +
  1.1148 +	_LL(&String[0], (TText8*)"100000000000000000000000000000000");
  1.1149 +	Lex=&String[0];
  1.1150 +	test((ret=Lex.Val(TU, (TRadix)EBinary))==KErrOverflow);
  1.1151 +
  1.1152 +	_LL(&String[0], (TText8*)"00");
  1.1153 +	Lex=&String[0];
  1.1154 +	test((ret=Lex.Val(TU, (TRadix)EOctal))==KErrNone);
  1.1155 +	test(TU==0);
  1.1156 +
  1.1157 +	_LL(&String[0], (TText8*)"01");
  1.1158 +	Lex=&String[0];
  1.1159 +	test((ret=Lex.Val(TU, (TRadix)EOctal))==KErrNone);
  1.1160 +	test(TU==1);
  1.1161 +
  1.1162 +	_LL(&String[0], (TText8*)"37777777777");
  1.1163 +	Lex=&String[0];
  1.1164 +	test((ret=Lex.Val(TU, (TRadix)EOctal))==KErrNone);
  1.1165 +	test(TU==4294967295u);
  1.1166 +
  1.1167 +	_LL(&String[0], (TText8*)"40000000000");
  1.1168 +	Lex=&String[0];			
  1.1169 +	test((ret=Lex.Val(TU, (TRadix)EOctal))==KErrOverflow);
  1.1170 +
  1.1171 +	_LL(&String[0], (TText8*)"00");
  1.1172 +	Lex=&String[0];				
  1.1173 +	test((ret=Lex.Val(TU, (TRadix)EDecimal))==KErrNone);
  1.1174 +	test(TU==0);
  1.1175 +
  1.1176 +	_LL(&String[0], (TText8*)"00");
  1.1177 +	Lex=&String[0]; //************** iNext is set to "" by Val
  1.1178 +	test((ret=Lex.Val(TU))==KErrNone);	
  1.1179 +	test(TU==0);
  1.1180 +
  1.1181 +	_LL(&String[0], (TText8*)"01");
  1.1182 +	Lex=&String[0];
  1.1183 +	test((ret=Lex.Val(TU, (TRadix)EDecimal))==KErrNone);
  1.1184 +	test(TU==1);
  1.1185 +	_LL(&String[0], (TText8*)"01");
  1.1186 +	Lex=&String[0];
  1.1187 +	test((ret=Lex.Val(TU))==KErrNone);
  1.1188 +	test(TU==1);
  1.1189 +
  1.1190 +	_LL(&String[0], (TText8*)"4294967295");
  1.1191 +	Lex=&String[0];
  1.1192 +	test((ret=Lex.Val(TU, (TRadix)EDecimal))==KErrNone);
  1.1193 +	test(TU==4294967295u);
  1.1194 +	_LL(&String[0], (TText8*)"4294967295");
  1.1195 +	Lex=&String[0];
  1.1196 +	test((ret=Lex.Val(TU))==KErrNone);
  1.1197 +	test(TU==4294967295u);
  1.1198 +
  1.1199 +	_LL(&String[0], (TText8*)"4294967296");
  1.1200 +	Lex=&String[0];			
  1.1201 +	test((ret=Lex.Val(TU, (TRadix)EDecimal))==KErrOverflow); 
  1.1202 +	_LL(&String[0], (TText8*)"4294967296");
  1.1203 +	Lex=&String[0];
  1.1204 +	test((ret=Lex.Val(TU))==KErrOverflow);   
  1.1205 +
  1.1206 +	_LL(&String[0], (TText8*)"00");
  1.1207 +	Lex=&String[0];
  1.1208 +	test((ret=Lex.Val(TU, (TRadix)EHex))==KErrNone);
  1.1209 +	test(TU==0);
  1.1210 +
  1.1211 +	_LL(&String[0], (TText8*)"01");
  1.1212 +	Lex=&String[0];
  1.1213 +	test((ret=Lex.Val(TU, (TRadix)EHex))==KErrNone);
  1.1214 +	test(TU==1);
  1.1215 +
  1.1216 +	_LL(&String[0], (TText8*)"FFFFFFFF");
  1.1217 +	Lex=&String[0];
  1.1218 +	test((ret=Lex.Val(TU, (TRadix)EHex))==KErrNone);
  1.1219 +	test(TU==4294967295u);
  1.1220 +
  1.1221 +	_LL(&String[0], (TText8*)"100000000");
  1.1222 +	Lex=&String[0];			
  1.1223 +	test((ret=Lex.Val(TU, (TRadix)EHex))==KErrOverflow);
  1.1224 +
  1.1225 +
  1.1226 +	/////////////////////////////////
  1.1227 +	// Test Val(TInt32, TUint aLimit)
  1.1228 +	/////////////////////////////////		  
  1.1229 +	// This is called by several of the other Val methods and so has been indirectly tested already
  1.1230 +	test.Next(_L("Val(TInt32, TUint aLimit"));
  1.1231 +
  1.1232 +	_LL(&String[0], (TText8*)"1000");
  1.1233 +	Lex=&String[0];
  1.1234 +	test((ret=Lex.BoundedVal(T32,1000))==KErrNone);
  1.1235 +	test(T32==1000);
  1.1236 +
  1.1237 +	_LL(&String[0], (TText8*)"1001");
  1.1238 +	Lex=&String[0];
  1.1239 +	test((ret=Lex.BoundedVal(T32, 1000))==KErrOverflow);
  1.1240 +
  1.1241 +	_LL(&String[0], (TText8*)"-1000");
  1.1242 +	Lex=&String[0];
  1.1243 +	test((ret=Lex.BoundedVal(T32, 1000))==KErrNone);
  1.1244 +	test(T32==-1000);
  1.1245 +
  1.1246 +	_LL(&String[0], (TText8*)"-1001");
  1.1247 +	Lex=&String[0];
  1.1248 +	test((ret=Lex.BoundedVal(T32, 1000))==KErrNone);
  1.1249 +	test(T32==-1001);
  1.1250 +
  1.1251 +	_LL(&String[0], (TText8*)"-1002");
  1.1252 +	Lex=&String[0];
  1.1253 +	test((ret=Lex.BoundedVal(T32, 1000))==KErrOverflow);
  1.1254 +
  1.1255 +	_LL(&String[0], (TText8*)"0");
  1.1256 +	Lex=&String[0];
  1.1257 +	test((ret=Lex.BoundedVal(T32, 0))==KErrNone);
  1.1258 +	test(T32==0);
  1.1259 +	
  1.1260 +	_LL(&String[0], (TText8*)"1");
  1.1261 +	Lex=&String[0];
  1.1262 +	test((ret=Lex.BoundedVal(T32, 0))==KErrOverflow);	   
  1.1263 +
  1.1264 +
  1.1265 +	/////////////////////////////////////////////////
  1.1266 +	// Test Val(TUInt32, TRadix aRadix, TUint aLimit)
  1.1267 +	////////////////////////////////////////////////
  1.1268 +	// This is called by several of the other Val methods and so has been indirectly tested already
  1.1269 +	test.Next(_L("Val(TUInt32, TRadix, TUint)"));
  1.1270 +
  1.1271 +	// Test bug found during previous testing 
  1.1272 +	_LL(&String[0], (TText8*)"10");
  1.1273 +	Lex=&String[0];
  1.1274 +	test((ret=Lex.BoundedVal(TU32, (TRadix)EDecimal, 10))==KErrNone);
  1.1275 +	test(TU32==10);
  1.1276 +
  1.1277 +	_LL(&String[0], (TText8*)"11");
  1.1278 +	Lex=&String[0];
  1.1279 +	test((ret=Lex.BoundedVal(TU32, (TRadix)EDecimal, 10))==KErrOverflow);
  1.1280 +
  1.1281 +	_LL(&String[0], (TText8*)"19");
  1.1282 +	Lex=&String[0];
  1.1283 +	test((ret=Lex.BoundedVal(TU32, (TRadix)EDecimal, 10))==KErrOverflow);
  1.1284 +
  1.1285 +	_LL(&String[0], (TText8*)"20");
  1.1286 +	Lex=&String[0];
  1.1287 +	test((ret=Lex.BoundedVal(TU32, (TRadix)EDecimal, 10))==KErrOverflow);
  1.1288 +
  1.1289 +	/////////////////////////////////////////////////
  1.1290 +	// Test Val(TInt64, TRadix aRadix, TInt64 aLimit)
  1.1291 +	////////////////////////////////////////////////
  1.1292 +	test.Next(_L("Val(TInt64, TRadix, TInt64)"));
  1.1293 +
  1.1294 +	_LL(&String[0], (TText8*)"10");
  1.1295 +	Lex=&String[0];
  1.1296 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EDecimal, 10))==KErrNone);
  1.1297 +	test(TI64==TInt64(10));
  1.1298 +
  1.1299 +	_LL(&String[0], (TText8*)"11");
  1.1300 +	Lex=&String[0];
  1.1301 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EDecimal, 10))==KErrOverflow);
  1.1302 +
  1.1303 +	_LL(&String[0], (TText8*)"19");
  1.1304 +	Lex=&String[0];
  1.1305 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EDecimal, 10))==KErrOverflow);
  1.1306 +
  1.1307 +	_LL(&String[0], (TText8*)"20");
  1.1308 +	Lex=&String[0];
  1.1309 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EDecimal, 10))==KErrOverflow);
  1.1310 +
  1.1311 +	_LL(&String[0], (TText8*)"34532739886900");
  1.1312 +	Lex=&String[0];
  1.1313 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EDecimal, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrNone);
  1.1314 +	test(TI64==MAKE_TINT64(0x1f68u,0x47b1af34u));
  1.1315 +
  1.1316 +	_LL(&String[0], (TText8*)"34532739886901");
  1.1317 +	Lex=&String[0];
  1.1318 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EDecimal, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrOverflow);
  1.1319 +
  1.1320 +	_LL(&String[0], (TText8*)"74532739886901");
  1.1321 +	Lex=&String[0];
  1.1322 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EDecimal, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrOverflow);
  1.1323 +
  1.1324 +	_LL(&String[0], (TText8*)"6901");
  1.1325 +	Lex=&String[0];
  1.1326 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EDecimal, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrNone);
  1.1327 +	test(TI64==TInt64(6901));
  1.1328 +
  1.1329 +	_LL(&String[0], (TText8*)"1f6847b1af34");
  1.1330 +	Lex=&String[0];
  1.1331 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EHex, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrNone);
  1.1332 +	test(TI64==MAKE_TINT64(0x1f68u,0x47b1af34u));
  1.1333 +
  1.1334 +	_LL(&String[0], (TText8*)"1f6847b1af35");
  1.1335 +	Lex=&String[0];
  1.1336 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EHex, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrOverflow);
  1.1337 +
  1.1338 +	_LL(&String[0], (TText8*)"1f6847b1af340");
  1.1339 +	Lex=&String[0];
  1.1340 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EHex, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrOverflow);
  1.1341 +
  1.1342 +	_LL(&String[0], (TText8*)"1e82791aed35");
  1.1343 +	Lex=&String[0];
  1.1344 +	test((ret=Lex.BoundedVal(TI64, (TRadix)EHex, TInt64(0x56fba45u)))==KErrOverflow);
  1.1345 +
  1.1346 +	/////////////////////////////////////////////////
  1.1347 +	// Test Val(TInt64, TInt64 aLimit)
  1.1348 +	////////////////////////////////////////////////
  1.1349 +	test.Next(_L("Val(TInt64, TInt64)"));
  1.1350 +
  1.1351 +	_LL(&String[0], (TText8*)"10");
  1.1352 +	Lex=&String[0];
  1.1353 +	test((ret=Lex.BoundedVal(TI64, 10))==KErrNone);
  1.1354 +	test(TI64==TInt64(10));
  1.1355 +
  1.1356 +	_LL(&String[0], (TText8*)"11");
  1.1357 +	Lex=&String[0];
  1.1358 +	test((ret=Lex.BoundedVal(TI64, 10))==KErrOverflow);
  1.1359 +
  1.1360 +	_LL(&String[0], (TText8*)"19");
  1.1361 +	Lex=&String[0];
  1.1362 +	test((ret=Lex.BoundedVal(TI64, 10))==KErrOverflow);
  1.1363 +
  1.1364 +	_LL(&String[0], (TText8*)"20");
  1.1365 +	Lex=&String[0];
  1.1366 +	test((ret=Lex.BoundedVal(TI64, 10))==KErrOverflow);
  1.1367 +
  1.1368 +	_LL(&String[0], (TText8*)"34532739886900");
  1.1369 +	Lex=&String[0];
  1.1370 +	test((ret=Lex.BoundedVal(TI64, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrNone);
  1.1371 +	test(TI64==MAKE_TINT64(0x1f68u,0x47b1af34u));
  1.1372 +
  1.1373 +	_LL(&String[0], (TText8*)"34532739886901");
  1.1374 +	Lex=&String[0];
  1.1375 +	test((ret=Lex.BoundedVal(TI64, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrOverflow);
  1.1376 +
  1.1377 +	_LL(&String[0], (TText8*)"74532739886901");
  1.1378 +	Lex=&String[0];
  1.1379 +	test((ret=Lex.BoundedVal(TI64, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrOverflow);
  1.1380 +
  1.1381 +	_LL(&String[0], (TText8*)"6901");
  1.1382 +	Lex=&String[0];
  1.1383 +	test((ret=Lex.BoundedVal(TI64, MAKE_TINT64(0x1f68u,0x47b1af34u)))==KErrNone);
  1.1384 +	test(TI64==TInt64(6901));
  1.1385 +
  1.1386 +	test.End();
  1.1387 +	}
  1.1388 +
  1.1389 +void testLocale()
  1.1390 +	{
  1.1391 +
  1.1392 +	TLocale current;
  1.1393 +	current.Refresh();
  1.1394 +	TLocale loc;
  1.1395 +	loc.Refresh();
  1.1396 +
  1.1397 +	TReal64 v,v8;
  1.1398 +	TLex l;
  1.1399 +	TLex8 l8;
  1.1400 +	TInt r;
  1.1401 +
  1.1402 +	loc.SetDecimalSeparator('.');
  1.1403 +	loc.Set();
  1.1404 +	l=_L("-12.34");
  1.1405 +	l8=_L8("-12.34");
  1.1406 +	r=l.Val(v);
  1.1407 +	r=l8.Val(v8);
  1.1408 +	test(r==KErrNone);
  1.1409 +	test(v==-12.34);
  1.1410 +	test(v==v8);
  1.1411 +
  1.1412 +	l=_L("-12.34");
  1.1413 +	l8=_L8("-12.34");
  1.1414 +	r=l.Val(v,'.');
  1.1415 +	r=l8.Val(v8,'.');
  1.1416 +	test(r==KErrNone);
  1.1417 +	test(v==-12.34);
  1.1418 +	test(v==v8);
  1.1419 +	l=_L("-12.34");
  1.1420 +	l8=_L8("-12.34");
  1.1421 +	r=l.Val(v,',');
  1.1422 +	r=l8.Val(v8,',');
  1.1423 +	test(r==KErrNone);
  1.1424 +	test(v==-12);
  1.1425 +	test(v==v8);
  1.1426 +
  1.1427 +	l=_L("-12,34");
  1.1428 +	l8=_L8("-12,34");
  1.1429 +	r=l.Val(v);
  1.1430 +	r=l8.Val(v8);
  1.1431 +	test(r==KErrNone);
  1.1432 +	test(v==-12);
  1.1433 +	test(v==v8);
  1.1434 +	l=_L("-12,34");
  1.1435 +	l8=_L8("-12,34");
  1.1436 +	r=l.Val(v,'.');
  1.1437 +	r=l8.Val(v8,'.');
  1.1438 +	test(r==KErrNone);
  1.1439 +	test(v==-12);
  1.1440 +	test(v==v8);
  1.1441 +	l=_L("-12,34");
  1.1442 +	l8=_L8("-12,34");
  1.1443 +	r=l.Val(v,',');
  1.1444 +	r=l8.Val(v8,',');
  1.1445 +	test(r==KErrNone);
  1.1446 +	test(v==-12.34);
  1.1447 +	test(v==v8);
  1.1448 +
  1.1449 +	loc.SetDecimalSeparator(',');
  1.1450 +	loc.Set();
  1.1451 +	l=_L("-12.34");
  1.1452 +	l8=_L8("-12.34");
  1.1453 +	r=l.Val(v);
  1.1454 +	r=l8.Val(v8);
  1.1455 +	test(r==KErrNone);
  1.1456 +	test(v==-12);
  1.1457 +	test(v==v8);
  1.1458 +
  1.1459 +	l=_L("-12.34");
  1.1460 +	l8=_L8("-12.34");
  1.1461 +	r=l.Val(v,'.');
  1.1462 +	r=l8.Val(v8,'.');
  1.1463 +	test(r==KErrNone);
  1.1464 +	test(v==-12.34);
  1.1465 +	test(v==v8);
  1.1466 +	l=_L("-12.34");
  1.1467 +	l8=_L8("-12.34");
  1.1468 +	r=l.Val(v,',');
  1.1469 +	r=l8.Val(v8,',');
  1.1470 +	test(r==KErrNone);
  1.1471 +	test(v==-12);
  1.1472 +	test(v==v8);
  1.1473 +
  1.1474 +	l=_L("-12,34");
  1.1475 +	l8=_L8("-12,34");
  1.1476 +	r=l.Val(v);
  1.1477 +	r=l8.Val(v8);
  1.1478 +	test(r==KErrNone);
  1.1479 +	test(v==-12.34);
  1.1480 +	l=_L("-12,34");
  1.1481 +	l8=_L8("-12,34");
  1.1482 +	r=l.Val(v,'.');
  1.1483 +	r=l8.Val(v8,'.');
  1.1484 +	test(r==KErrNone);
  1.1485 +	test(v==-12);
  1.1486 +	test(v==v8);
  1.1487 +	l=_L("-12,34");
  1.1488 +	l8=_L8("-12,34");
  1.1489 +	r=l.Val(v,',');
  1.1490 +	r=l8.Val(v8,',');
  1.1491 +	test(r==KErrNone);
  1.1492 +	test(v==-12.34);
  1.1493 +	test(v==v8);
  1.1494 +
  1.1495 +	loc.Set();
  1.1496 +	current.Set();
  1.1497 +	}
  1.1498 +
  1.1499 +#pragma warning( disable : 4705 )	// statement has no effect
  1.1500 +GLDEF_C TInt E32Main()
  1.1501 +    {
  1.1502 +
  1.1503 +	test.Title(); 
  1.1504 +
  1.1505 +	test.Start(_L("********* TLEX **********"));
  1.1506 +#if defined(_UNICODE)
  1.1507 +	TestTLex<TPtrC, TLex, TLexMark, TBuf<0x40>, TLex16Dump, TLexMark16Dump, TText> T;
  1.1508 +#else
  1.1509 +	TestTLex<TPtrC, TLex, TLexMark, TBuf<0x40>, TLex8Dump, TLexMark8Dump, TText> T;
  1.1510 +#endif
  1.1511 +	test.Next(_L("TText 1"));
  1.1512 +	T.Test1();
  1.1513 +	test.Next(_L("TText 2"));
  1.1514 +	T.Test2();
  1.1515 +	test.Next(_L("TText 3"));
  1.1516 +	T.Test3();
  1.1517 +	test.Next(_L("TText 4"));
  1.1518 +	T.Test4();
  1.1519 +	test.Next(_L("TText 5"));
  1.1520 +	T.Test5();
  1.1521 +
  1.1522 +	TestTLex<TPtrC8, TLex8, TLexMark8, TBuf8<0x40>, TLex8Dump, TLexMark8Dump, TText8> T8;
  1.1523 +	test.Next(_L("TText8 1"));
  1.1524 +	T8.Test1();
  1.1525 +	test.Next(_L("TText8 2"));
  1.1526 +	T8.Test2();
  1.1527 +	test.Next(_L("TText8 3"));
  1.1528 +	T8.Test3();
  1.1529 +	test.Next(_L("TText8 4"));
  1.1530 +	T8.Test4();
  1.1531 +	test.Next(_L("TText8 5"));
  1.1532 +	T8.Test5();
  1.1533 +  
  1.1534 +	TestTLex<TPtrC16, TLex16, TLexMark16, TBuf16<0x40>, TLex16Dump, TLexMark16Dump, TText16> T16;
  1.1535 +	test.Next(_L("TText16 1"));
  1.1536 +	T16.Test1();
  1.1537 +	test.Next(_L("TText16 2"));
  1.1538 +	T16.Test2();
  1.1539 +	test.Next(_L("TText16 3"));
  1.1540 +	T16.Test3();
  1.1541 +	test.Next(_L("TText16 4"));
  1.1542 +	T16.Test4();
  1.1543 +	test.Next(_L("TText16 5"));
  1.1544 +	T16.Test5();
  1.1545 +
  1.1546 +	test.Next(_L("Test TLex in different locales"));
  1.1547 +	testLocale();
  1.1548 +
  1.1549 +	test.End();
  1.1550 +	return(KErrNone);
  1.1551 +    }
  1.1552 +#pragma warning( default : 4705 )
  1.1553 +