Пример #1
0
/**
@SYMTestCaseID          SYSLIB-BAFL-CT-0435
@SYMTestCaseDesc        Tests for TResourceReader::ReadInt16(),TResourceReader::ReadInt64() function
@SYMTestPriority        High
@SYMTestActions         Attempt for reading FLPTED resource
@SYMTestExpectedResults Tests must not fail
@SYMREQ                 REQ0000
*/
void TRsReadTester::TestFlPtEdL()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0435 Test reading FLPTED resource "));
    TResourceReader reader;
    CreateResourceReaderLC(reader,SYS_FLPTED_ONE);
    test(reader.ReadInt16()==18);
    TReal little=reader.ReadReal64();
    test(little==0.0);
    TReal big=reader.ReadReal64();
    test(big>9.89e99);
    test(big<9.91e99);
    CleanupStack::PopAndDestroy(1);
	}
Пример #2
0
TBool CSuspendTest::ValidateBlock( TInt aBlockNumber, TUint32 aFillWord )
	//
	// Checks that every word in block aBlockNumber has the value aFillWord
	//
	{
	TUint offset = aBlockNumber * iBlockSize;
	test.Printf( _L("Validating block %d (offs=0x%x)\n"), aBlockNumber, offset );
	
	TBool failed = EFalse;
	const TInt readBufLen = iReadBuffer.MaxLength();

	for( TInt len = iBlockSize; len > 0 && !failed ;)
		{
		TInt r = iDrive.Read( offset, readBufLen, iReadBuffer );
		if( r != KErrNone )
			{
			test.Printf( _L("... FAIL: read failed (%d) at offset 0x%x\n"), r, offset );
			test( KErrNone == r );
			}
		test( iReadBuffer.Length() == readBufLen );

		TUint32* p = (TUint32*)iReadBuffer.Ptr();
		for( TInt i = 0; i < readBufLen; i += 4 )
			{
			if( aFillWord != *p )
				{
				failed = ETrue;
				test.Printf( _L("... FAILED: word @ offs=0x%x, read=0x%x, expected=0x%x\n"), 
								offset+i, p[0], aFillWord );
				break;
				}
			++p;
			}
		offset += readBufLen;
		len -= readBufLen;
		}
	
	return !failed;
	}
TInt E32Main()
	{
	__UHEAP_MARK;
	test.Title();
	test.Start(_L("initialising"));

	CTrapCleanup* c=CTrapCleanup::New();

	// start the loader
	RFs fs;
	test (fs.Connect()==KErrNone);
	fs.Close();

	test (c!=0);
	TRAPD(r,MainL());
	test (r==KErrNone);
	delete c;
	test.End();
	test.Close();
	__UHEAP_MARKEND;
	return KErrNone;
	}
Пример #4
0
/** 
@SYMTestCaseID          PDS-DBMS-UT-4009
@SYMTestCaseDesc        DBMS performance tests.
@SYMTestPriority        High
@SYMTestActions        	The test opens the test database and:
						- selects the ids of the tracks to be deleted and collects them into an array;
						- deletes the recods with matching track ids from TRACK table;
						- deletes the recods with matching track ids from TRACK2 table;
						The execution times are printed out.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ7141
*/
void DeleteTracksL()
	{
	TheTest.Printf(_L("Record count: %d\r\n"), KTrackRecordCount);
	
	RArray<TInt> tracks;
	tracks.ReserveL(KTrackRecordCount);
	CleanupClosePushL(tracks);
	SelectTracksL(KTrackRecordCount, tracks);
	//
	_LIT(KDeleteSql, "DELETE FROM tracks  WHERE id>=%d AND id<=%d");

	TBuf<100> sql;
	sql.Format(KDeleteSql, tracks[0], tracks[tracks.Count() - 1]);

	TUint32 fc2 = User::FastCounter();

	TInt err = TheDatabase.Begin();
	TEST2(err, KErrNone);
	
	TUint32 fc = User::FastCounter();
	TInt rc = TheDatabase.Execute(sql);
	PrintFcDiffAsUs(_L("###\"DELETE FROM TRACKS\",time=%d us\r\n"), CalcTickDiff(fc, User::FastCounter()));
	TEST2(rc, KTrackRecordCount);
	TheTest.Printf(_L("Deleted record count: %d\r\n"), rc);

	sql.Replace(12, 6, _L("TRACKS2"));
	fc = User::FastCounter();
	rc = TheDatabase.Execute(sql);
	PrintFcDiffAsUs(_L("###\"DELETE FROM TRACKS2\",time=%d us\r\n"), CalcTickDiff(fc, User::FastCounter()));
	TEST2(rc, KTrackRecordCount);
	TheTest.Printf(_L("Deleted record count: %d\r\n"), rc);

	err = TheDatabase.Commit();
	TEST2(err, KErrNone);

	PrintFcDiffAsUs(_L("###Total \"DELETE FROM TRACKS\",time=%d us\r\n"), CalcTickDiff(fc2, User::FastCounter()));
	
	CleanupStack::PopAndDestroy(&tracks);
	}
Пример #5
0
static void TestFileSeek()
//
// Benchmark file seek method
//
{
    ClearSessionDirectory();
    test.Next(_L("RFile::Seek method"));
    TInt increment=1789; // random number > cluster size
    TInt count=0;
    TInt pos=0;

    // Create test file
    TBuf8<1024> testdata(1024);
    RFile f;
    TInt r=f.Create(TheFs,_L("SEEKTEST"),EFileStream);
    test_KErrNone(r);
    count=64;
    while (count--)
        f.Write(testdata);
    TInt fileSize=count*testdata.MaxLength();

    pos=0;
    count=0;
    RTimer timer;
    timer.CreateLocal();
    TRequestStatus reqStat;
    timer.After(reqStat,10000000); // After 10 secs
    while(reqStat==KRequestPending)
    {
        TInt dum=(pos+=increment)%fileSize;
        f.Seek(ESeekStart,dum);
        count++;
    }
    test.Printf(_L("RFile::Seek operations in 10 secs == %d\n"),count);
    timer.Close();

    f.Close();
    TheFs.Delete(_L("SEEKTEST"));
}
Пример #6
0
void TTestCase::SelfTest()
	{
	test.Start(_L("Unit test of TTestCase::TestCaseValid\n"));

// Create a TTestCase with paramaters CAP1 and CAP2
// call TTestCase::TestCaseValid against CAPSET
// Expected result is EXPCT
#define TEST_TEST_CASE(CAP1, CAP2, CAPSET, EXPCT)\
	{\
	test.Next(_L(#CAP1 L", " L ## #CAP2 L" -- Against: " L ## #CAPSET L", Expect: " L ## #EXPCT));\
	TTestCase testCase(NULL, EFalse, CAP1, CAP2);\
	testCase.iChannelCaps[0] = (CAP1);\
	TResult t = testCase.TestCaseValid(CAPSET);\
	test_Equal(EXPCT, t);\
	}

	TEST_TEST_CASE(pauseRequired, hwDesNotWanted, KTestCapSet, EFail);
	TEST_TEST_CASE(pauseRequired_skip, hwDesNotWanted, KTestCapSet, EFail);
	TEST_TEST_CASE(pauseRequired_skip, hwDesNotWanted_skip, KTestCapSet, ESkip);
	TEST_TEST_CASE(pauseNotWanted, hwDesNotWanted_skip, KTestCapSet, ESkip);
	TEST_TEST_CASE(pauseNotWanted, hwDesWanted, KTestCapSet, ERun);
    TEST_TEST_CASE(pauseNotWanted, none, KTestCapSet, ERun);

	TEST_TEST_CASE(pauseNotWanted, capAboveV1, KDmacTestCapsV1, ESkip);
	TEST_TEST_CASE(pauseNotWanted, capAboveV1, KDmacTestCapsV2, ERun);

	TEST_TEST_CASE(pauseNotWanted, capBelowV2, KDmacTestCapsV1, ERun);
	TEST_TEST_CASE(pauseNotWanted, capBelowV2, KDmacTestCapsV2, ESkip);

	// contradictory requirements
	TEST_TEST_CASE(capAboveV1, capBelowV2, KDmacTestCapsV2, ESkip);
	TEST_TEST_CASE(capBelowV2, capAboveV1, KDmacTestCapsV2, ESkip);

	TEST_TEST_CASE(capAboveV1, capBelowV2, KDmacTestCapsV1, ESkip);
	TEST_TEST_CASE(capBelowV2, capAboveV1, KDmacTestCapsV1, ESkip);

	test.End();
	test.Close();
	}
Пример #7
0
/**
Run check buffers on the supplied TAddressParms array
*/
TBool DoTferParmTestL(const TAddressParms* aParms, TInt aCount, TBool aAllowRepeat, TBool aPositive)
	{
	_LIT(KPositive, "positive");
	_LIT(KNegative, "negative");
	test.Printf(_L("CheckBuffers %S test: %d args, repeats allowed %d\n"),
			(aPositive ? &KPositive : &KNegative), aCount, aAllowRepeat);
	RArray<const TAddressParms> array;
	ArrayAppendL(array, aParms, aParms + aCount);
	TPreTransferIncrBytes preTran;
	TBool r = preTran.CheckBuffers(array, aAllowRepeat);
	array.Close();
	return r;
	}
GLDEF_C TInt E32Main()
	{
	__UHEAP_MARK;
	TheTest.Printf(_L("\n"));
	TheTest.Title();
	TheTest.Start(_L("ServerStartupMgr Tests."));

	TEST2(TheFs.Connect(), KErrNone);

	// get clean-up stack
	CTrapCleanup* cleanup = CTrapCleanup::New();
	// Construct and install the Active Scheduler. The Active Scheduler is needed
	// by components used by this test as they are ActiveObjects.
	CActiveScheduler*	activeScheduler = new(ELeave)CActiveScheduler;
	CActiveScheduler::Install(activeScheduler);

	EnableEcomTestBehaviour(TheTest, TheFs);

	TRAPD(err,DoTestsL());
	ResetSsa(TheTest, TheFs);
	TheTest(err==KErrNone);

	DisableEcomTestBehaviour(TheTest, TheFs);

	TheTest.End();
	TheTest.Close();

	//delete scheduler;
	delete activeScheduler;
	delete cleanup;

	TheFs.Close();

	__UHEAP_MARKEND;

	User::Heap().Check();

	return KErrNone;
	}
Пример #9
0
static void TestDeleteKey()
/**
	Test deleting keys with the session.  See in-function comments
	for specific test cases.
 */
	{
	test.Start(_L("TestDeleteKey"));
	
	// IMPORT_C TInt DeleteKey(TKeyHandle aHandle);
	
	TInt r;
	
	// success case - known key
	r = kms.DeleteKey(GenHandle0);
	test(r == KErrNone);
	
	// failure case - key not known
	r = kms.DeleteKey(GenHandle0);
	test(r == KErrNotFound);
	
	test.End();
	}
Пример #10
0
TInt E32Main()
	{
	__UHEAP_MARK;

	CTrapCleanup* tc = CTrapCleanup::New();
    TEST(tc != NULL);

	TheTest.Title();
    TRAPD(err, ::MainL());
	TEST2(err, KErrNone);

	TheTest.End();
	TheTest.Close();

	delete tc;
	CloseSTDLIB();

	__UHEAP_MARKEND;

	User::Heap().Check();
	return KErrNone;
	}
Пример #11
0
// Manual test - requires user to move a card between two physical slots
extern TInt E32Main()
	{
	test.Start(_L("T_MULTISLOT Test"));
	test(fs.Connect()==KErrNone);
	
	// Get the list of removable drive driver-letters
	TDriveList driveList;
	test(fs.DriveList(driveList,KDriveAttRemovable)==KErrNone);
	
	
	TInt length=driveList.Length();
	TBool pass = EFalse;
	
	// i is drive letter (as int)
	// for every removable media logical drive
	for(TInt i=0; i<length; i++)
		{
		if(driveList[i] == 0)
			{
			continue;
			}

		TChar driveChar = i+'A';
		test.Next(_L("Testing Logical Drive"));
		

		TInt FirstlocDrvNum = KErrNotFound;
		TInt SecondlocDrvNum = KErrNotFound;
		TInt driveNum = -1;
		driveNum = i+'A';
		test.Printf(_L("Logical Drive : %d"), driveNum);
		
		// Get local drive number by gettin ghr Serial number fo the card (RFs call), then 
		// enumerating the TBusLocalDrives and finding one that matches.
		test(FindMmcLocalDriveNumber(driveChar,FirstlocDrvNum,driveNum)==KErrNone);
		// Got first local drive number, now move card into second slot.
		test.Printf(_L("<Move MMC Card to second slot, then press any key>"));
		test.Getch();
		// Get second local drive number for same logical drive (should be different local drive number).
		test(FindMmcLocalDriveNumber(driveChar,SecondlocDrvNum,driveNum)==KErrNone);
		if(FirstlocDrvNum!=SecondlocDrvNum)
			{
			pass=ETrue;
			break;
			}
		// else perhaps this wasn't a multislot drive
		}
	test(pass);
	test.End();
	test.Close();
	
	fs.Close();
	return KErrNone;
	}
LOCAL_C void TestUpdatedLocalizationFilesL()
	{
	TInt originalNumCities = GetNumCitiesFromGroupL(KDefaultCityGroupId);
    test.Printf(_L(" @SYMTestCaseID  PIM-APPSERV-TZLOC-TZL-ECL-0001 "));
	test.Printf(_L("The number of cities found in a city group in the default files are %d\n"), originalNumCities);
	//Install a patch with new localization files on the c: drive
	TRequestStatus reqStatus;
	CCTzSwiPluginTester* sisInstaller = CCTzSwiPluginTester::NewLC();
	sisInstaller->InstallSIS(KFlashLocalizationUpgradeSis(), CCTzSwiPluginTester::EPropertyNames, reqStatus);
	CActiveScheduler::Start();
	//Get the new number of cities from the group, this should come from the eclipsed files
	TInt flashNumCities = GetNumCitiesFromGroupL(KDefaultCityGroupId);
	test.Printf(_L("The number of cities found in a city group in the new installed files are %d\n"), flashNumCities);
	test(originalNumCities < flashNumCities);
	test (sisInstaller->UninstallSIS(KTimeZonePackageUid(), KTimeZonePackageName(), KTimeZoneVendorName()) == KErrNone);
	//Need this to allow the notification plug-in code to run
	User::After(1000000);
	CleanupStack::PopAndDestroy(sisInstaller);
	TInt romNumCities = GetNumCitiesFromGroupL(KDefaultCityGroupId);
	test.Printf(_L("The number of cities found in a city group in the rom files are %d\n"), romNumCities);
	test(originalNumCities == romNumCities);
	}
Пример #13
0
TInt E32Main()
	{
	TheTest.Title();
	
	CTrapCleanup* tc = CTrapCleanup::New();
	TheTest(tc != NULL);
	
	__UHEAP_MARK;
	
	DoTests();
	DeleteTestFiles();

	__UHEAP_MARKEND;
	
	TheTest.End();
	TheTest.Close();
	
	delete tc;

	User::Heap().Check();
	return KErrNone;
	}
Пример #14
0
void CDummyCalendarApp::RepeatExceptedEntryCreateL()
	{
	test.Next(_L("Add entry, repeat twice, set excepted and delete"));

	iEntries.ResetAndDestroy();	
	
	// Create new calendar entry.
	CCalEntry* entry = NULL;
	HBufC8* guid = KGUIDInc081869().AllocLC();	
	entry = CreateCalEntryL(CCalEntry::EAppt, guid);
	CleanupStack::Pop(guid);
	
	iEntries.AppendL(entry);	

    // Set start and end date.
	TTime start(TDateTime(2006, EMarch, 6, 10, 0, 0, 0));
	TTime end(TDateTime(2006, EMarch, 6, 14, 0, 0, 0));
	SetEntryStartAndEndTimeL(entry, start, end);
	
	TBuf<50> summary;			
	RandomText(summary);
	entry->SetSummaryL(summary);

	TBuf<50> location;
	RandomText(location);
	entry->SetLocationL(location);

	TBuf<50> description;		
	RandomText(description);
	entry->SetDescriptionL(description);	

	// Create a daily repeating rule that occurs for 2 days.
	TCalRRule rpt(TCalRRule::EDaily);
	rpt.SetInterval(1);
	rpt.SetCount(2);	
	
	// Make sure the repeat time is within the delete time range.
	TCalTime repeatStart;
	TCalTime repeatEnd;
	repeatStart.SetTimeLocalL(TDateTime(2006, EMarch, 6, 0, 0, 0, 0));
	repeatEnd.SetTimeLocalL(TDateTime(2006, EMarch, 8, 0, 0, 0, 0));
	rpt.SetDtStart(repeatStart); 
	rpt.SetUntil(repeatEnd);
	entry->SetRRuleL(rpt);

    // Store the entry. Because it repeats over 2 days, there will
    // be 2 entries.
	TInt entriesStored(0);
	SynCGetEntryViewL().StoreL(iEntries, entriesStored);
	test(entriesStored == iEntries.Count());
	}
Пример #15
0
void CTestPerf::ReadComplete(TInt aStatus)
	{
	if (iTrace)
		Test.Printf(_L("CTestPerf::ReadComplete(%d) len = %d/%d\r\n"), aStatus, iWriter->iDes.Length(), iWriter->iDes.MaxLength());

	if (aStatus!=KErrNone)
		{
		Fail(ETestFailRead, aStatus);
		return;
		}

	switch (iState)
		{
	case EWaitIO:
		iRetries = 0;
		iTimer->Cancel();
		iCount += iReader->iCount;
		iPackets++;
		{
		TTime end;
		end.UniversalTime();
		TInt64 difftime = (end.MicroSecondsFrom(iStartTime).Int64()+TInt64(500000))/TInt64(1000000);
		if (difftime==0)
			difftime = 1;
		TInt64 cps = MAKE_TINT64(0,iCount)/difftime;
		TInt rate = (I64INT(cps)*10000)/11520;

		iRate += rate;
		iSpeed += I64INT(cps);
		
		Test.Printf(_L("%c %6d %d (%dbps=%d.%02d%%)\r"), KSpinner[iSpin++ & 3], iPackets, iCount, iSpeed/iPackets, (iRate/iPackets)/100, (iRate/iPackets)%100);
		}
		Read();
		break;
	default:
		break;
		}
	}
Пример #16
0
void VfsCreateDeleteOnCloseFileOomTest()
    {
    sqlite3_vfs* vfs = sqlite3_vfs_find(NULL);
    TEST(vfs != NULL);

    sqlite3_file* osFile = (sqlite3_file*)User::Alloc(vfs->szOsFile);
    TEST(osFile != NULL);
    
    TheTest.Printf(_L("Iteration: "));
    TInt failingAllocNum = 0;
    TInt err = SQLITE_IOERR_NOMEM;
    while(err == SQLITE_IOERR_NOMEM)
        {
        ++failingAllocNum;
        TheTest.Printf(_L("%d "), failingAllocNum);
        OomPreStep(failingAllocNum);
        int outFlags = 0;
        err = sqlite3OsOpen(vfs, KTestFile4Z, osFile, SQLITE_OPEN_CREATE | SQLITE_OPEN_DELETEONCLOSE, &outFlags);
        if(err == SQLITE_OK)
            {
            err = sqlite3OsClose(osFile);
            }
        OomPostStep();
        if(err != SQLITE_OK)
            {
            TEST2(err, SQLITE_IOERR_NOMEM);
            }
        //Whether the iteration has failed or succeeded, the file should not exist.
        TPtrC8 ptrname((const TUint8*)KTestFile4Z);
        TBuf<50> fname;
        fname.Copy(ptrname);
        TInt err2 = TheFs.Delete(fname);
        TEST2(err2, KErrNotFound);
        }
    TEST2(err, SQLITE_OK);
    TheTest.Printf(_L("\r\n=== TVfs::Open(<delete on close file>) OOM test succeeded at allcoation %d\r\n"), failingAllocNum);
    User::Free(osFile);
    }
Пример #17
0
void TestExDriver::TestDevicePresent()
{
    iTest.Next(_L("Testing Logical Device API"));

    TInt r;

    // RDevice is the user side handle of LDD factory object.
    RDevice device;

    iTest.Printf(_L("Open the Device\n"));
    // Open the device with reference to the driver name.
    r = device.Open(KDriverName);
    if (r==KErrNone)
    {
        iTest.Printf(_L("Get Device Capabilities\n"));
        // Package the device capabilities structure to a descriptor
        // suitable to be passed to RDevice::GetCaps()
        //
        TPckgBuf<TCapsDevCommV01> caps;

        // Get the device capabilities. Driver fills in the capabilities
        // in caps and returns to user.
        //
        device.GetCaps(caps);

        // Retrieve the information from caps and validate name and version
        TVersion expectedVer(RExDriverChannel::VersionRequired());
        iTest(caps().version.iMajor==expectedVer.iMajor);
        iTest(caps().version.iMinor==expectedVer.iMinor);
        iTest(caps().version.iBuild==expectedVer.iBuild);

        iTest.Printf(_L("Close the device\n"));
        // Close the device. This handle is required only to get any device
        // related information from LDD factory object.
        //
        device.Close();
    }
}
Пример #18
0
static void doMainL()
	{
	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
	CleanupStack::PushL(scheduler);
	CActiveScheduler::Install(scheduler);

	CSqlSearcher* searcher = CSqlSearcher::NewLC();
	HBufC* buff = HBufC::NewLC(1024);
	TPtr ptr = buff->Des();

	TheTest.Next(_L("A very short search string"));

	ptr.Zero();
	ptr.AppendFill(TChar('x'), 3);
	searcher->DoSearchL(*buff, KUidContactFieldFamilyName);

	TheTest.Next(_L("A fairly long search string"));

	ptr.Zero();
	ptr.AppendFill(TChar('x'), 233);
	searcher->DoSearchL(*buff, KUidContactFieldFamilyName);

	TheTest.Next(_L("A very slightly longer search string"));

	ptr.Zero();
	ptr.AppendFill(TChar('x'), 234);
	searcher->DoSearchL(*buff, KUidContactFieldFamilyName);

	TheTest.Next(_L("A very long search string"));

	ptr.Zero();
	ptr.AppendFill(TChar('x'), 600);
	searcher->DoSearchL(*buff, KUidContactFieldFamilyName);

	CleanupStack::PopAndDestroy(buff);
	CleanupStack::PopAndDestroy(searcher);
	CleanupStack::PopAndDestroy(scheduler);
	}
Пример #19
0
// send a request and match a known response, show data only if a mismatch
TBool testSdpReqL(RTest& test, TUint8* aReqData, TUint aReqLen, TUint8 aReqId, TUint8* aRespData, TUint aRespLen, TUint8 aRespId, TUint aRespSize)
{
	TUint8 pduId = aReqId;
	TBool testMatch;
	HBufC8* requestHBuf = HBufC8::New(aReqLen);
	HBufC8* responseHBuf;
	TPtr8 request = requestHBuf->Des();

	request.SetLength(0);
	request.Append(aReqData, aReqLen);
	responseHBuf = InjectLC(pduId, request, aRespSize);
	if (pduId == aRespId)
		{
		TInt respCmp = Mem::Compare(aRespData, aRespLen, &responseHBuf->Des()[0], responseHBuf->Length());
		if (respCmp)
			{
			test.Printf(_L("no match at offset %d:\n"), respCmp);
			HexDes(responseHBuf->Des());
			test.Printf(_L("\n"));
			testMatch = EFalse;
			}
		else
			{
			test.Printf(_L("Response OK\n"));
			testMatch = ETrue;
			}
		}
	else
		{
			test.Printf(_L("Error:"));
			HexDes(responseHBuf->Des());
			test.Printf(_L("\n"));
			testMatch = EFalse;
		}
	CleanupStack::PopAndDestroy(/*responseHBuf*/);
	delete requestHBuf;
	return testMatch;
}
Пример #20
0
GLDEF_C TInt E32Main()
	{
	test.Title();
	test.Start(_L("Create chunk"));
	RChunk c;
	TInt r=c.CreateDisconnectedLocal(0,0x1000,0x100000);
	test(r==KErrNone);
	r=c.Commit(0x10000,0x1000);
	test(r==KErrNone);
	TUint8* pBuf1=c.Base();
	TUint8* pBuf2=pBuf1+0x10000;

	TInt s;
	TInt d;
	TInt l;

	for (l=1; l<300; l+=3)
		{
		for (s=0; s<=4096-l; s+=227)
			{
			test.Printf(_L("\ns=%4d l=%4d: "),s,l);
			for (d=0; d<=4096-l; d+=229)
				{
				DoTest(pBuf1,pBuf2,4096,s,d,l,0);
				DoTest(pBuf1,pBuf2,4096,s,d,l,1);
				}
			}
		}

	for (l=1; l<300; l+=3)
		{
		for (s=4096-l; s>=0; s-=227)
			{
			test.Printf(_L("\ns=%4d l=%4d: "),s,l);
			for (d=4096-l; d>=0; d-=229)
				{
				DoTest(pBuf1,pBuf2,4096,s,d,l,0);
				DoTest(pBuf1,pBuf2,4096,s,d,l,1);
				}
			}
		}
	
	for (l=1; l<400; l+=((l<=64)?1:3) )
		{
		test.Printf(_L("\nOverlap test: l=%4d: "),l);
		for (s=32; s<=4096-32-l; s+=101)	// want s to take all values 0...31 modulo 32
			{
			for (d=s-32; d<=s+32; ++d)
				{
				DoOverlapTest(pBuf1,pBuf2,4096,s,d,l);
				}
			}
		}
	
	c.Close();
	test.End();
	return 0;
	}
Пример #21
0
TInt E32Main()
    {
    TheTest.Title();
    
    CTrapCleanup* tc = CTrapCleanup::New();
    TheTest(tc != NULL);
    
    __UHEAP_MARK;
    
    TRAPD(err, DoTestsL());
    DestroyTestEnv();
    TEST2(err, KErrNone);

    __UHEAP_MARKEND;
    
    TheTest.End();
    TheTest.Close();
    
    delete tc;

    User::Heap().Check();
    return KErrNone;
    }
Пример #22
0
/**
@SYMTestCaseID          SYSLIB-BAFL-CT-0436
@SYMTestCaseDesc        TResourceReader class functionality test
						Test for TResourceReader::ReadInt32 (),TResourceReader::ReadTPtrC() functions
@SYMTestPriority        High
@SYMTestActions         Attempt for reading MENU_BAR resource
@SYMTestExpectedResults Tests must not fail
@SYMREQ                 REQ0000
*/
void TRsReadTester::TestMenuBarL()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0436 Test reading MENU_BAR resource "));
    TResourceReader reader;
    CreateResourceReaderLC(reader,SYS_MENUBAR_ONE);
    test(reader.ReadInt16()==8); // how many items following
    TPtrC ref=_L("abcdefgh");
    for (TInt ii=1; ii<=8; ii++)
        {
        test(reader.ReadInt32()==ii);
        test(reader.ReadTPtrC()==ref.Left(ii));
        }
    CleanupStack::PopAndDestroy(1);
	}
Пример #23
0
/**
@SYMTestCaseID          SYSLIB-BAFL-CT-0437
@SYMTestCaseDesc        Reading ALIGNMENT_HORROR resources test
                        Test for TResourceReader::ReadTPtrC8(),TResourceReader::ReadTPtrC16() function
@SYMTestPriority        High
@SYMTestActions         Tests for reading descriptors and checks for alignment
@SYMTestExpectedResults Tests must not fail
@SYMREQ                 REQ0000
*/
void TRsReadTester::TestAlignment1L()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0437 Test reading ALIGNMENT_HORROR resources "));
	TPtrC8  ref8 =_L8("xyz");
	TPtrC16 ref16=_L16("xyz");
    TResourceReader reader;
	for (TInt rr=0; horrors[rr]!=0; rr++)
		{
		CreateResourceReaderLC(reader,horrors[rr]);
		test(reader.ReadTPtrC8() ==ref8.Left(rr));
		test(reader.ReadTPtrC16()==ref16.Left(rr));
		CleanupStack::PopAndDestroy(1);
		}
	}
Пример #24
0
void SelfTests()
	{
	test.Next(_L("Running framework unit tests"));
#ifndef __WINS__
	// Cannot connect real driver on Emulator - only
	// simulator
	RDmaSession::SelfTest(EFalse);
#endif
	RDmaSession::SelfTest(ETrue);
	TDmaCapability::SelfTest();
	TTestCase::SelfTest();
	TTransferIter::SelfTest();
	TCallbackRecord::SelfTest();
	CDmaBmFragmentation::SelfTest();
	TAddrRange::SelfTest();
	TAddressParms::SelfTest();
	TIsrRequeArgsSet::SelfTest();
	RArrayCopyTestL();
	RArrayInsertLTest();
	TPreTransferIncrBytes::SelfTest();
	test.End();
	test.Close();
	}
Пример #25
0
void CreateDatabaseL(const TDesC& aDbName)
	{			
	// create the database now
	RSqlSecurityPolicy securityPolicy;
	CleanupClosePushL(securityPolicy);
	
	TSecurityPolicy policy(TSecurityPolicy::EAlwaysPass);
	securityPolicy.Create(policy);
	
	TSecurityPolicy schemaPolicy(TSecurityPolicy::EAlwaysPass);
	TSecurityPolicy readPolicy(TSecurityPolicy::EAlwaysPass);
	TSecurityPolicy writePolicy(TSecurityPolicy::EAlwaysPass);
	
	User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::ESchemaPolicy, schemaPolicy));
	User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EReadPolicy, readPolicy));
	User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EWritePolicy, writePolicy));
 
	TheTest.Printf(_L("Creating Database %S\n"),  &aDbName);
		
	TInt err = TheDbC.Create(aDbName, securityPolicy, &TheSqlConfigString);

	if (KErrAlreadyExists == err)
		{
		
		// the file already exists
		// make sure we delete the file
        User::LeaveIfError(TheDbC.Delete(aDbName));

        // try again
        err = TheDbC.Create(aDbName, securityPolicy, &TheSqlConfigString);

		}
	
	User::LeaveIfError(err);
	
	//Create tables	
	User::LeaveIfError(TheDbC.Exec(KMusicCreateTable));
	User::LeaveIfError(TheDbC.Exec(KAuxiliaryCreateTable));
	User::LeaveIfError(TheDbC.Exec(KAlbumCreateTable));
	User::LeaveIfError(TheDbC.Exec(KArtistCreateTable));
	User::LeaveIfError(TheDbC.Exec(KComposerCreateTable));
	User::LeaveIfError(TheDbC.Exec(KGenreCreateTable));
	User::LeaveIfError(TheDbC.Exec(KPlaylistCreateTable));
	User::LeaveIfError(TheDbC.Exec(KPlaylistSongInfoCreateTable));
	User::LeaveIfError(TheDbC.Exec(KPlaylistSongsCreateTable));
	
	TheDbC.Close();
	
	CleanupStack::PopAndDestroy(&securityPolicy);
	}
Пример #26
0
TInt E32Main()
//
// Benchmark for euser assmblerised functions
//
    {
	CTrapCleanup* trapHandler=CTrapCleanup::New();
	test(trapHandler!=NULL);

    test.Title();
    test.Start(_L("Benchmarks for assemblerised euser functions"));

	TUserBenchmarkList bms;
	TRAPD(err, RunBenchmarkTestsL(bms));
	if (err != KErrNone)
		test.Printf(_L("TestMainL left with %d\n"), err);

	FailIfError(err);
	
	test.End();
	
	delete trapHandler;
	return(KErrNone);
    }
Пример #27
0
void CTestXonXoff::RunL()
	{
	iCount = 0;
	iState = EIdle;
	iSeed = 1;
    Test.Printf(_L("Waiting for Port\r\n"));
	ZeroTerminate();

	iWriter->Ready();
	iTimer->After(1000000);
	
//	iState = EWaitReady;
//	WriteComplete(0);
	}
/**
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4058
@SYMTestCaseDesc Test that settings information can be selectively overridden on many ROFS layers when
the keyspace is not represented on all ROFS layers
@SYMTestPriority High
@SYMTestActions Open keyspace 0x10286557.  This keyspace is represented by three
txt files.  The keyspace file names in the source have been mangled in a similar way to that
which would be expected on the device (eg. abcd1234.txt, abcd1234.txt[01-00], abcd1234.txt[02-00] etc.
@SYMTestExpectedResults Ensure that the final values of the settings are as specified in the final ROFS layer.
@SYMREQ REQ11401
*/
LOCAL_C void MissingRofsLayerL()
{
    TheTest.Next(_L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4058 " ));

    CRepository* rep;
    User::LeaveIfNull(rep = CRepository::NewLC(KUidKeyspace8));
    TInt settingValueInt = 0;

    // tests that the core value is modified
    rep->Get(KKeyOne, settingValueInt);
    TEST2(settingValueInt, KKeyspace8Setting1Value);

    CleanupStack::PopAndDestroy(rep);
}
Пример #29
0
TInt E32Main()
	{
	__UHEAP_MARK;
	test.Start(_L("@SYMTESTCaseID:PIM-T-RECURRENCE-0001 t_recurrence"));

	test.Title();
	CActiveScheduler* scheduler = new CActiveScheduler;
	CActiveScheduler::Install(scheduler);
	
	CTrapCleanup* cleanupTrap = CTrapCleanup::New();
	
	TRAPD(ret, RunTestsL());
	test(ret==KErrNone);
	
	delete cleanupTrap;
	delete scheduler;
	
	test.End();
	test.Close();
	
	__UHEAP_MARKEND;
	return KErrNone;
	}
Пример #30
0
TInt E32Main()
    {
	__UHEAP_MARK;
	CTrapCleanup* tc = CTrapCleanup::New();
	TEST(tc != NULL);

	TInt err = TheDbs.Connect();
	TEST2(err, KErrNone);

	TRAP(err, ::DoRunL());
	TEST2(err, KErrNone);

	::CleanupTest();

	TheTest.End();
	TheTest.Close();

	delete tc;

	__UHEAP_MARKEND;
	User::Heap().Check();
	return KErrNone;
    }