symport/e32test/math/t_i64_2.cpp
author Pat Downey <patrick.downey@nokia.com>
Thu, 25 Jun 2009 15:59:54 +0100
changeset 1 0a7b44b10206
child 2 806186ab5e14
permissions -rw-r--r--
Catch up of Symbian tools for @1627812
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     1
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     2
// All rights reserved.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     4
// under the terms of the License "Symbian Foundation License v1.0"
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     6
// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     7
//
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     8
// Initial Contributors:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    10
//
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    11
// Contributors:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    12
//
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    13
// Description:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    14
// e32test\math\t_i64_2.cpp
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    15
// Overview:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    16
// Test 64-bit integer functionality.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    17
// API Information:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    18
// TInt64, TUInt64.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    19
// Details:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    20
// - Construct TInt64 and TUInt64 and verify the results.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    21
// - Test the unary and shift operators and check results are as expected.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    22
// - Test the  + - * / and % operators, verify results are as expected.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    23
// - Test the  + - * / and % operators with random numbers, verify results 
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    24
// are as expected.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    25
// - Test the conversion of TInt64 to/from TReal. Verify that the results
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    26
// are as expected.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    27
// - Test the conversion of TInt64 to/from text. Verify that the results
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    28
// are as expected.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    29
// Platforms/Drives/Compatibility:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    30
// All.
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    31
// Assumptions/Requirement/Pre-requisites:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    32
// Failures and causes:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    33
// Base Port information:
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    34
// 
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    35
//
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    36
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    37
#include <e32test.h>
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    38
#include <e32math.h>
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    39
#include "largeint.h"
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    40
#include "../misc/prbs.h"
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    41
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    42
typedef TLargeInt<2> I64;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    43
typedef TLargeInt<4> I128;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    44
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    45
RTest test(_L("T_I64_2"));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    46
TUint Seed[2];
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    47
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    48
TUint64 Random64()
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    49
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    50
	TUint h = Random(Seed);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    51
	TUint l = Random(Seed);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    52
	return MAKE_TUINT64(h,l);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    53
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    54
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    55
#define BOOL(x)	((x)?1:0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    56
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    57
#define FOREACH(p, table, esize)	\
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    58
	for(p=table; p<(const TUint32*)((const TUint8*)table+sizeof(table)); p+=esize/sizeof(TUint32))
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    59
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    60
const TUint32 Table1[] =
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    61
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    62
	0x00000000, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    63
	0x00000001, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    64
	0x0000cc01, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    65
	0x00db2701, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    66
	0xcc9ffcd1, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    67
	0x00000000, 0xffffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    68
	0xeeeeeeee, 0xffffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    69
	0x04030201, 0x00000055,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    70
	0x04030201, 0x00006655,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    71
	0x04030201, 0x00776655,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    72
	0x04030201, 0x33776655,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    73
	0xf9de6484, 0xb504f333
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    74
	};
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    75
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    76
void Test1()
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    77
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    78
	test.Next(_L("Unary operators and shifts"));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    79
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    80
	const TUint32* p;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    81
	FOREACH(p,Table1,8)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    82
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    83
		I64 a(p);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    84
		TInt64 b = MAKE_TINT64(p[1], p[0]);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    85
		I64 c(b);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    86
		test(a==c);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    87
		TUint64 d = MAKE_TUINT64(p[1], p[0]);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    88
		I64 e(d);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    89
		test(a==e);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    90
		I64 c2(~b);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    91
		I64 c3(-b);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    92
		a.Not();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    93
		test(c2==a);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    94
		a.Not();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    95
		test(c==a);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    96
		a.Neg();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    97
		test(c3==a);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    98
		a.Neg();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
    99
		test(c==a);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   100
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   101
	FOREACH(p,Table1,8)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   102
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   103
		I64 a(p);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   104
		TInt64 s = MAKE_TINT64(p[1], p[0]);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   105
		TUint64 u = MAKE_TUINT64(p[1], p[0]);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   106
		TInt n;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   107
		for (n=0; n<64; ++n)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   108
			{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   109
			I64 b(a), c(a), d(a);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   110
			b.Lsl(n), c.Lsr(n), d.Asr(n);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   111
			TInt64 s2 = s<<n;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   112
			TInt64 s3 = s>>n;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   113
			TUint64 u2 = u<<n;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   114
			TUint64 u3 = u>>n;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   115
//			test.Printf(_L("s2=%lx\ns3=%lx\n,u2=%lx\n,u3=%lx\n"),s2,s3,u2,u3);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   116
			test(b == I64(s2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   117
			test(b == I64(u2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   118
			test(c == I64(u3));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   119
			test(d == I64(s3));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   120
			}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   121
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   122
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   123
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   124
const TUint32 Table2[] =
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   125
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   126
	0x00000000, 0x00000000, 0x00000000, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   127
	0x00000001, 0x00000000, 0x00000000, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   128
	0x05f5e100, 0x00000000, 0x000000cb, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   129
	0xffffff9c, 0xffffffff, 0x00129cbb, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   130
	0xffffcd03, 0xffffffff, 0xffff9123, 0xffffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   131
	0xf9de6484, 0xb504f333, 0xf9de6484, 0xb504f333,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   132
	0xf9de6484, 0xb504f333, 0x2168c235, 0xc90fdaa2,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   133
	0xf9de6484, 0xb504f333, 0x000000cb, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   134
	0xf9de6484, 0xb504f333, 0x800000cb, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   135
	0xf9de6484, 0xb504f333, 0x000000cb, 0x00000001,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   136
	0xf9de6484, 0xb504f333, 0xfffffed9, 0xffffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   137
	0xf9de6484, 0xb504f333, 0x197383db, 0xffffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   138
	0xf9de6484, 0xb504f333, 0x197383db, 0xffffffec,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   139
	0x38aa3b29, 0x5c17f0bc, 0x000019c7, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   140
	0x38aa3b29, 0x5c17f0bc, 0x800019c7, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   141
	0x38aa3b29, 0x5c17f0bc, 0x000019c7, 0x00000003,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   142
	0x38aa3b29, 0x5c17f0bc, 0x197383db, 0xffffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   143
	0x38aa3b29, 0x5c17f0bc, 0x197383db, 0xffffffec,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   144
	0x00123456, 0x00000000, 0x8cb9fc1b, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   145
	0x00000123, 0x00000000, 0x8cb9fc1b, 0x0000cc9f,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   146
	0xfffffe33, 0xffffffff, 0x8cb9fc1b, 0x0000cc9f
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   147
	};
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   148
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   149
void Test2(const TUint32* p)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   150
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   151
	I64 a(p), b(p+2);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   152
	TInt64 x = MAKE_TINT64(p[1], p[0]);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   153
	TInt64 y = MAKE_TINT64(p[3], p[2]);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   154
	TUint64 u = MAKE_TUINT64(p[1], p[0]);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   155
	TUint64 v = MAKE_TUINT64(p[3], p[2]);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   156
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   157
	I64 c(a); c.Add(b); test(c==I64(x+y)); test(c==I64(u+v));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   158
	test(c==I64(y+x)); test(c==I64(v+u));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   159
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   160
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   161
	I64 c(a); c.Sub(b); test(c==I64(x-y)); test(c==I64(u-v));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   162
	I64 d(b); d.Sub(a); test(d==I64(y-x)); test(d==I64(v-u));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   163
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   164
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   165
	I64 c(a); c.Mul(b); test(c==I64(x*y)); test(c==I64(u*v));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   166
	test(c==I64(y*x)); test(c==I64(v*u));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   167
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   168
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   169
	I128 c = a.LongMultS(b);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   170
	TUint32 t[4];
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   171
	Math::Mul64(x, y, *(TInt64*)(t+2), *(TUint64*)t);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   172
	test(c==I128(t));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   173
	Math::Mul64(y, x, *(TInt64*)(t+2), *(TUint64*)t);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   174
	test(c==I128(t));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   175
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   176
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   177
	I128 c = a.LongMultU(b);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   178
	TUint32 t[4];
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   179
	Math::UMul64(u, v, *(TUint64*)(t+2), *(TUint64*)t);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   180
	test(c==I128(t));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   181
	Math::UMul64(v, u, *(TUint64*)(t+2), *(TUint64*)t);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   182
	test(c==I128(t));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   183
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   184
	if (y!=0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   185
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   186
		I64 r; I64 q(a); q.DivS(b,r);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   187
		test(q==I64(x/y));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   188
		test(r==I64(x%y));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   189
		TInt64 r2;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   190
		TInt64 q2 = Math::DivMod64(x, y, r2);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   191
		test(q==I64(q2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   192
		test(r==I64(r2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   193
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   194
	if (x!=0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   195
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   196
		I64 r; I64 q(b); q.DivS(a,r);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   197
		test(q==I64(y/x));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   198
		test(r==I64(y%x));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   199
		TInt64 r2;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   200
		TInt64 q2 = Math::DivMod64(y, x, r2);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   201
		test(q==I64(q2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   202
		test(r==I64(r2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   203
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   204
	if (v!=0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   205
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   206
		I64 r; I64 q(a); q.DivU(b,r);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   207
		test(q==I64(u/v));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   208
		test(r==I64(u%v));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   209
		TUint64 r2;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   210
		TUint64 q2 = Math::UDivMod64(u, v, r2);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   211
		test(q==I64(q2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   212
		test(r==I64(r2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   213
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   214
	if (u!=0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   215
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   216
		I64 r; I64 q(b); q.DivU(a,r);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   217
		test(q==I64(v/u));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   218
		test(r==I64(v%u));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   219
		TUint64 r2;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   220
		TUint64 q2 = Math::UDivMod64(v, u, r2);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   221
		test(q==I64(q2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   222
		test(r==I64(r2));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   223
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   224
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   225
	TInt cmpu = a.CompareU(b);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   226
	TInt cmps = a.CompareS(b);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   227
	TInt equ = BOOL(u==v);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   228
	TInt neu = BOOL(u!=v);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   229
	TInt hi = BOOL(u>v);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   230
	TInt hs = BOOL(u>=v);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   231
	TInt lo = BOOL(u<v);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   232
	TInt ls = BOOL(u<=v);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   233
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   234
	TInt eqs = BOOL(x==y);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   235
	TInt nes = BOOL(x!=y);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   236
	TInt gt = BOOL(x>y);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   237
	TInt ge = BOOL(x>=y);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   238
	TInt lt = BOOL(x<y);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   239
	TInt le = BOOL(x<=y);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   240
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   241
	test(equ==eqs);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   242
	test(neu==nes);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   243
	test(equ!=neu);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   244
	if (cmpu>0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   245
		test(!equ && hi && hs && !lo && !ls);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   246
	else if (cmpu<0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   247
		test(!equ && !hi && !hs && lo && ls);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   248
	else
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   249
		test(equ && !hi && hs && !lo && ls);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   250
	if (cmps>0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   251
		test(!eqs && gt && ge && !lt && !le);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   252
	else if (cmps<0)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   253
		test(!eqs && !gt && !ge && lt && le);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   254
	else
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   255
		test(eqs && !gt && ge && !lt && le);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   256
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   257
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   258
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   259
void Test2()
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   260
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   261
	test.Next(_L("Test + - * / % (1)"));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   262
	const TUint32* p;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   263
	FOREACH(p,Table2,16)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   264
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   265
		Test2(p);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   266
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   267
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   268
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   269
void Test3()
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   270
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   271
	test.Next(_L("Test + - * / % (2)"));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   272
	TInt i;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   273
	for (i=0; i<100; ++i)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   274
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   275
		TUint32 p[4];
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   276
		p[0] = Random(Seed);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   277
		p[1] = Random(Seed);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   278
		p[2] = Random(Seed);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   279
		p[3] = Random(Seed);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   280
		Test2(p);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   281
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   282
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   283
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   284
void Test4()
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   285
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   286
	test.Next(_L("Test conversion to/from TReal"));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   287
	TReal x;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   288
	TReal limit=1048576.0*1048576.0*8192.0;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   289
	TInt64 t22 = (TInt64)limit;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   290
	test(t22 == TInt64(1)<<53);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   291
	TInt64 t23 = (TInt64)(limit-1.0);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   292
	test(t23 == (TInt64(1)<<53)-1);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   293
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   294
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   295
	TInt i;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   296
	TInt64 l;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   297
	for (i=-99; i<100; i++)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   298
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   299
		x=1;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   300
		l=1;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   301
		TReal a(i);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   302
		TInt64 b(i);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   303
		while (Abs(x)<limit)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   304
			{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   305
			TInt64 ll = (TInt64)x;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   306
//			test.Printf(_L("r64 %g -> i64 %lx (%lx)\n"), x, ll, l);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   307
			test(ll==l);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   308
			ll=0;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   309
			ll = (TInt64)x;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   310
			test(ll==l);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   311
			x*=a;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   312
			l*=b;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   313
			if (i==1 || i==0 || (i==-1 && l==TInt64(1)))
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   314
				break;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   315
			}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   316
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   317
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   318
	TReal i64limit = 1024.0*limit;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   319
	l=MAKE_TINT64(0x7fffffff,0xfffffc00);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   320
	x=(TReal)l;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   321
	test(x==i64limit-1024.0);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   322
	l=MAKE_TINT64(0x80000000,0x00000000);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   323
	x=(TReal)l;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   324
	test(x==-i64limit);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   325
	l=MAKE_TINT64(0x80000000,0x00000400);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   326
	x=(TReal)l;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   327
	test(x==1024.0-i64limit);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   328
	l=MAKE_TINT64(0x00000001,0x00000000);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   329
	x=(TReal)l;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   330
	test(x==65536.0*65536.0);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   331
	l=MAKE_TINT64(0xffffffff,0x00000000);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   332
	x=(TReal)l;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   333
	test(x==-65536.0*65536.0);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   334
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   335
	for (i=-99; i<100; i++)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   336
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   337
		x=1;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   338
		l=1;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   339
		TReal a(i);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   340
		TInt64 b(i);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   341
		while (Abs(x)<limit)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   342
			{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   343
			TReal y = (TReal)l;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   344
			test(y==x);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   345
			x*=a;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   346
			l*=b;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   347
			if (i==1 || i==0 || (i==-1 && l==TInt64(1)))
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   348
				break;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   349
			}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   350
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   351
 
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   352
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   353
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   354
_LIT8(KTestHex8,"0 1 8 a 1b 2c7 10000000 100000000 1901cbfdc b504f333f9de6484 ffffffffffffffff");
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   355
_LIT16(KTestHex16,"0 1 8 a 1b 2c7 10000000 100000000 1901cbfdc b504f333f9de6484 ffffffffffffffff");
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   356
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   357
const TUint32 TestHexTable[] =
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   358
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   359
	0x00000000, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   360
	0x00000001, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   361
	0x00000008, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   362
	0x0000000a, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   363
	0x0000001b, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   364
	0x000002c7, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   365
	0x10000000, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   366
	0x00000000, 0x00000001,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   367
	0x901cbfdc, 0x00000001,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   368
	0xf9de6484, 0xb504f333,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   369
	0xffffffff, 0xffffffff
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   370
	};
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   371
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   372
_LIT8(KTestDec8,"0 1 8 100 6561 536870912 2147483648 4294967295 4294967296 549755813888 1000000000000000 9223372036854775807	\
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   373
					-9223372036854775808 -9223372036854775807 -9000000000000000000 -1099511627776 -4294967296 -1000 -1");
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   374
_LIT16(KTestDec16,"0 1 8 100 6561 536870912 2147483648 4294967295 4294967296 549755813888 1000000000000000 9223372036854775807	\
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   375
					-9223372036854775808 -9223372036854775807 -9000000000000000000 -1099511627776 -4294967296 -1000 -1");
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   376
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   377
const TUint32 TestDecTable[] =
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   378
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   379
	0x00000000, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   380
	0x00000001, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   381
	0x00000008, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   382
	0x00000064, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   383
	0x000019a1, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   384
	0x20000000, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   385
	0x80000000, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   386
	0xffffffff, 0x00000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   387
	0x00000000, 0x00000001,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   388
	0x00000000, 0x00000080,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   389
	0xa4c68000, 0x00038d7e,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   390
	0xffffffff, 0x7fffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   391
	0x00000000, 0x80000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   392
	0x00000001, 0x80000000,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   393
	0x1d7c0000, 0x831993af,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   394
	0x00000000, 0xffffff00,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   395
	0x00000000, 0xffffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   396
	0xfffffc18, 0xffffffff,
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   397
	0xffffffff, 0xffffffff
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   398
	};
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   399
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   400
void Test5()
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   401
	{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   402
	test.Next(_L("Test conversion to/from text"));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   403
	TLex8 lex8;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   404
	lex8.Assign(KTestHex8());
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   405
	TInt64 u;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   406
	const TUint32* p = TestHexTable;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   407
	for (; !lex8.Eos(); lex8.SkipSpace(), p+=2)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   408
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   409
		lex8.Mark();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   410
		test(lex8.Val(u,EHex)==KErrNone);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   411
		test(u == MAKE_TINT64(p[1], p[0]));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   412
		TPtrC8 text = lex8.MarkedToken();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   413
		TBuf8<64> b;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   414
		b.Num(u,EHex);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   415
		test(b==text);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   416
		b.NumUC(u,EHex);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   417
		TBuf8<64> uc = text;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   418
		uc.UpperCase();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   419
		test(b==uc);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   420
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   421
	lex8.Assign(KTestDec8());
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   422
	TInt64 s;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   423
	p = TestDecTable;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   424
	for (; !lex8.Eos(); lex8.SkipSpace(), p+=2)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   425
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   426
		lex8.Mark();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   427
		test(lex8.Val(s)==KErrNone);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   428
		test(s == MAKE_TINT64(p[1], p[0]));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   429
		TPtrC8 text = lex8.MarkedToken();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   430
		TBuf8<64> b;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   431
		b.Num(s);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   432
		test(b==text);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   433
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   434
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   435
	TLex16 lex16;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   436
	lex16.Assign(KTestHex16());
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   437
	p = TestHexTable;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   438
	for (; !lex16.Eos(); lex16.SkipSpace(), p+=2)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   439
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   440
		lex16.Mark();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   441
		test(lex16.Val(u,EHex)==KErrNone);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   442
		test(u == MAKE_TINT64(p[1], p[0]));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   443
		TPtrC16 text = lex16.MarkedToken();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   444
		TBuf16<64> b;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   445
		b.Num(u,EHex);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   446
		test(b==text);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   447
		b.NumUC(u,EHex);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   448
		TBuf16<64> uc = text;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   449
		uc.UpperCase();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   450
		test(b==uc);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   451
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   452
	lex16.Assign(KTestDec16());
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   453
	p = TestDecTable;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   454
	for (; !lex16.Eos(); lex16.SkipSpace(), p+=2)
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   455
		{
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   456
		lex16.Mark();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   457
		test(lex16.Val(s)==KErrNone);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   458
		test(s == MAKE_TINT64(p[1], p[0]));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   459
		TPtrC16 text = lex16.MarkedToken();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   460
		TBuf16<64> b;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   461
		b.Num(s);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   462
		test(b==text);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   463
		}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   464
	}
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   465
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   466
GLDEF_C TInt E32Main()
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   467
    {
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   468
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   469
	Seed[0] = 0xb8aa3b29;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   470
	Seed[1] = 0;
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   471
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   472
	test.Title();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   473
	test.Start(_L("Testing 64 bit integers"));
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   474
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   475
	Test1();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   476
	Test2();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   477
	Test3();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   478
	Test4();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   479
	Test5();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   480
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   481
	test.End();
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   482
	return(KErrNone);
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   483
    }
0a7b44b10206 Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff changeset
   484