コード例 #1
0
void CMemoryUsageLogger::WriteMaxHeapToLog()
	{
	_LIT(KLogMaxHeapFormat, "%d, %d");

	//connect to file iLogger
	TInt err = iLogger.Connect();
	if (KErrNone == err)
		{
		//create new log file name out of existing
		TInt pos = iFileName.LocateReverse(TChar('.'));
		if (KErrNotFound != pos)
			{
			iFileName.Insert(pos, _L("_max_ram"));

			//create log file
			iLogger.CreateLog(KLbsDevLogFolder, iFileName, EFileLoggingModeOverwrite);
			
			//write header to log file
			iLogger.SetDateAndTime(EFalse, EFalse);

			//create log text and write to log file
			TBuf16<KLbsDevLogMaxBufSize> logData;
			logData.Format(KLogMaxHeapFormat, iMaxHeapTotal, iMaxChunkTotal);
			iLogger.Write(logData);
			iLogger.Write(KNullDesC8);
			}
		iLogger.Close();
		}
	}
コード例 #2
0
/**
   @SYMTestCaseID UIF-ETUL-0024

   @SYMREQ DEF114388
 
   @SYMTestCaseDesc Test of CTulAddressStringTokenizer::SearchPhoneNumberL( const TDesC& aText )
                    with all the phone number separators.
  
   @SYMTestPriority Normal 
 
   @SYMTestStatus Implemented
  
   @SYMTestActions There should be 5 phone numbers separators:
                      - KCharLinefeed = 0x000A 
                      - KCharFormfeed = 0x000C
                      - KCharCarriageReturn = 0x000D
                      - KCharLineSeparator = 0x2028
                      - KCharParagraphSeparator = 0x2029
                   With a simple string _LIT16(KTestPhoneSeparator, "11111%c22222")
                   and with all the separators above, we apply the tested function:
                   CTulAddressStringTokenizer::SearchPhoneNumberL( const TDesC& aText )
                      
  
   @SYMTestExpectedResults On the 5 cases, the function should find 2 phone numbers
                           i.e: multiSearch->ItemCount() should be equal to 2
                           otherwise the test fail.
 */
void CT_AddressStringTokenizerStep::TestPhoneSearchSeparatorsL()
	{
	TInt KCharLinefeed = 0x000A;
	TInt KCharFormfeed = 0x000C;
	TInt KCharCarriageReturn = 0x000D;
	TInt KCharLineSeparator = 0x2028;
	TInt KCharParagraphSeparator = 0x2029;
	TInt KSeparators[5]={KCharLinefeed,KCharFormfeed,KCharCarriageReturn,KCharLineSeparator,KCharParagraphSeparator};
	_LIT16(KTestPhoneSeparator, "11111%c22222");
	TBool succeed=ETrue;
	TBuf16<16> str;
	for (TInt k=0;k<5;k++)
		{
		str.Format(KTestPhoneSeparator,KSeparators[k]);
		CTulAddressStringTokenizer* multiSearch = CTulAddressStringTokenizer::NewL(str,
				CTulAddressStringTokenizer::EFindItemSearchPhoneNumberBin);

		 if (multiSearch->ItemCount()!=2)
			 {
			 succeed=EFalse;
			 }
		 delete multiSearch;
		 if (succeed==EFalse)
			 {
			 break;
			 }
		}
	TEST(succeed);	
	}
コード例 #3
0
ファイル: SEIConnector.cpp プロジェクト: fedor4ever/packaging
TInt CSEIConnector::RunError(TInt aError)
	{
	//TODO: see how to handle this
	_LIT(KErrorPattern, "@CSEIConnector::RunError: %d");
	TBuf16<128> buf;
	buf.Format(KErrorPattern, aError);
	iDriver->Log(buf);
	return KErrNone;
	}
コード例 #4
0
/** Tests the creation of a directory with 2 threads accessing different directories 
	(the current and one with 300 files)

	@param aSelector Configuration in case of manual execution
*/
LOCAL_C TInt TestMakeMultDif(TAny* aSelector)
	{
	TInt i = 100;
	TBuf16<50> directory;
	TBuf16<50> dirtemp;
	TInt testStep;
	
	Validate(aSelector);

	CreateDirWithNFiles(300,3);		
			
	directory = gSessionPath;
	dirtemp.Format(KDirMultipleName2, 3, 300);
	directory.Append(dirtemp);
	gDelEntryDir2 = directory;

	test.Printf(_L("#~TS_Title_%d,%d: MkDir with mult clients accessing dif dirs, RFs::MkDir\n"), gTestHarness, gTestCase);
	
	i = 100;
	testStep = 1;
	while(i <= KMaxFiles)
		{	
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
			{
			directory = gSessionPath;
			dirtemp.Format(KDirMultipleName2, 2, i);
			directory.Append(dirtemp);
			gDelEntryDir = directory;

			DoTest2(DeleteEntryAccess);

			MakeDir(i, testStep++);	

			DoTestKill();
			}
		i += 100;
		}

	gTestCase++;
	return(KErrNone);
	}
コード例 #5
0
void CMemoryUsageLogger::WriteToLog()
	{
	//seconds passed since start of application
	TTime currentTime;
	TTimeIntervalSeconds seconds;
	currentTime.UniversalTime();
	currentTime.SecondsFrom(iStartTime, seconds);
	
	if (seconds.Int() <= 60)
		{
		TInt heapTotal = 0;
		TInt heapAvail = 0;
		TInt chunkTotal = 0;
		TInt chunkAvail = 0;
		TInt cellsTotal = 0;
		TInt cellsAvail = 0;
		TInt heapStackTotal = 0;
		TInt ramTotal = 0;
		TInt ramAvail = 0;
		
		//get system memory info from hardware abstraction layer
		HAL::Get(HAL::EMemoryRAM, ramTotal);
		HAL::Get(HAL::EMemoryRAMFree, ramAvail);
		
		//get process UID
		TSecureId processUid(iProcess.SecureId());
		
		//get various heap and chunk memory sizes
		iHeap.AllocSize(heapTotal);
		if (heapTotal > iMaxHeapTotal)
			{
			iMaxHeapTotal = heapTotal;
			}
		iHeap.Available(heapAvail);
		chunkTotal = iHeap.Size();
		chunkAvail = chunkTotal - heapTotal;
		if (chunkTotal > iMaxChunkTotal)
			{
			iMaxChunkTotal = chunkTotal;
			}
		
		//get cells info
		cellsTotal = iHeap.Count(cellsAvail);
		
		//sum up the total heap and stack sizes
		heapStackTotal = heapTotal + iStackSize;
		
		//create log text and write to log file
		TBuf16<KLbsDevLogMaxBufSize> logData;
		logData.Format(KLogFormat, seconds.Int(), processUid.iId, iStackSize, heapTotal, heapAvail, chunkTotal, chunkAvail, cellsTotal, cellsAvail, heapStackTotal, ramTotal, ramAvail);
		iLogger.Write(logData);
		}
	}
コード例 #6
0
ファイル: t_fsched.cpp プロジェクト: kuailexs/symbiandump-os1
/** Generates a file name of the form FFFFF*<aPos>.TXT (aLong.3)

	@param aBuffer The filename will be returned here
	@param aLong   Defines the longitude of the file name 
	@param aPos	   Defines the number that will be attached to the filename
*/
void FileNameGen(TDes16& aBuffer, TInt aLong, TInt aPos) 
{
	TInt padding;
	TInt i=0;
	TBuf16<10> tempbuf;
	
	_LIT(KNumber,"%d");
	tempbuf.Format(KNumber,aPos);
	padding=aLong-tempbuf.Size()/2;
	aBuffer=_L("");
	while(i<padding)
	{
		aBuffer.Append('F');
		i++;
	}
	aBuffer.Append(tempbuf);
	
	_LIT(KExtension1, ".TXT");
	aBuffer.Append(KExtension1);
}
コード例 #7
0
// this function was copied from t_sdpartition.cpp
TInt FindMmcLocalDriveNumber(TChar aDriveChar, TInt& aLocalDriveNum, TInt aDriveNum)
	{
	TInt r = fs.CharToDrive(aDriveChar, aDriveNum);
	test(r==KErrNone);

	TDriveInfo driveInfo;
    r = fs.Drive(driveInfo, aDriveNum);
    test(r==KErrNone);


	TVolumeInfo vi;
	r = fs.Volume(vi, aDriveNum);
    test(r==KErrNone);


	TMediaSerialNumber serialNum;
	r = fs.GetMediaSerialNumber(serialNum, aDriveNum);
    test(r==KErrNone);


    test.Printf(_L("Drive %C size %ld\n"), (char) aDriveChar, vi.iSize);
	TInt len = serialNum.Length();
	test.Printf(_L("Serial number (len %d) :"), len);
	TInt n;
	for (n=0; n<len; n+=16)
		{
		TBuf16<16*3 +1> buf;
		for (TInt m=n; m<n+16; m++)
			{
			TBuf16<3> hexBuf;
			hexBuf.Format(_L("%02X "),serialNum[m]);
			buf.Append(hexBuf);
			}
		buf.Append(_L("\n"));
		test.Printf(buf);
		}

	TBusLocalDrive drv;
	TBool chg(EFalse);
	aLocalDriveNum = -1;
	TInt serialNumbersMatched = 0;
	for (n=0; n<KMaxLocalDrives; n++)
		{
		r = drv.Connect(n, chg); //for user area
//RDebug::Print(_L("TBusLocalDrive::Connect(%d) %d"), n, r);

		if(r != KErrNone)
			{
			test.Printf(_L("drive %d: TBusLocalDrive::Connect() failed %d\n"), n, r);
			continue;
			}	

	    TLocalDriveCapsV5Buf capsBuf;
	    TLocalDriveCapsV5& caps = capsBuf();
		r = drv.Caps(capsBuf);
		if(r != KErrNone)
			{
			test.Printf(_L("drive %d: TBusLocalDrive::Caps() failed %d\n"), n, r);
			continue;
			}	

//RDebug::Print(_L("areaSize %ld cardCapacity %ld"), caps.iSize, caps.iFormatInfo.iCapacity);

		TPtrC8 localSerialNum(caps.iSerialNum, caps.iSerialNumLength);
		if (serialNum.Compare(localSerialNum) == 0)
			{
			serialNumbersMatched++;
			TBool sizeMatch = (vi.iSize < caps.iSize);
			test.Printf(_L("drive %d: Serial number match, size match: %S\n"), n, sizeMatch?&KYes:&KNo);
			if (sizeMatch)
				{
				aLocalDriveNum = n;
				drv.Disconnect();
				break;
				}
			}
		drv.Disconnect();
		}


	return aLocalDriveNum == -1?KErrNotFound:KErrNone;
	}
コード例 #8
0
void CT_ISO2022JP1_2::TestIso2022Jp(CCnvCharacterSetConverter * characterSetConverter, TBool isS60version)
    {
    //
    INFO_PRINTF1(_L("Empty descriptor"));
    TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 0, 10, 0, KNullDesC8, KNullDesC8, KNullDesC16);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 0, 10, 0, 0, KNullDesC16, KNullDesC8);
    INFO_PRINTF1(_L("Testing converting to ISO-2022-JP"));

    _LIT(KTestUnicode,">.@>0l90");
    _LIT(KTestUnicode2,"\x0393\x03b1\x03c3\x03bf\x03c5\x3055\x3088");
    TestConversionFromUnicodeToIso(*characterSetConverter, KTestUnicode2);
    TestConversionFromUnicodeToIso(*characterSetConverter, KTestUnicode);
    
    TBuf16<50> originalUnicode;
    originalUnicode.Format(_L16("%c%c%c%c%c\xa5%c%c%c%c%c"), 0x0393, 0x03b1, 0x03c3, 0x03bf, 0x03c5, 0x3055, 0x3088, 0x3046, 0x306a, 0x3089);
    TestTruncatedConversionFromUnicodeToIso2022Jp(*characterSetConverter, originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 3, 7, 12, _L8(""), _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 8, 9, 11, _L8("\x1b\x24\x42\x26\x23\x1b\x28\x42"), _L8("\x1b\x24\x42\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 10, 11, 10, _L8("\x1b\x24\x42\x26\x23\x26\x41\x1b\x28\x42"), _L8("\x1b\x24\x42\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 12, 13, 9, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x1b\x28\x42"), _L8("\x1b\x24\x42\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 14, 15, 8, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x1b\x28\x42"), _L8("\x1b\x24\x42\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 16, 19, 7, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x42"), _L8("\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//    TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 20, 23, 6, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42"), _L8("\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 24, 28, 5, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\"), _L8("\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 29, 30, 4, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x1b\x28\x42"), _L8("\x1b\x24\x42\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 31, 32, 3, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x1b\x28\x42"), _L8("\x1b\x24\x42\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 33, 34, 2, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x1b\x28\x42"), _L8("\x1b\x24\x42\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 35, 36, 1, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x1b\x28\x42"), _L8("\x1b\x24\x42\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 37, 50, 0, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), KNullDesC8, originalUnicode);
    originalUnicode.Format(_L16("%cX%cY%cZ"), 0x6153, 0x6376, 0x65d9);
    TestTruncatedConversionFromUnicodeToIso2022Jp(*characterSetConverter, originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 3, 7, 6, _L8(""), _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 8, 11, 5, _L8("\x1b\x24\x42XX\x1b\x28\x42"), _L8("X\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 12, 16, 4, _L8("\x1b\x24\x42XX\x1b\x28\x42X"), _L8("\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 17, 20, 3, _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42"), _L8("Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 21, 25, 2, _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42Y"), _L8("\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 26, 29, 1, _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42"), _L8("Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 30, 40, 0, _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), KNullDesC8, originalUnicode);
    INFO_PRINTF1(_L("Testing converting to Unicode"));
    const TPtrC8 originalIso2022Jp(_S8("\x1b\x24\x40\x1b\x28\x4aMy name is \x1b\x28\x4a\x1b\x28\x42\x1b\x24\x40\x25\x47\x25\x23\x25\x53\x25\x45\x1b\x28\x4a in \x1b\x24\x42\x46\x7c\x4b\x5c\x38\x6c\x1b\x28\x42\\~\x1b\x28\x4a\\~"));
    TBuf16<50> expectedUnicode;
    if (!isS60version)        
        expectedUnicode.Format(_L16("My name is %c%c%c%c in %c%c%c\\~%c%c"), 0x30c7, 0x30a3, 0x30d3, 0x30c5, 0x65e5, 0x672c, 0x8a9e, 0x00a5, 0x203e);
    else
        expectedUnicode.Format(_L16("My name is %c%c%c%c in %c%c%c\\~%c%c"), 0x30c7, 0x30a3, 0x30d3, 0x30c5, 0x65e5, 0x672c, 0x8a9e, 0x00a5, 0x7e);
    TestTruncatedConversionToUnicodeFromIso2022Jp(*characterSetConverter, expectedUnicode, originalIso2022Jp);
    TestTruncatedConversionToUnicodeFromIso2022Jp(*characterSetConverter, _L16(" Hello"), _L8("\x1b\x24\x42\x1b\x28\x4a\x1b\x24\x42\x1b\x28\x4a\x1b\x24\x42\x1b\x28\x4a Hello"));
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 0, 0, 60, 0, expectedUnicode, originalIso2022Jp);
    for (int i=1; i<=10; ++i)
        {
        TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, i, i, 54-i, i, expectedUnicode, originalIso2022Jp);
        }
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 11, 11, 34, 11, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 12, 12, 32, 12, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 13, 13, 30, 13, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 14, 14, 28, 14, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 15, 15, 23, 15, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 16, 16, 22, 16, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 17, 17, 21, 17, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 18, 18, 20, 18, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 19, 19, 16, 19, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 20, 20, 14, 20, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 21, 21, 12, 21, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 22, 22, 7, 22, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 23, 23, 6, 23, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 24, 24, 2, 24, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 25, 25, 1, 25, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 26, 40, 0, 26, expectedUnicode, originalIso2022Jp);
    INFO_PRINTF1(_L("Testing the default ISO-2022-JP state"));
    for (int i=0; i<=6; ++i)
        {
        TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, i, i, 6-i, i, _L16("Hello\xa5"), _L8("Hello\\"));
        }
    INFO_PRINTF1(_L("Testing ill-formed ISO-2022-JP"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24\x42\x21\x1b\x28\x4a def"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24\x42\x21\x21\x21\x1b\x28\x4a def"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24\x42\x21\x21\x21\x21\x21\x1b\x28\x4a def"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24\xff"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x26\x40"));
    }
コード例 #9
0
/**
@SYMTestCaseID          SYSLIB-CHARCONV-CT-0540
@SYMTestCaseDesc        JIS to Unicode and Unicode to EucJpPacked conversion tests
@SYMTestPriority        Medium
@SYMTestActions         Calls up all conversion test functions from EucJpPacked to Unicode
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
void CT_EUCJP_PACKED_2::DoE32MainL()
	{
	RFs fileServerSession;
	CleanupClosePushL(fileServerSession);
	User::LeaveIfError(fileServerSession.Connect());
	CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* arrayOfCharacterSetsAvailable=CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(fileServerSession);
	INFO_PRINTF1(_L("Available:\n"));
	TInt i;
	for (i=arrayOfCharacterSetsAvailable->Count()-1; i>=0; --i)
		{
		const CCnvCharacterSetConverter::SCharacterSet& charactersSet=(*arrayOfCharacterSetsAvailable)[i];
		characterSetConverter->PrepareToConvertToOrFromL(charactersSet.Identifier(), *arrayOfCharacterSetsAvailable, fileServerSession);
		TPtrC charactersSetName(charactersSet.Name());
		if (charactersSet.NameIsFileName())
			{
			charactersSetName.Set(TParsePtrC(charactersSetName).Name());
			}
		INFO_PRINTF2(_L("    %S\n"), &charactersSetName);
		}
	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0540 Testing EUC-JP (packed) conversions "));
	characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetTestEucjpPacked_2, *arrayOfCharacterSetsAvailable, fileServerSession);
	//
	INFO_PRINTF1(_L("Empty descriptor"));
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 0, 10, 0, 0, KNullDesC8, KNullDesC16);
	TestSplittingConvertingToUnicodeFromEucJpPacked(*characterSetConverter, 0, 10, 0, 0, KNullDesC16, KNullDesC8);
	INFO_PRINTF1(_L("Testing converting to EUC-JP (packed)"));
	TBuf16<50> originalUnicode;
	originalUnicode.Format(_L16("Some %c%c%c%c%c%c"), 0xff9a, 0xff70, 0x6f22, 0x5b57, 0x5379, 0x5dce);
	const TPtrC8 expectedEucJpPacked(_S8("Some \x8e\xda\x8e\xb0\xb4\xc1\xbb\xfa\x8f\xb4\xc1\x8f\xbb\xfa"));
	TestTruncatedConversionFromUnicodeToEucJpPacked(*characterSetConverter, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 0, 0, 11, 0, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 1, 1, 10, 1, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 2, 2, 9, 2, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 3, 3, 8, 3, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 4, 4, 7, 4, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 5, 6, 6, 5, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 7, 8, 5, 7, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 9, 10, 4, 9, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 11, 12, 3, 11, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 13, 15, 2, 13, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 16, 18, 1, 16, expectedEucJpPacked, originalUnicode);
	TestSplittingConvertingFromUnicodeToEucJpPacked(*characterSetConverter, 19, 30, 0, 19, expectedEucJpPacked, originalUnicode);
	INFO_PRINTF1(_L("Testing converting to Unicode"));
	const TPtrC8 originalEucJpPacked(_S8("pool\xbe\xae\xc3\xd3\x8e\xcc\x8e\xdf\x8e\xd9\x8f\xc0\xcd\x8f\xc8\xc5pool\x8e\xcc\x8e\xdf\x8e\xd9\xbe\xae\xc3\xd3\x8f\xc0\xcd\x8f\xc8\xc5\xbe\xae\xc3\xd3pool\x8f\xc0\xcd\x8f\xc8\xc5\x8e\xcc\x8e\xdf\x8e\xd9pool"));
	TBuf16<50> expectedUnicode;
	expectedUnicode.Format(_L16("pool%c%c%c%c%c%c%cpool%c%c%c%c%c%c%c%c%cpool%c%c%c%c%cpool"), 0x5c0f, 0x6c60, 0xff8c, 0xff9f, 0xff99, 0x641e, 0x6f0d, 0xff8c, 0xff9f, 0xff99, 0x5c0f, 0x6c60, 0x641e, 0x6f0d, 0x5c0f, 0x6c60, 0x641e, 0x6f0d, 0xff8c, 0xff9f, 0xff99);
	TestTruncatedConversionToUnicodeFromEucJpPacked(*characterSetConverter, expectedUnicode, originalEucJpPacked);
	TestTruncatedConversionToUnicodeFromEucJpPacked(*characterSetConverter, expectedUnicode.Mid(4, 2), originalEucJpPacked.Mid(4, 4));
	TestTruncatedConversionToUnicodeFromEucJpPacked(*characterSetConverter, expectedUnicode.Mid(6, 3), originalEucJpPacked.Mid(8, 6));
	TestTruncatedConversionToUnicodeFromEucJpPacked(*characterSetConverter, expectedUnicode.Mid(9, 2), originalEucJpPacked.Mid(14, 6));
	static const TInt numberOfCharactersInEachHomogeneousRun[13]={4, 2, 3, 2, 4, 3, 2, 2, 2, 4, 2, 3, 4};
	static const TInt numberOfBytesPerCharacterInEachHomogeneousRun[13]={1, 2, 2, 3, 1, 2, 2, 3, 2, 1, 3, 2, 1};
	TInt e=64;
	TInt u=0;
	for (i=0; i<13; ++i)
		{
		TInt j;
		for (j=0; j<numberOfCharactersInEachHomogeneousRun[i]; ++j, ++u, e-=numberOfBytesPerCharacterInEachHomogeneousRun[i])
			{
			TestSplittingConvertingToUnicodeFromEucJpPacked(*characterSetConverter, u, u, e, u, expectedUnicode, originalEucJpPacked);
			}
		}
	test(e==0);
	test(u==37);
	TestSplittingConvertingToUnicodeFromEucJpPacked(*characterSetConverter, u, u+10, e, u, expectedUnicode, originalEucJpPacked);
	INFO_PRINTF1(_L("Testing ill-formed EUC-JP (packed)"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\xa1"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\xa1\xb2\xc3"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\xa1\xb2\x8e"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\xa1\xb2\x8f"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\xa1\xb2\x8f\xaa"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8e\xd4\x8e"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8e\xd4\x8f"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8e\xd4\x8f\xbb"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8f\xe5\x8e"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8f\xe5\x8f"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8f\xe5\x8f\xcc"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("xyz\x8e\xd4\x8e"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("xyz\x8e\xd4\x8f"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("xyz\x8e\xd4\x8f\xdd"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("xyz\x8f\xe5\x8e"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("xyz\x8f\xe5\x8f"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("xyz\x8f\xe5\x8f\xee"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8e "));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8f "));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8f\xf1 "));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8e\x41"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8f\x41"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\x8f\xe2\x41"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("amb\x8e "));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("amb\x8f "));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("amb\x8f\xf1 "));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("amb\x8e\x41"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("amb\x8f\x41"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("amb\x8f\xe2\x41"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\xa1 "));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("\xa1\x61"));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("eb\xa1 "));
	TestIsIllFormedEucJpPacked(*characterSetConverter, _L8("eb\xa1\x61"));

    const TPtrC8 originalEucJpPackedYen(_S8("pool\x5c"));
    TBuf16<10> expectedUnicodeBackSlash;
    expectedUnicodeBackSlash.Format(_L16("pool%c"), 0x005c);
    TInt state=CCnvCharacterSetConverter::KStateDefault;
    TBuf16<KBufferLength> generatedUnicodeBackSlash;
    test(characterSetConverter->ConvertToUnicode(generatedUnicodeBackSlash, originalEucJpPackedYen, state) == 0);
    test(generatedUnicodeBackSlash==expectedUnicodeBackSlash);
	
	CleanupStack::PopAndDestroy(3); // arrayOfCharacterSetsAvailable and characterSetConverter and fileServerSession
	}
コード例 #10
0
/** Find last.txt by opening the file and with two threads accessing the current 
	directory and other one 

	@param aN Number of files in the directory
	@param aStep 	Test step
*/
LOCAL_C void FindFileMD2(TInt aN, TInt aStep) 
	{
	TBuf16<100> dir1;
	TBuf16<100> dir2;
	TBuf16<100> dir3;
	TBuf16<100> dir4;
	TBuf16<100> dirtemp;

	TInt r = 0;

	TTime startTime;
	TTime endTime;
	TTimeIntervalMicroSeconds timeTaken(0);
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; 

	RFile file;
	
	if(aN <= gFilesLimit) 
		{
		dir1 = gSessionPath;
		dir2 = gSessionPath;
		dir3 = gSessionPath;

		dirtemp.Format(KDirMultipleName2, 1, aN);
		dir1.Append(dirtemp);
		gFindDir = dir1;
		
		dirtemp.Format(KDirMultipleName2, 2, aN);
		dir2.Append(dirtemp);

		dirtemp.Format(KDirMultipleName2, 3, aN);
		dir3.Append(dirtemp);
			
		dir1.Append(KCommonFile);
		gFindEntryDir = dir1;
		
		dir4 = gSessionPath;
		dirtemp.Format(KDirMultipleName, 3, 300);
		dir4.Append(dirtemp);

		
		if(gTypes >= 1) 
			{	
			gFindDir2 = dir4;
			dir4.Append(KCommonFile);
			gFindEntryDir2 = dir4;

			DoTest2(FindEntryAccess);

			User::After(200);
			
			startTime.HomeTime();
			
			r = file.Open(TheFs,dir1,EFileShareAny|EFileWrite);
			FailIfError(r);
			
			endTime.HomeTime();
			
			timeTaken = endTime.MicroSecondsFrom(startTime);

			file.Close();
			DoTestKill();
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
		
		if(gTypes >= 2) 
			{	
			gFindDir = dir2;
			dir2.Append(KCommonFile);
			gFindEntryDir = dir2;
			DoTest2(FindEntryAccess);
			
			User::After(200);
			startTime.HomeTime();

			r = file.Open(TheFs, dir2, EFileShareAny|EFileWrite);
			FailIfError(r);
			
			endTime.HomeTime();
			timeTaken = endTime.MicroSecondsFrom(startTime);
			file.Close();
			DoTestKill();
			
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
			
		if(gTypes >= 3) 
			{	
			gFindDir = dir3;	
			dir3.Append(KCommonFile);
			gFindEntryDir = dir3;
			DoTest2(FindEntryAccess);

			User::After(200);
			startTime.HomeTime();

			r = file.Open(TheFs, dir3, EFileShareAny|EFileWrite);
			FailIfError(r);
			
			endTime.HomeTime();
			timeTaken=endTime.MicroSecondsFrom(startTime);
			DoTestKill();
			
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
			file.Close();
			}
		}

	PrintResult(aStep, 1, aN);
	PrintResultTime(aStep, 2, timeTaken1);
	PrintResultTime(aStep, 3, timeTaken2);
	PrintResultTime(aStep, 4, timeTaken3);
	}
コード例 #11
0
/** Find last.txt with TFindFile and with two threads accessing the 2 directories

	@param aN Number of files in the directory
	@param aStep 	Test step
*/
LOCAL_C void FindFileMD1(TInt aN, TInt aStep) 
	{
	TBuf16<100> dir1;
	TBuf16<100> dir2;
	TBuf16<100> dir3;
    TBuf16<100> dir4;
    TBuf16<100> dirtemp;
	
	TInt r = 0;
	TFindFile find(TheFs);
	TTime startTime;
	TTime endTime;
	TTimeIntervalMicroSeconds timeTaken(0);
	TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1; 

	if(aN <= gFilesLimit) 
		{
		dir1 = gSessionPath;
		dir2 = gSessionPath;
		dir3 = gSessionPath;

		dirtemp.Format(KDirMultipleName2, 1, aN);
		dir1.Append(dirtemp);

		dirtemp.Format(KDirMultipleName, 2, aN);
		dir2.Append(dirtemp);

		dirtemp.Format(KDirMultipleName, 3, aN);
		dir3.Append(dirtemp);
		
		dir4 = gSessionPath;
		dirtemp.Format(KDirMultipleName, 3, 300);
		
		dir4.Append(dirtemp);
		
		gFindDir = dir1;
		gFindDir2 = dir4;
		
		dir1.Append(KCommonFile);
		dir2.Append(KCommonFile);
		dir3.Append(KCommonFile);
		dir4.Append(KCommonFile);
		
		gFindEntryDir = dir1;
		gFindEntryDir2 = dir4;
		

		TheFs.SetSessionPath(gSessionPath);
		
		dir4.Format(KDirMultipleName, 1, aN);
		
		if(gTypes >= 1) 
			{	
			DoTest2(FindEntryAccess);

			startTime.HomeTime();
	 		r = find.FindByPath(dir1, &dir4);
			FailIfError(r);
			endTime.HomeTime();
			
			DoTestKill();
			
			timeTaken = endTime.MicroSecondsFrom(startTime);
			timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}

		if(gTypes >= 2) 
			{	
			dir4 = gSessionPath; 
			dirtemp.Format(KDirMultipleName, 2, aN);
			dir4.Append(dirtemp);
			gFindDir = dir4;
			gFindEntryDir=dir2;

			DoTest2(FindEntryAccess);
			dir4.Format(KDirMultipleName, 2, aN);
	
			startTime.HomeTime();

			r = find.FindByPath(dir2,&dir4);
			test(r==KErrNone);
			endTime.HomeTime();
			timeTaken=endTime.MicroSecondsFrom(startTime);
			DoTestKill();
			timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
		
		if(gTypes>=3) 
			{	
			dir4 = gSessionPath; 
			dirtemp.Format(KDirMultipleName, 3, aN);
			dir4.Append(dirtemp);

			gFindDir = dir4;
			gFindEntryDir=dir2;
			
			DoTest2(FindEntryAccess);
			dir4.Format(KDirMultipleName, 3, aN);
		
			startTime.HomeTime();

			r=find.FindByPath(dir3,&dir4);
			test(r==KErrNone);
			
			endTime.HomeTime();
			DoTestKill();
			
			timeTaken=endTime.MicroSecondsFrom(startTime);
			timeTaken3 = I64LOW(timeTaken.Int64() / gTimeUnit);
			}
		}
	
	PrintResult(aStep, 1, aN);
	PrintResultTime(aStep, 2, timeTaken1);
	PrintResultTime(aStep, 3, timeTaken2);
	PrintResultTime(aStep, 4, timeTaken3);
	}