charconvfw/fatfilenameconversionplugins/test/T_CP949.CPP
branchRCL_3
changeset 16 748ec5531811
parent 0 1fb32624e06b
child 17 336bee5c2d35
--- a/charconvfw/fatfilenameconversionplugins/test/T_CP949.CPP	Wed Jun 09 11:40:52 2010 +0300
+++ b/charconvfw/fatfilenameconversionplugins/test/T_CP949.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,20 @@
 */
 
 
-#include <e32test.h>
+#include "T_CP949.h"
 #include <e32des8.h>
 
-LOCAL_D RTest test(_L("T_CP949.exe"));
+#define test(cond)                                          \
+    {                                                       \
+    TBool __bb = (cond);                                    \
+    TEST(__bb);                                             \
+    if (!__bb)                                              \
+        {                                                   \
+        ERR_PRINTF1(_L("ERROR: Test Failed"));              \
+        User::Leave(1);                                     \
+        }                                                   \
+    }
+
 
 _LIT16(Uni_1, "\xFFFF\x0053\x0059\x004D\x0042\x0049\x0041\x004E\xAC21\xC6AA\xFFFF\x9673\x8A70");
 _LIT8(CP949_1, "\x5F\x53\x59\x4D\x42\x49\x41\x4E\x81\x4D\x9F\x42\x5F\xF2\xE7\xFD\xFE");
@@ -40,9 +50,9 @@
 @SYMTestActions  	    Tests for conversions from/to Unicode, using a function pointer
 @SYMTestExpectedResults Test must not fail
 */
-void Test()
+void CT_CP949::TestL()
 	{
-	test.Next(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1777 "));
+    INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1777 "));
 	RLibrary lib;
 
 	const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
@@ -103,9 +113,9 @@
 @SYMTestActions  	    Tests for correct character conversion on certain chinese characters for CP936
 @SYMTestExpectedResults Test must not fail
 */
-void TestINC090073()
+void CT_CP949::TestINC090073L()
 	{
-	test.Next(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0002 "));
+    INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0002 "));
  	_LIT16(unicode, "\x715C\x7A37\x61A9\x80B1\x86A3\x6B46\x6615");
 	_LIT8(CP932Code, "\xE9\xF2\xF2\xC3\xCC\xA8\xCE\xDD\xCD\xF7\xFD\xE4\xFD\xDA");
 
@@ -137,9 +147,9 @@
 	lib.Close();
 	}
 
-void OOMTest()
+void CT_CP949::OOMTestL()
 	{
-	test.Next(_L("OOM testing"));
+    INFO_PRINTF1(_L("OOM testing"));
 	TInt err, tryCount = 0;
 	do
 		{
@@ -152,7 +162,7 @@
 			// Setting Heap failure for OOM test
 		__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
 
-		TRAP(err,Test());
+		TRAP(err,TestL());
 
 		__UHEAP_SETFAIL(RHeap::ENone, 0);
 
@@ -168,37 +178,33 @@
 		}while (err == KErrNoMemory);
 
 	test(err == KErrNone);
-	test.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
+	INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
 	}
 
 
-LOCAL_C void DoE32MainL()
-	{
-	__UHEAP_MARK;
+CT_CP949::CT_CP949()
+    {
+    SetTestStepName(KTestStep_T_CP949);
+    }
+
 
-	Test();
-	TestINC090073();
-	OOMTest();
 
-	__UHEAP_MARKEND;
-	}
+TVerdict CT_CP949::doTestStepL()
+    {
+    SetTestStepResult(EFail);
 
-GLDEF_C TInt E32Main()
-	{
-	__UHEAP_MARK;
+    __UHEAP_MARK;
 
-	test.Title();
-	test.Start(_L("CP949 test..."));
+    TRAPD(error1, TestL());
+    TRAPD(error2, TestINC090073L());
+    TRAPD(error3, OOMTestL());
 
-	CTrapCleanup* trapCleanup=CTrapCleanup::New();
-	TRAPD(error, DoE32MainL());
-	test(error==KErrNone);
+    __UHEAP_MARKEND;
 
-	delete trapCleanup;
+    if(error1 == KErrNone && error2 == KErrNone && error3 == KErrNone)
+        {
+        SetTestStepResult(EPass);
+        }
 
-	test.End();
-	test.Close();
-
-	__UHEAP_MARKEND;
-	return error;
-	}
+    return TestStepResult();
+    }