--- a/charconvfw/fatfilenameconversionplugins/test/T_CP936.CPP Wed Jun 09 11:40:52 2010 +0300
+++ b/charconvfw/fatfilenameconversionplugins/test/T_CP936.CPP Tue Aug 31 17:01:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -16,10 +16,18 @@
*/
-#include <e32test.h>
-#include <e32des8.h>
+#include "T_CP936.h"
-LOCAL_D RTest test(_L("T_CP936.exe"));
+#define test(cond) \
+ { \
+ TBool __bb = (cond); \
+ TEST(__bb); \
+ if (!__bb) \
+ { \
+ ERR_PRINTF1(_L("ERROR: Test Failed")); \
+ User::Leave(1); \
+ } \
+ }
_LIT16(Uni_1, "\x0053\x0059\x004D\x3125\x312F\x3122\xFFFF\x9673\xFA29");
_LIT8(CP936_1, "\x53\x59\x4D\xA8\xE5\x5F\xA8\xE2\x5F\xEA\x90\xFE\x4F");
@@ -40,9 +48,10 @@
@SYMTestActions Tests for conversions from/to Unicode, using a function pointer
@SYMTestExpectedResults Test must not fail
*/
-void Test()
+void CT_CP936::TestL()
{
- test.Next(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1778 "));
+ INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1778 "));
+
RLibrary lib;
const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
@@ -102,9 +111,10 @@
@SYMTestActions Tests for correct character conversion on certain chinese characters for CP936
@SYMTestExpectedResults Test must not fail
*/
-void TestINC090073()
+void CT_CP936::TestINC090073L()
{
- test.Next(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0001 "));
+ INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0001 "));
+
_LIT16(unicode, "\x7CCD\x74EF\x8026\x8F8F\x94F3\x7633\x6DFC\x9785\x7F81\x7A37\x61A9\x80B1\x86A3\x89E5\x80F2\x9B48\x9E47\x6C19\x7B71\x946B\x6B46\x6615");
_LIT8(CP932Code, "\xF4\xD9\xEA\xB1\xF1\xEE\xEA\xA3\xEF\xA5\xF1\xAC\xED\xB5\xF7\xB1\xEE\xBF\xF0\xA2\xED\xAC\xEB\xC5\xF2\xBC\xF6\xA1\xEB\xDC\xF7\xCC\xF0\xC2\xEB\xAF\xF3\xE3\xF6\xCE\xEC\xA7\xEA\xBF");
@@ -124,7 +134,7 @@
TConvertFromUnicodeL aConvertFromUnicodeL = reinterpret_cast <TConvertFromUnicodeL> (function1);
TBuf8<50> foreign1;
-
+
foreign1.Zero();
const TDesC16& unicode1(unicode);
TRAPD(err,(*aConvertFromUnicodeL)(foreign1, unicode1)); //testing conversion from Unicode
@@ -136,9 +146,9 @@
lib.Close();
}
-void OOMTest()
+void CT_CP936::OOMTestL()
{
- test.Next(_L("OOM testing"));
+ INFO_PRINTF1(_L("OOM testing"));
TInt err, tryCount = 0;
do
{
@@ -151,7 +161,7 @@
// Setting Heap failure for OOM test
__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
- TRAP(err,Test());
+ TRAP(err,TestL());
__UHEAP_SETFAIL(RHeap::ENone, 0);
@@ -167,37 +177,30 @@
}while (err == KErrNoMemory);
test(err == KErrNone);
- test.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
- }
-
-
-LOCAL_C void DoE32MainL()
- {
- __UHEAP_MARK;
-
- Test();
- TestINC090073();
- OOMTest();
-
- __UHEAP_MARKEND;
+ INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i"), tryCount);
}
-GLDEF_C TInt E32Main()
- {
- __UHEAP_MARK;
+CT_CP936::CT_CP936()
+ {
+ SetTestStepName(KTestStep_T_CP936);
+ }
- test.Title();
- test.Start(_L("CP936 test..."));
+TVerdict CT_CP936::doTestStepL()
+ {
+ SetTestStepResult(EFail);
+
+ __UHEAP_MARK;
- CTrapCleanup* trapCleanup=CTrapCleanup::New();
- TRAPD(error, DoE32MainL());
- test(error==KErrNone);
-
- delete trapCleanup;
-
- test.End();
- test.Close();
+ TRAPD(error1, TestL());
+ TRAPD(error2, TestINC090073L());
+ TRAPD(error3, OOMTestL());
+
+ __UHEAP_MARKEND;
- __UHEAP_MARKEND;
- return error;
- }
+ if(error1 == KErrNone && error2 == KErrNone && error3 == KErrNone)
+ {
+ SetTestStepResult(EPass);
+ }
+
+ return TestStepResult();
+ }