os/persistentdata/persistentstorage/sqlite3api/TEST/t_sqlitedb64.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/t_sqlitedb64.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,452 @@
     1.4 +// Copyright (c) 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 "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 +//
    1.18 +#include <e32test.h>
    1.19 +#include <bautils.h>
    1.20 +#include <f32file64.h>
    1.21 +#include <e32math.h>
    1.22 +#include <hal.h>
    1.23 +#include <sqlite3.h>
    1.24 +#include <string.h>
    1.25 +#include <stdio.h>
    1.26 +
    1.27 +///////////////////////////////////////////////////////////////////////////////////////
    1.28 +
    1.29 +RTest TheTest(_L("t_sqlitedb64 test"));
    1.30 +
    1.31 +_LIT(KTestDbName,	"\\test\\t_sqlitedb64.db");
    1.32 +
    1.33 +RFs TheFs;
    1.34 +
    1.35 +sqlite3* TheDb = 0;
    1.36 +sqlite3_stmt* TheStmt = 0;
    1.37 +
    1.38 +const TInt64 K1Mb = 1024LL * 1024LL;
    1.39 +const TInt64 K1Gb = 1024LL * K1Mb;
    1.40 +const TInt64 K4Gb = 4LL * K1Gb;
    1.41 +
    1.42 +TInt64 TheLastInsertedRowid = -1LL;
    1.43 +
    1.44 +struct TTestDriveInfo
    1.45 +	{
    1.46 +	TInt	iSizeMb;	
    1.47 +	TBool	iWritable;	
    1.48 +	};
    1.49 +	
    1.50 +TTestDriveInfo TheDriveInfo[KMaxDrives];
    1.51 +TInt   		   TheBiggestDriveNo = -1;
    1.52 +TFileName 	   TheDbName;
    1.53 +char		   TheDbName8[KMaxFileName];
    1.54 +
    1.55 +///////////////////////////////////////////////////////////////////////////////////////
    1.56 +
    1.57 +static void DeleteTestFiles()
    1.58 +	{
    1.59 +	if(TheStmt)
    1.60 +		{
    1.61 +		sqlite3_finalize(TheStmt);	
    1.62 +		TheStmt = 0;
    1.63 +		}
    1.64 +	if(TheDb)
    1.65 +		{
    1.66 +		(void)sqlite3_close(TheDb);
    1.67 +		TheDb = 0;
    1.68 +		}
    1.69 +	(void)TheFs.Delete(TheDbName);
    1.70 +	}
    1.71 +
    1.72 +///////////////////////////////////////////////////////////////////////////////////////
    1.73 +static void PrintSqliteErrMsg()
    1.74 +	{
    1.75 +	if(TheDb)
    1.76 +		{
    1.77 +		const char* msg = sqlite3_errmsg(TheDb);
    1.78 +		TBuf<200> buf;
    1.79 +		buf.Copy(TPtrC8((const TUint8*)msg));
    1.80 +		TheTest.Printf(_L("*** SQLite error message: \"%S\"\r\n"), &buf);
    1.81 +		}
    1.82 +	}
    1.83 +
    1.84 +//Test macros and functions
    1.85 +static void Check(TInt aValue, TInt aLine)
    1.86 +	{
    1.87 +	if(!aValue)
    1.88 +		{
    1.89 +		DeleteTestFiles();
    1.90 +		PrintSqliteErrMsg();
    1.91 +		TheTest(EFalse, aLine);
    1.92 +		}
    1.93 +	}
    1.94 +static void Check(TInt aValue, TInt aExpected, TInt aLine)
    1.95 +	{
    1.96 +	if(aValue != aExpected)
    1.97 +		{
    1.98 +		DeleteTestFiles();
    1.99 +		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
   1.100 +		PrintSqliteErrMsg();
   1.101 +		TheTest(EFalse, aLine);
   1.102 +		}
   1.103 +	}
   1.104 +#define TEST(arg) ::Check((arg), __LINE__)
   1.105 +#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
   1.106 +
   1.107 +///////////////////////////////////////////////////////////////////////////////////////
   1.108 +
   1.109 +void SqlTimerPrint(const TDesC& aText, TUint32 aStartTicks, TUint32 aEndTicks)
   1.110 +	{
   1.111 +	static TInt freq = 0;
   1.112 +	if(freq == 0)
   1.113 +		{
   1.114 +		TEST2(HAL::Get(HAL::EFastCounterFrequency, freq), KErrNone);
   1.115 +		}
   1.116 +	TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks;
   1.117 +	if(diffTicks < 0)
   1.118 +		{
   1.119 +		diffTicks = KMaxTUint32 + diffTicks + 1;
   1.120 +		}
   1.121 +	const TInt KMicroSecIn1Sec = 1000000;
   1.122 +	TInt32 us = (diffTicks * KMicroSecIn1Sec) / freq;
   1.123 +	TheTest.Printf(_L("#### %S. Execution time: %d us\r\n"), &aText, us);
   1.124 +	}
   1.125 +
   1.126 +TUint32 SqlTimerTicks()
   1.127 +	{
   1.128 +	return User::FastCounter();
   1.129 +	}
   1.130 +
   1.131 +void CollectDriveInfo()
   1.132 +	{
   1.133 +	TheTest.Printf(_L("==================\r\n"));
   1.134 +	_LIT(KType1, "Not present");
   1.135 +	_LIT(KType2, "Unknown");
   1.136 +	_LIT(KType3, "Floppy");
   1.137 +	_LIT(KType4, "Hard disk");
   1.138 +	_LIT(KType5, "CD ROM");
   1.139 +	_LIT(KType6, "RAM disk");
   1.140 +	_LIT(KType7, "Flash");
   1.141 +	_LIT(KType8, "ROM drive");
   1.142 +	_LIT(KType9, "Remote drive");
   1.143 +	_LIT(KType10,"NAND flash");
   1.144 +	_LIT(KType11,"Rotating media");
   1.145 +	
   1.146 +	Mem::FillZ(TheDriveInfo, sizeof(TheDriveInfo));
   1.147 +	TheBiggestDriveNo = 0;
   1.148 +	
   1.149 +	for(TInt drive=EDriveA;drive<=EDriveZ;++drive)
   1.150 +		{
   1.151 +		TDriveInfo driveInfo;
   1.152 +		TInt err = TheFs.Drive(driveInfo, drive);
   1.153 +		if(err == KErrNone)
   1.154 +			{
   1.155 +			TVolumeInfo vinfo;
   1.156 +			err = TheFs.Volume(vinfo, drive);
   1.157 +			if(err == KErrNone)
   1.158 +				{
   1.159 +				TVolumeIOParamInfo vparam;
   1.160 +				err = TheFs.VolumeIOParam(drive, vparam);
   1.161 +				TEST2(err, KErrNone);
   1.162 +				TBuf8<128> vinfoex8;
   1.163 +				err = TheFs.QueryVolumeInfoExt(drive, EFileSystemSubType, vinfoex8);
   1.164 +				TEST2(err, KErrNone);
   1.165 +				TPtrC vinfoex((const TUint16*)(vinfoex8.Ptr() + 8), vinfoex8[0]);
   1.166 +				TPtrC KMediaTypeNames[] = {KType1(), KType2(), KType3(), KType4(), KType5(), KType6(), KType7(), KType8(), KType9(), KType10(), KType11()};
   1.167 +				TInt sizeMb = vinfo.iSize / K1Mb;
   1.168 +				TheTest.Printf(_L("Drive: %C:, Type: %16.16S, File System: %8.8S, Size: %d Mb.\r\n"), 'A' + drive, &KMediaTypeNames[driveInfo.iType], &vinfoex, sizeMb);
   1.169 +				TheTest.Printf(_L("       Block size=%d, Cluster size=%d, Read buffer size=%d.\r\n"), vparam.iBlockSize, vparam.iClusterSize, vparam.iRecReadBufSize);
   1.170 +				TheDriveInfo[drive].iSizeMb = sizeMb;
   1.171 +				if(driveInfo.iType == EMediaRam || driveInfo.iType == EMediaHardDisk || driveInfo.iType == EMediaFlash || driveInfo.iType == EMediaNANDFlash)
   1.172 +				  	{
   1.173 +					TheDriveInfo[drive].iWritable = ETrue;
   1.174 +					if(sizeMb > TheDriveInfo[TheBiggestDriveNo].iSizeMb)
   1.175 +						{
   1.176 +						TheBiggestDriveNo = drive;
   1.177 +						}
   1.178 +					}
   1.179 +				}
   1.180 +			else
   1.181 +				{
   1.182 +				TheTest.Printf(_L("Drive %C. RFs::Volume() has failed with err=%d.\r\n"), 'A' + drive, err);	
   1.183 +				}
   1.184 +			}
   1.185 +		else
   1.186 +			{
   1.187 +			TheTest.Printf(_L("Drive %C. RFs::Drive() has failed with err=%d.\r\n"), 'A' + drive, err);	
   1.188 +			}
   1.189 +		}
   1.190 +		
   1.191 +	TheTest.Printf(_L("The biggest R/W drive is: %C, Size: %d Mb\r\n"), 'A' + TheBiggestDriveNo, TheDriveInfo[TheBiggestDriveNo].iSizeMb);
   1.192 +	TDriveUnit drvUnit(TheBiggestDriveNo);
   1.193 +	TDriveName drvName = drvUnit.Name();
   1.194 +	TParse parse;
   1.195 +	parse.Set(KTestDbName, &drvName, NULL);
   1.196 +	TheDbName.Copy(parse.FullName());
   1.197 +	TPtr8 p((TUint8*)TheDbName8, 0, KMaxFileName);
   1.198 +	p.Copy(TheDbName);
   1.199 +	p.Append(TChar(0));
   1.200 +
   1.201 +	TRAPD(err, BaflUtils::EnsurePathExistsL(TheFs, TheDbName));
   1.202 +	TEST(err == KErrNone || err == KErrAlreadyExists);
   1.203 +
   1.204 +	TheTest.Printf(_L("==================\r\n"));
   1.205 +	}
   1.206 +
   1.207 +///////////////////////////////////////////////////////////////////////////////////////
   1.208 +
   1.209 +/**
   1.210 +@SYMTestCaseID			PDS-SQLITE3-CT-4041
   1.211 +@SYMTestCaseDesc		Creation of a database bigger than 4Gb (KMaxTUint).
   1.212 +						The test creates a test database with a table and inserts records into the table
   1.213 +						until the database size gets bigger than 4Gb (KMaxTUint). The purpose of the test is to verify
   1.214 +						that it is possible to create and manipulate 64-bit SQLite databases.
   1.215 +@SYMTestActions			Creation of a database bigger than 4Gb (KMaxTUint).
   1.216 +@SYMTestExpectedResults Test must not fail
   1.217 +@SYMTestPriority 	    High
   1.218 +@SYMREQ					REQ12107
   1.219 +                        REQ12108
   1.220 +*/
   1.221 +void CreateBigDbTest(TInt64 aDbSize)
   1.222 +	{
   1.223 +	__ASSERT_ALWAYS(aDbSize > 0LL, User::Invariant());
   1.224 +	(void)TheFs.Delete(TheDbName);
   1.225 +
   1.226 +	const char* ver = sqlite3_libversion();
   1.227 +	TBuf<20> buf;
   1.228 +	buf.Copy(TPtrC8((const TUint8*)ver));
   1.229 +	TheTest.Printf(_L("*** SQLite library version: \"%S\"\r\n"), &buf);
   1.230 +	
   1.231 +	TInt err = sqlite3_open(TheDbName8, &TheDb);
   1.232 +	TEST2(err, SQLITE_OK);
   1.233 +	
   1.234 +	//
   1.235 +	err = sqlite3_exec(TheDb, "CREATE TABLE A(Id INTEGER PRIMARY KEY AUTOINCREMENT, Data BLOB)", 0, 0, 0);
   1.236 +	TEST2(err, SQLITE_OK);
   1.237 +	TInt64 fsize = 0;
   1.238 +	TheTest.Printf(_L("==File size:"));
   1.239 +	while(fsize < aDbSize)
   1.240 +		{
   1.241 +		const TInt KRecCnt = 1000;
   1.242 +		//Insert KRecCnt records in a transaction
   1.243 +		err = sqlite3_exec(TheDb, "BEGIN", 0, 0, 0);	
   1.244 +		if(err != SQLITE_OK)
   1.245 +			{
   1.246 +			TheTest.Printf(_L("==='BEGIN' has failed with err %d\r\n"), err);
   1.247 +			}
   1.248 +		TEST2(err, SQLITE_OK);
   1.249 +		err = sqlite3_prepare(TheDb, "INSERT INTO A(Data) VALUES(zeroblob(32768))", -1, &TheStmt, 0);//32Kb big blob
   1.250 +		TEST2(err, SQLITE_OK);
   1.251 +		for(TInt i=0;i<KRecCnt;++i)
   1.252 +			{
   1.253 +			err = sqlite3_step(TheStmt);
   1.254 +			TEST2(err, SQLITE_DONE);
   1.255 +			err = sqlite3_reset(TheStmt);
   1.256 +			TEST2(err, SQLITE_OK);
   1.257 +			}
   1.258 +		err = sqlite3_finalize(TheStmt);
   1.259 +		TEST2(err, SQLITE_OK);
   1.260 +		TheStmt = 0;
   1.261 +		err = sqlite3_exec(TheDb, "COMMIT", 0, 0, 0);	
   1.262 +		if(err != SQLITE_OK)
   1.263 +			{
   1.264 +			TheTest.Printf(_L("==='COMMIT' has failed with err %d\r\n"), err);	
   1.265 +			}
   1.266 +		TEST2(err, SQLITE_OK);
   1.267 +		TheLastInsertedRowid = sqlite3_last_insert_rowid(TheDb);
   1.268 +		TEST(TheLastInsertedRowid > 0LL);
   1.269 +		//Check and print the file size
   1.270 +		sqlite3_close(TheDb);
   1.271 +		TheDb = 0;
   1.272 +		RFile64 file;
   1.273 +		err = file.Open(TheFs, TheDbName, EFileRead | EFileWrite);
   1.274 +		TEST2(err, KErrNone);
   1.275 +		err = file.Size(fsize);
   1.276 +		TEST2(err, KErrNone);
   1.277 +		file.Close();
   1.278 +		TheTest.Printf(_L(" %ldMb"), fsize / K1Mb);
   1.279 +		err = sqlite3_open(TheDbName8, &TheDb);
   1.280 +		TEST2(err, SQLITE_OK);
   1.281 +		}
   1.282 +	TheTest.Printf(_L("\r\n"));
   1.283 +	//
   1.284 +	sqlite3_close(TheDb);
   1.285 +	TheDb = 0;
   1.286 +	}
   1.287 +
   1.288 +/**
   1.289 +@SYMTestCaseID			PDS-SQLITE3-CT-4042
   1.290 +@SYMTestCaseDesc		SQLite operations on a 64-bit database.
   1.291 +						The test uses the database created in test case PDS-SQLITE3-UT-4041.
   1.292 +						Simple INSERT, UPDATE, DELETE and SELECT statements are executed on the database.
   1.293 +						The data in the test SQL statements is such that the manipulated records are beyond the 4Gb
   1.294 +						file offset. Some other of the test SQL statements will perform sequential scan of the whole
   1.295 +						database from offset 0 to the end of the database file.
   1.296 +						The purpose of the test is to verify that there are no problem if the database offset is 64-bit.
   1.297 +@SYMTestActions			SQLite operations on a 64-bit database.
   1.298 +@SYMTestExpectedResults Test must not fail
   1.299 +@SYMTestPriority 	    High
   1.300 +@SYMREQ					REQ12107
   1.301 +                        REQ12108
   1.302 +*/
   1.303 +void SimpleDbOperationsTest()
   1.304 +	{
   1.305 +	__ASSERT_ALWAYS(TheLastInsertedRowid > 0LL, User::Invariant());
   1.306 +	TInt err = sqlite3_open(TheDbName8, &TheDb);
   1.307 +	TEST2(err, SQLITE_OK);
   1.308 +
   1.309 +	//SELECT-1
   1.310 +	TUint32 start = SqlTimerTicks();
   1.311 +	err = sqlite3_prepare(TheDb, "SELECT Id FROM A WHERE ROWID = :Prm", -1, &TheStmt, 0);
   1.312 +	TEST2(err, SQLITE_OK);
   1.313 +	err = sqlite3_bind_int64(TheStmt, 1, TheLastInsertedRowid - 1LL);
   1.314 +	TEST2(err, SQLITE_OK);
   1.315 +	err = sqlite3_step(TheStmt);
   1.316 +	TEST2(err, SQLITE_ROW);
   1.317 +	TInt64 id = sqlite3_column_int64(TheStmt, 0);
   1.318 +	TheTest.Printf(_L("==Id=%ld\r\n"), id);
   1.319 +	sqlite3_finalize(TheStmt);
   1.320 +	TheStmt = 0;
   1.321 +	TUint32 end = SqlTimerTicks();
   1.322 +	SqlTimerPrint(_L("SELECT-1"), start, end);
   1.323 +
   1.324 +	//INSERT
   1.325 +	start = SqlTimerTicks();
   1.326 +	err = sqlite3_exec(TheDb, "INSERT INTO A(Data) VALUES('123456')", 0, 0, 0);
   1.327 +	TEST2(err, SQLITE_OK);
   1.328 +	end = SqlTimerTicks();
   1.329 +	TInt cnt = sqlite3_changes(TheDb);
   1.330 +	TEST2(cnt, 1);
   1.331 +	SqlTimerPrint(_L("INSERT"), start, end);
   1.332 +	
   1.333 +	//UPDATE
   1.334 +	start = SqlTimerTicks();
   1.335 +	TBuf<100> sql;
   1.336 +	sql.Format(_L("UPDATE A SET Data='56789' WHERE Id=%ld"), id);
   1.337 +	TBuf8<100> sql8;
   1.338 +	sql8.Copy(sql);
   1.339 +	err = sqlite3_exec(TheDb, (const char*)sql8.PtrZ(), 0, 0, 0);
   1.340 +	TEST2(err, SQLITE_OK);
   1.341 +	end = SqlTimerTicks();
   1.342 +	cnt = sqlite3_changes(TheDb);
   1.343 +	TEST2(cnt, 1);
   1.344 +	SqlTimerPrint(_L("UPDATE"), start, end);
   1.345 +	
   1.346 +	//SELECT-2
   1.347 +	start = SqlTimerTicks();
   1.348 +	sql.Format(_L("SELECT Data FROM A WHERE ID = %ld"), id);
   1.349 +	sql8.Copy(sql);
   1.350 +	err = sqlite3_prepare(TheDb, (const char*)sql8.PtrZ(), -1, &TheStmt, 0);
   1.351 +	TEST2(err, SQLITE_OK);
   1.352 +	err = sqlite3_step(TheStmt);
   1.353 +	TEST2(err, SQLITE_ROW);
   1.354 +	const char* data = (const char*)sqlite3_column_text(TheStmt, 0);
   1.355 +	TEST(data != 0);
   1.356 +	err = strcmp(data, "56789");
   1.357 +	TEST2(err, 0);
   1.358 +	sqlite3_finalize(TheStmt);
   1.359 +	TheStmt = 0;
   1.360 +	end = SqlTimerTicks();
   1.361 +	SqlTimerPrint(_L("SELECT-2"), start, end);
   1.362 +	
   1.363 +	//SELECT-3
   1.364 +	start = SqlTimerTicks();
   1.365 +	err = sqlite3_prepare(TheDb, "SELECT COUNT(*) FROM A", -1, &TheStmt, 0);
   1.366 +	TEST2(err, SQLITE_OK);
   1.367 +	err = sqlite3_step(TheStmt);
   1.368 +	TEST2(err, SQLITE_ROW);
   1.369 +	TInt recCnt = sqlite3_column_int(TheStmt, 0);
   1.370 +	TheTest.Printf(_L("==Records count: %d\r\n"), recCnt);
   1.371 +	sqlite3_finalize(TheStmt);
   1.372 +	TheStmt = 0;
   1.373 +	end = SqlTimerTicks();
   1.374 +	SqlTimerPrint(_L("SELECT-3"), start, end);
   1.375 +	TEST(recCnt > 0);
   1.376 +
   1.377 +	//SELECT-4
   1.378 +	start = SqlTimerTicks();
   1.379 +	err = sqlite3_prepare(TheDb, "SELECT MAX(ROWID) FROM A", -1, &TheStmt, 0);
   1.380 +	TEST2(err, SQLITE_OK);
   1.381 +	err = sqlite3_step(TheStmt);
   1.382 +	TEST2(err, SQLITE_ROW);
   1.383 +	TInt rowid = sqlite3_column_int(TheStmt, 0);
   1.384 +	TheTest.Printf(_L("==MAX(ROWID): %d\r\n"), recCnt);
   1.385 +	sqlite3_finalize(TheStmt);
   1.386 +	TheStmt = 0;
   1.387 +	end = SqlTimerTicks();
   1.388 +	SqlTimerPrint(_L("SELECT-4"), start, end);
   1.389 +	TEST(rowid > 0);
   1.390 +	
   1.391 +	//DELETE
   1.392 +	start = SqlTimerTicks();
   1.393 +	sql.Format(_L("DELETE FROM A WHERE ID = %ld"), id);
   1.394 +	sql8.Copy(sql);
   1.395 +	err = sqlite3_exec(TheDb, (const char*)sql8.PtrZ(), 0, 0, 0);
   1.396 +	TEST2(err, SQLITE_OK);
   1.397 +	end = SqlTimerTicks();
   1.398 +	cnt = sqlite3_changes(TheDb);
   1.399 +	TEST2(cnt, 1);
   1.400 +	SqlTimerPrint(_L("DELETE"), start, end);
   1.401 +	
   1.402 +	sqlite3_close(TheDb);
   1.403 +	TheDb = 0;
   1.404 +	}
   1.405 +
   1.406 +///////////////////////////////////////////////////////////////////////////////////////
   1.407 +
   1.408 +static void DoTests()
   1.409 +	{
   1.410 +	TheTest.Start(_L("Collect drive information"));
   1.411 +	CollectDriveInfo();
   1.412 +	
   1.413 +	TInt64 maxDrvSize = TheDriveInfo[TheBiggestDriveNo].iSizeMb * K1Mb;
   1.414 +	if(maxDrvSize <= K4Gb)
   1.415 +		{
   1.416 +		TheTest.Printf(_L("There is no drive bigger than 4Gb. The tests won't be executed.\r\n"));
   1.417 +		return;	
   1.418 +		}
   1.419 +	
   1.420 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-SQLITE3-CT-4041 Create database, bigger than 4Gb"));
   1.421 +	CreateBigDbTest(K4Gb + 64 * K1Mb);
   1.422 +
   1.423 +	TheTest.Next (_L("  @SYMTestCaseID:PDS-SQLITE3-CT-4042 64-bit database - simple operations test"));
   1.424 +	SimpleDbOperationsTest();
   1.425 +
   1.426 +	(void)TheFs.Delete(TheDbName);
   1.427 +	}
   1.428 +
   1.429 +TInt E32Main()
   1.430 +	{
   1.431 +	TheTest.Title();
   1.432 +
   1.433 +	CTrapCleanup* tc = CTrapCleanup::New();
   1.434 +	TheTest(tc != NULL);
   1.435 +
   1.436 +	__UHEAP_MARK;
   1.437 +
   1.438 +	TInt err = TheFs.Connect();
   1.439 +	TheTest(err == KErrNone);
   1.440 +
   1.441 +	DeleteTestFiles();
   1.442 +	DoTests();
   1.443 +	DeleteTestFiles();
   1.444 +
   1.445 +	__UHEAP_MARKEND;
   1.446 +
   1.447 +	TheFs.Close();
   1.448 +	TheTest.End();
   1.449 +	TheTest.Close();
   1.450 +
   1.451 +	delete tc;
   1.452 +
   1.453 +	User::Heap().Check();
   1.454 +	return KErrNone;
   1.455 +	}