/** @SYMTestCaseID SYSLIB-BAFL-CT-0439 @SYMTestCaseDesc Timing Tests @SYMTestPriority High @SYMTestActions Check for the time loads needed to repeatedly load a resource @SYMTestExpectedResults Tests must not fail @SYMREQ REQ0000 */ void TRsReadTester::TimingTestsL() { test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0439 Timing tests ")); test.Next(_L("BUTTON and FLPTED")); TUint time = User::TickCount(); for (TInt ii=0; ii<100; ii++) { TResourceReader reader; CreateResourceReaderLC(reader,SYS_BUTTON_ONE); CleanupStack::PopAndDestroy(); CreateResourceReaderLC(reader,SYS_FLPTED_ONE); CleanupStack::PopAndDestroy(); } time = User::TickCount() - time; test.Printf(_L("Time to load 100 times: %d\n"),time); test.Next(_L("BUTTON and ARRAY")); time = User::TickCount(); for (TInt jj=0; jj<100; jj++) { TResourceReader reader; CreateResourceReaderLC(reader,SYS_BUTTON_ONE); CleanupStack::PopAndDestroy(); CreateResourceReaderLC(reader,SYS_ARRAY_ONE); CleanupStack::PopAndDestroy(); } time = User::TickCount() - time; test.Printf(_L("Time to load 100 times: %d\n"),time); }
void random_numbers() { int i,r; int rs[20]; TheTest.Next(_L("Random numbers")); for (i=0; i<20; i++) { r = rand(); printf("%d ", r); } printf("\n"); TheTest.Next(_L("Using srand()")); srand(12345678); for (i=0; i<20; i++) { rs[i]=rand(); printf("%d ",rs[i]); } printf("\n"); srand(12345678); for (i=0; i<20; i++) TEST(rand()==rs[i]); }
/** This code tests that the log engine will restart automatically by killing the Log engine server and then checking that a test event can be added. Details can be found in DEF047320 */ void doTestsL() { TheMatchingIsEnabled = TestUtils::MatchingEnabledL(); // test 0 adds an event TestUtils::Initialize(_L("t_logservercrash")); TestUtils::DeleteDatabaseL(); CLogClient* client = CLogClient::NewL(theFs); CleanupStack::PushL(client); CLogChangeNotifier* notifier = CLogChangeNotifier::NewL(); CleanupStack::PushL(notifier); TheTest.Start(_L("Event View With No Filter: Before Killing Sever")); TheTest.Next(_L("Test Add Event")); TestEventViewL(*client); theLog.Write(_L8("Test 0 OK\n")); // Test 1 stops the server TheTest.Next(_L("Test Kill Server")); TestKillServerL(); theLog.Write(_L8("Test 1 OK\n")); // Test 2 checks the server is going again TheTest.Next(_L("Event View With No Filter : After Killing Sever")); TheTest.Next(_L("Test Add Event")); TestEventViewL(*client); theLog.Write(_L8("Test 2 OK\n")); CleanupStack::PopAndDestroy(2); }
void TTestMsBlock::tFileAccess() { test.Start(_L("tFileAccess\n")); test.Next(_L("DriveInfo")); PrintDrvInfo(fsSession, msDrive->DriveNumber()); TVolumeInfo volInfo; TInt err = fsSession.Volume(volInfo); test(err == KErrNone); test.Printf(_L("Memory 'in use' = %lx\n"), (volInfo.iSize - volInfo.iFree)); test.Printf(_L("volInfo.iSize = %lx\n"), volInfo.iSize); test.Printf(_L("volInfo.iFree = %lx\n"), volInfo.iFree); //-- 1. create a file _LIT(KFile, "\\test_file.file"); const TUint KFileSz = 54321; test.Next(_L("Write file\n")); err = CreateCheckableStuffedFile(fsSession, KFile, KFileSz); test_KErrNone(err); //-- 2. verify the file, just in case. test.Next(_L("Verify file\n")); err = VerifyCheckableFile(fsSession, KFile); test_KErrNone(err); //-- 3. delete the file test.Next(_L("Delete file\n")); fsSession.Delete(KFile); test.End(); }
/** @SYMTestCaseID SYSLIB-CENREP-CT-0032 @SYMTestCaseDesc BasicPlatsecTestsL() function calls test for the Secure Cenrep (setting). Methods of CRepository class are called for various combination of different settings and the results are asserted. @SYMTestPriority High @SYMTestActions BasicPlatsecTestsL() method calls test. @SYMTestExpectedResults The test must not fail. @SYMPREQ PREQ277 PREQ280 */ LOCAL_C void BasicPlatsecTestsL() { TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENREP-CT-0032 Basic functional tests for PlatSec ")); OomTesting = EFalse; // Instead of wait for cache clear, this test uses the ResetAll API to // restore keyspaces to original ROM settings. See the notes at implementation // of ResetModifiedRepsL which explains why this is done and possible // undesirable effects. RepsToReset.AppendL(KUidPlatsecTestRepository); RepsToReset.AppendL(KUidTransactionTestRepository); RepsToReset.AppendL(KUidResetTestRepository); ::ResetModifiedRepsL(); FuncBasicTestsL(); TheTest.Next(_L("Basic Out-of-memory tests")); // Instead of wait for cache clear, this test uses the ResetAll API to // restore keyspaces to original ROM settings. See the notes at implementation // of ResetModifiedRepsL which explains why this is done and possible // undesirable effects. ::ResetModifiedRepsL(); OomTesting = ETrue; TheTest.Next(_L("OOM Open/Close repository")); OomTest(OpenRepositoryL); GetSetL(); TheTest.Next(_L("OOM Find")); OomTest(FindL); TheTest.End(); }
TInt E32Main() { test.Title(); test.Start(_L("Testing ldd importing")); test.Next(_L("Load the exporting ldd")); TInt r=User::LoadLogicalDevice(KExportTestLddName); test_Equal(KErrNone, r); // Don't allow KErrAlreadyExists as don't want ldd to be XIP. RExportLdd exportLdd; test_KErrNone(exportLdd.Open()); // The exported function multiplies the 2 arguments. test_Equal(12, exportLdd.RunExport(3, 4)); test.Next(_L("Load the importing ldd")); r=User::LoadLogicalDevice(KImportTestLddName); test_Equal(KErrNone, r); // Don't allow KErrAlreadyExists as don't want ldd to be XIP. RImportLdd importLdd; test_KErrNone(importLdd.Open()); // The imported function multiplies the 2 arguments. test_Equal(12, importLdd.RunImport(3, 4)); exportLdd.Close(); importLdd.Close(); test_KErrNone(User::FreeLogicalDevice(KExportTestLddName)); test_KErrNone(User::FreeLogicalDevice(KImportTestLddName)); test.End(); return KErrNone; }
LOCAL_C void FuncTransactionTestsL() { TheTest.Start(_L("Open/Close repository")); OpenRepositoryL(); TheTest.Next(_L("Create/Set Int Transaction")); CreateSetIntTransactionL(); TheTest.Next(_L("Create/Set Real Transaction")); CreateSetRealTransactionL(); TheTest.Next(_L("Create/Set Descriptor Transaction")); // Instead of wait for cache clear, this test uses the ResetAll API to // restore keyspaces to original ROM settings. See the notes at implementation // of ResetModifiedRepsL which explains why this is done and possible // undesirable effects. ::ResetModifiedRepsL(); CreateSetDesTransactionL(); TheTest.Next(_L("Restore factory settings")); ResetTransactionL(); TheTest.End(); }
void searching() { int i; sort_item *answer; sort_item not_there; TheTest.Next(_L("Binary search for existing items")); for (i=0; i<NITEMS; i++) { answer = (sort_item*)bsearch(&list[i],list,NITEMS,sizeof(list[0]),compare_ba); TEST(answer==&list[i]); } TheTest.Next(_L("Binary search for missing items")); for (i=0; i<NITEMS; i++) { not_there = list[i]; not_there.a++; answer = (sort_item*)bsearch(¬_there,list,NITEMS,sizeof(list[0]),compare_ba); if (answer!=NULL) TEST(!compare_ba(answer,¬_there)); } for (i=0; i<NITEMS; i++) { not_there = list[i]; not_there.a--; answer = (sort_item*)bsearch(¬_there,list,NITEMS,sizeof(list[0]),compare_ba); if (answer!=NULL) TEST(!compare_ba(answer,¬_there)); } }
//--------------------------------------------- //! @SYMTestCaseID PBASE-T_NOTIFY-2457 //! @SYMTestType PT/UT //! @SYMREQ PREQ1847 //! @SYMTestCaseDesc Performance Test – Multiple File Server Sessions, this is only a part of the test case. //! It is executed as a functional test here. This test case is also run as performance test in t_notify_perf //! @SYMTestActions Perform a series of file operations, create multiple notification threads to collect the notifications. //! @SYMTestExpectedResults No notifications are missed //! @SYMTestPriority High //! @SYMTestStatus Implemented //--------------------------------------------- LOCAL_C void MultipleFileSessionTestL() { test.Start(_L("T_NOTIFY_MFS - Test Preparation")); gPerfMeasure = EFalse; SetTestPaths(); DeleteLogFilesL(); // Does not write log file but need create the log folder for test stopper to use const TInt KNumFiles = 10; const TInt KNumClients = 4; test.Next(_L("Single Notification on all clients")); ClearTestPathL(); TTestSetting setting (KNumFiles, KNumClients, (EEnhanced|EBigBuffer), KDefaultOpList); CTestExecutor testcase (setting); testcase.RunTestCaseL(); test.Next(_L("Multi notifications Mode 1, enhanced notification")); ClearTestPathL(); setting.iOption = (EEnhanced|EBigBuffer|EMultiNoti1); testcase.SetTestSetting(setting); testcase.RunTestCaseL(); test.Next(_L("Multi notifications Mode 2, enhanced notification")); ClearTestPathL(); setting.iOption = (EEnhanced|EBigBuffer|EMultiNoti2); testcase.SetTestSetting(setting); testcase.RunTestCaseL(); test.Next(_L("Test finishing - clearing test path")); ClearTestPathL(); test.End(); }
static void doMainL() { #ifndef _DEBUG test.Next(_L("TFAILADD does not run on UREL builds. Test not run.")); #else CTestApp* testApp = CTestApp::NewL(); CleanupStack::PushL(testApp); test.Next(_L("Test1 - Add Appointment")); testApp->TestFailL(CCalEntry::EAppt); test.Next(_L("Test2 - Add Event")); testApp->TestFailL(CCalEntry::EEvent); test.Next(_L("Test3 - Add Anniversary")); testApp->TestFailL(CCalEntry::EAnniv); test.Next(_L("Test4 - Add Todo")); testApp->TestFailL(CCalEntry::ETodo); CleanupStack::PopAndDestroy(testApp); #endif }
void DoTestsL() { TheTest.Start(_L(" @SYMTestCaseID:PDS-SQL-UT-4233 CSqlBurEventMonitor object creation - OOM test")); SqlBurEventMonitorOomTest(); TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4234 CSqlBurEventMonitor functional test")); SqlBurEventMonitorFunctionalTest(); TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-UT-4235 CSqlBurEventMonitor::RunL() - OOM test")); SqlBurEventMonitorRunOomTest(); }
GLDEF_C TInt E32Main() { test.Title(); if (UserSvr::HalFunction(EHalGroupKernel, EKernelHalSmpSupported, 0, 0) == KErrNone) { test.Printf(_L("*********************************\n")); test.Printf(_L("* NOT SUPPORTED ON SMP SYSTEMS *\n")); test.Printf(_L("*********************************\n")); User::After(2000000); return(0); } test.Start(_L("Load LDD")); TInt r=User::LoadLogicalDevice(_L("D_IMPLICIT")); test(r==KErrNone || r==KErrAlreadyExists); test.Next(_L("Open channel")); RImpSysTest impSys; r=impSys.Open(); test(r==KErrNone); SStats s; test.Next(_L("Test with changing priorities")); r=impSys.Start(RImpSysTest::ETestPriority); test(r==KErrNone); Wait(30); r=impSys.Stop(s); test(r==KErrNone); TInt f1=Display(s); test.Next(_L("Test with round-robin")); r=impSys.Start(RImpSysTest::ETestRoundRobin); test(r==KErrNone); Wait(30); r=impSys.Stop(s); test(r==KErrNone); TInt f2=Display(s); test.Next(_L("Dry run")); r=impSys.Start(RImpSysTest::ETestDummy); test(r==KErrNone); Wait(30); r=impSys.Stop(s); test(r==KErrNone); TInt f3=Display(s); test.Next(_L("Close channel")); impSys.Close(); test(f1==0); test(f2==0); test(f3==0); test.End(); return KErrNone; }
void TMultipleSessionTest::testSetVolume(RTest& aTest) // // Test setting the volume info. // { aTest.Next(_L("Test setting the volume label")); TInt r=iFs.SetSessionPath(iSessionPath); aTest(r==KErrNone); #if defined(_UNICODE) aTest.Printf(_L("Unicode volume label set not implemented ****\n")); return; #else TInt driveNum=CurrentDrive(aTest); TVolumeInfo v; r=iFs.Volume(v,driveNum); aTest(r==KErrNone); TFileName n=v.iName; aTest.Printf(_L("VOL=\"%S\"\n"),&n); aTest.Next(_L("Set volume label to nothing")); r=iFs.SetVolumeLabel(_L(""),driveNum); if (r==KErrGeneral) return; aTest(r==KErrNone); r=iFs.Volume(v,driveNum); aTest(r==KErrNone); aTest(v.iName==_L("")); aTest.Printf(_L("VOL=\"%S\"\n"),&v.iName); aTest.Next(_L("Set volume label to ABCDEFGHIJK")); r=iFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); aTest(r==KErrNone); r=iFs.Volume(v,driveNum); aTest(r==KErrNone); aTest(v.iName==_L("ABCDEFGHIJK")); aTest.Printf(_L("VOL=\"%S\"\n"),&v.iName); aTest.Next(_L("Set volume label back to nothing")); r=iFs.SetVolumeLabel(_L(""),driveNum); aTest(r==KErrNone); r=iFs.Volume(v,driveNum); aTest(r==KErrNone); aTest(v.iName==_L("")); aTest.Printf(_L("VOL=\"%S\"\n"),&v.iName); aTest.Next(_L("Set volume label to original")); r=iFs.SetVolumeLabel(n,driveNum); aTest(r==KErrNone); r=iFs.Volume(v,driveNum); aTest(r==KErrNone); aTest(v.iName==n); aTest.Printf(_L("VOL=\"%S\"\n"),&v.iName); #endif }
static void DoRunL() { TheTest.Start(_L("An app with \"TABLE A:READ\" capabilities set")); TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0015 Open table tests ")); ::TblOpenL(); TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0016 Table R/W tests ")); ::TblRWL(); }
TInt E32Main() { test.Title(); test.Start(_L("Test thrashing monitor")); test_KErrNone(InitBenchmarks()); TInt actions = ParseCommandLine(); test_KErrNone(GetGlobalPolicies()); TUint cacheOriginalMin = 0; TUint cacheOriginalMax = 0; if (gDataPagingSupported) { test.Next(_L("Thrash test: change cache size to maximum 2Mb")); TUint cacheCurrentSize = 0; DPTest::CacheSize(cacheOriginalMin, cacheOriginalMax, cacheCurrentSize); gMinCacheSize = 512; gMaxCacheSize = 520; test_KErrNone(DPTest::SetCacheSize(gMinCacheSize * gPageSize, gMaxCacheSize * gPageSize)); } if (actions & EActionTest) { TBool flexibleMemoryModel = (MemModelAttributes() & EMemModelTypeMask) == EMemModelTypeFlexible; if (flexibleMemoryModel) TestThrashHal(); else TestThrashHalNotSupported(); } if (actions & EActionThrashing) { test.Next(_L("Extended thrashing tests")); TestThrashing(); } if (actions & EActionBenchmarks) { test.Next(_L("Benchmarking page replacement")); TestDistributions(); BenchmarkReplacement(); } if (gDataPagingSupported) { test.Next(_L("Thrash test: Reset cache size to normal")); test_KErrNone(DPTest::SetCacheSize(cacheOriginalMin, cacheOriginalMax)); } test.End(); return 0; }
/** @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-3343 @SYMTestCaseDesc Restore factory Settings from Install file. @SYMTestPriority High @SYMTestActions Ensure that the repository file only exists in the Install directory. Open the repository and modify a setting. Force RFS and check that the repository is restored against the Install file @SYMTestExpectedResults The test repository should be reset against the Install file @SYMDEF PDEF099108 */ LOCAL_C void RFSInstallOnlyL() { TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-3343 ResetAllRepositoriesTestL ")); TInt r; TReal realVal; TBuf<20> strVal; //restore all test files - this ensures we have a repository file //only on the c: RestoreRFSTestFilesL(EInstallOnly); TheTest.Next(_L("Open repository to ensure server is running")); CRepository* repository = CRepository::NewLC(KUidRfsRepositoryInstallOnlyDefaultFile); TheTest.Next(_L("Modify a Setting")); r = repository->Set(KReal1, KReal1_UpdatedValue); TEST2(r, KErrNone); //verify the update r = repository->Get(KReal1, realVal); TEST2(r, KErrNone); TEST(realVal == KReal1_UpdatedValue); // Close repository CleanupStack::PopAndDestroy(repository); //Kill the server TheTest.Next(_L("Kill the server process")); _LIT( KCentralRepositoryServerName, "Centralrepositorysrv"); r = KillProcess(KCentralRepositoryServerName); TEST2(r,KErrNone); User::After(KGeneralDelay); //Restart the server in soft reset mode to force a //repository reset TheTest.Next(_L("Manually start central respository")); ReStartServerInSoftResetMode(); //Open the repository repository = CRepository::NewLC(KUidRfsRepositoryInstallOnlyDefaultFile); //verify that the Real value has been reset against the value in the install //repository file TheTest.Next(_L("Get 'Modified' value")); r = repository->Get(KReal1, realVal); TEST2(r, KErrNone); TEST(realVal == KReal1_InstallValue); // Close repository CleanupStack::PopAndDestroy(repository); TheTest.End(); }
void DoTestsL() { TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1612 Multiple connections, the same thread ")); TestMultiConnSameThread(); TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1613 Multiple connections, different threads ")); TestMultiConnDiffThread(); TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1614 Isolation level ")); TestIsolationLevel(); }
void TestDistributions() { test.Next(_L("Test uniform distribution")); TUniformRandom rand1; rand1.SetParams(100); TestDistribution(rand1, 10000); test.Next(_L("Test normal distribution")); TNormalRandom rand2; rand2.SetParams(100, 25); TestDistribution(rand2, 10000); }
static void MainL() { TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-STDLIB-LEGACY-TMISC3-0001 CTYPE tests ")); ::TestCType(); TheTest.Next(_L("MATH tests")); ::TestMath(); TheTest.Next(_L("MATH DEF113884 tests")); ::TestDef113884(); CloseSTDLIB(); }
void DoTests() { TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1628 GetFirstSqlStmt() test ")); TestGetFirstSqlStmt(); TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-3433 DEF104744 SQL Server crashes on ORDER BY clause ")); DEF104744(); TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-3466 DEF105444 SQL, sqlite3_prepare_v2() demonstrates non-atomic behaviour (handle leak) ")); DEF105444(); TheTest.Next(_L(" Util::Filename() test")); UtilFileNameTest(); }
void doTestsL() { TestUtils::Initialize(_L("t_logpurge")); TestUtils::DeleteDatabaseL(); CLogClient* client = CLogClient::NewL(theFs); CleanupStack::PushL(client); TheTest.Start(_L("Maximum Log Size")); TestMaxLogSizeL(*client); theLog.Write(_L8("Test 1 OK\n")); TheTest.Next(_L("Purge Log When Config Changed")); TestMaxLogSizeConfigL(*client); theLog.Write(_L8("Test 2 OK\n")); TheTest.Next(_L("Test purge by Maximum Log Age enabled/disabled")); TestMaxLogAgeL(*client, 0); // disable purging by age TestMaxLogAgeL(*client, KTestEventAge * 60 * 60 * 24); theLog.Write(_L8("Test 3 OK\n")); TheTest.Next(_L("Maximum Recent List Size")); TestMaxRecentSize1L(*client); theLog.Write(_L8("Test 4 OK\n")); TheTest.Next(_L("Purge Recent Lists When Config Changed")); TestMaxRecentSizeConfigL(*client); theLog.Write(_L8("Test 5 OK\n")); TheTest.Next(_L("Maximum Recent List Size With Duplicates")); TestMaxRecentSize2L(*client); theLog.Write(_L8("Test 6 OK\n")); TheTest.Next(_L("Check no purge when retrieving event")); TestNoPurgeWithGetL(*client); theLog.Write(_L8("Test 7 OK\n")); TheTest.Next(_L("Check ClearLog works for different locales")); TestClearLog1L(*client); TestClearLog2L(*client); theLog.Write(_L8("Test 8 OK\n")); #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4036 CLogClient::ClearLog() + SimId test")); ClearLogSimIdL(*client); theLog.Write(_L8("Test 9 OK\n")); TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4037 CLogClient::ClearLog()/recent + SimId test")); ClearLogRecentSimIdL(*client); theLog.Write(_L8("Test 10 OK\n")); #endif CleanupStack::PopAndDestroy(); // client; }
void DoTestL() { TheTest.Start(_L("Get fast counter frequency")); GetFastCounterFrequency(); TheTest.Next(_L("Create&Fill test database")); CreateDatabase(); FillDatabaseL(); TheTest.Next(_L(" @SYMTestCaseID:PDS-DBMS-UT-4009 Delete tracks")); DeleteTracksL(); TheTest.Next(_L("Commit() test (not a performance test)")); CommitTestL(); }
/** Test the driver for various scenarios of using channels and units @pre TestLoadDriver() called */ void TestExDriver::TestChannelsAndUnits() { iTest.Next(_L("Testing channel access on multiple units")); // Test channel on a single valid unit, invalid unit TestChannelOnMultipleUnits(); iTest.Next(_L("Testing multiple channel access on units")); // Test multiple channels on a unit TestMultipleChannelsOnUnit(); iTest.Next(_L("Testing multiple client access")); // Test dulication of channel handle TestHandleDuplication(); }
LOCAL_C void FuncTestsL() { TExitDetails exitDetail; //Run on 1 ROFS configuration if (KCentrepTestNumberROFS>1) { REQ11283L(); TheTest.Next(_L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4062 " )); exitDetail=LaunchTestThread(_L("illegal use of exattrib=U"),&LegalExAttribUse1L); TEST(exitDetail.iExitType==EExitPanic); TEST(exitDetail.iCategory.Compare(_L("CENREPCLI"))==0); TEST(exitDetail.iReason==KEMultiRofsPanicIllegalRofs); } //Run on 2 ROFS configuration if (KCentrepTestNumberROFS>=2) { PatchGlobalValues(); TheTest.Next(_L("supports adding of settings")); REQ11398L(); TheTest.Next(_L("supports legal global override")); LegalGlobalOverrideL(); } //Run on 3 ROFS configuration if (KCentrepTestNumberROFS>=3) { TheTest.Next(_L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4055 " )); exitDetail=LaunchTestThread(_L("type override"),&PatchTypeL); TEST(exitDetail.iExitType==EExitPanic); TEST(exitDetail.iCategory.Compare(_L("CENREPCLI"))==0); TEST(exitDetail.iReason==KEMultiRofsPanicTypeOveride); TheTest.Next(_L("tests situation where no keyspace file is in CORE layer but there are keyspaces in ROFS")); NoCoreKeyspaceL(); TheTest.Next(_L("tests situation where a keyspace is represented on a number of layers but one layer has been missed out")); MissingRofsLayerL(); } //RUn on 7 ROFS configuration if (KCentrepTestNumberROFS>=7) { TheTest.Next(_L("tests multiple ROFS layers")); REQ11401L(); } //Run on 4 ROFS configuration if (KCentrepTestNumberROFS>=4) { TheTest.Next(_L("tests mixed binary and text keyspace files")); MixedFileTypesL(); } }
void strtod_test() { double d; char* p; struct double_conv *dc; TheTest.Next(_L("text to double conversion")); for (dc=strtods; dc->source; dc++) { d=strtod(dc->source,NULL); TEST(d==dc->answer); } for (dc=strtods; dc->source; dc++) { p=(char*)1; d=strtod(dc->source,&p); TEST(d==dc->answer); TEST(p==dc->source+dc->tail_offset); } /* overflow positive number */ d=strtod("9e9999", NULL); TEST(d==HUGE_VAL && errno==ERANGE); /* overflow negative number */ d=strtod("-9e9999", NULL); TEST(d==-HUGE_VAL && errno==ERANGE); /* underflow number */ d=strtod("9e-9999", NULL); TEST(d==0 && errno==ERANGE); d=strtod("-9e-9999", NULL); TEST(d==0 && errno==ERANGE); }
void arguments(int argc, char *argv[]) { int i; TheTest.Next(_L("Command line arguments")); TEST(argc>0); TEST(argv!=0); printf(" argc=%d\r\n", argc); for (i=0; i<argc; i++) { int j; int length=strlen(argv[i]); TEST(argv[i]!=0); printf(" argv[%d]= ", i); for (j=0;j<4;j++) { printf("%02x ", ((unsigned char *)argv[i])[j]); if (argv[i][j]=='\0') break; } for (;j<3;j++) printf(" "); printf(" \"%s\" length %d\r\n", argv[i], length); } }
void casecmp() { int r; char *s1,*s2; TheTest.Next(_L("Case-insensitive string comparison")); s1="abcd"; r=strcasecmp(s1,s1); TEST(r==0); s2="abcde"; r=strcasecmp(s1,s2); TEST(r<0); r=strcasecmp(s2,s1); TEST(r>0); r=strncasecmp(s1,s2,10); TEST(r<0); r=strncasecmp(s1,s2,4); TEST(r==0); s2="ABcD"; r=strcmp(s1,s2); TEST(r!=0); r=strcasecmp(s1,s2); TEST(r==0); #if 0 /* Need some way to set up a proper folding example */ r=strncasecmp(s2,agrave,1); TEST(r==0); #endif }
void sscanf_test() { int in[4], i; TheTest.Next(_L("Simple SSCANF tests")); in[0] = in[1] = in[2] = in[3] = 6789; i = sscanf("1.2.3.4", "%d.%d.%d.%d", &in[0], &in[1], &in[2], &in[3]); TEST (in[0]==1); TEST (in[1]==2); TEST (in[2]==3); TEST (in[3]==4); TEST (i==4); i = sscanf("194.223.254.9", "%d.%d.%d.%d", &in[0], &in[1], &in[2], &in[3]); TEST (in[0]==194); TEST (in[1]==223); TEST (in[2]==254); TEST (in[3]==9); TEST (i==4); i = sscanf("17.183.hello.11", "%d.%d.%d.%d", &in[0], &in[1], &in[2], &in[3]); TEST (in[0]==17); TEST (in[1]==183); TEST (in[2]==254); TEST (in[3]==9); TEST (i==2); }
void DoTest() { TInt r; gTest.Next(_L("Read startup mode")); TInt sysStartupMode; r = RProperty::Get(KUidSystemCategory, KSystemStartupModeKey, sysStartupMode); gTest(r == KErrNone); // Read operation should be successful RDebug::Printf("System startup mode: %d", sysStartupMode); gTest.Next(_L("write startup mode")); r = RProperty::Set(KUidSystemCategory, KSystemStartupModeKey, 1); if (PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement)) gTest(r == KErrPermissionDenied); // Should have no permission to write else gTest(r == KErrNone); // Should have no permission to write }
void sorting() { int i; TheTest.Next(_L("Quicksort")); for (i=1; i<NITEMS; i++) { list[i].a = 2*i; list[i].b = 5000-(i/2); list[i].c = i*i; } /* Sort into increasing order of a. Want item 0 to sort to position 4 */ list[0].a = 9; list[0].b = 10; list[0].c = 11; qsort(list, NITEMS, sizeof(list[0]), compare_a); TEST(list[4].c==11); validate(list); /* Resort into increasing order of b followed by a. Want item 0 to sort to position 5 */ list[0].a = 9; list[0].b = 5000-((199-4)/2); list[0].c = 13; qsort(list, NITEMS, sizeof(list[0]), compare_ba); TEST(list[5].c==13); validate(list); }