charconvfw/fatfilenameconversionplugins/test/T_CP950.CPP
changeset 51 a7c938434754
parent 0 1fb32624e06b
child 55 336bee5c2d35
--- a/charconvfw/fatfilenameconversionplugins/test/T_CP950.CPP	Tue Jul 06 16:23:19 2010 +0300
+++ b/charconvfw/fatfilenameconversionplugins/test/T_CP950.CPP	Wed Aug 18 11:34:25 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_CP950.h"
 #include <e32des8.h>
 
-LOCAL_D RTest test(_L("T_CP950.exe"));
+#define test(cond)                                          \
+    {                                                       \
+    TBool __bb = (cond);                                    \
+    TEST(__bb);                                             \
+    if (!__bb)                                              \
+        {                                                   \
+        ERR_PRINTF1(_L("ERROR: Test Failed"));              \
+        User::Leave(1);                                     \
+        }                                                   \
+    }
+
 
 _LIT16(Uni_1, "\x0053\x3125\x3122\xAAAA\x9673\x2593\xFA0C\x3000");
 _LIT8(CP950_1, "\x53\xA3\xB6\xA3\xB3\x5F\xB3\xAF\xF9\xFE\xC9\x4A\xA1\x40");
@@ -41,9 +51,9 @@
 @SYMTestActions  	    Tests for conversions from/to Unicode, using a function pointer
 @SYMTestExpectedResults Test must not fail
 */
-void Test()
+void CT_CP950::TestL()
 	{
-	test.Next(_L("@SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1776"));
+    INFO_PRINTF1(_L("@SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1776"));
 	RLibrary lib;
 
 	const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
@@ -97,7 +107,7 @@
 	}
 
 // test code for INC080460: FATCharsetConv panics - stops china build booting
-void TestINC080460()
+void CT_CP950::TestINC080460L()
 	{
 	RLibrary lib;
 	const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
@@ -192,9 +202,9 @@
 @SYMTestActions  	    Tests for correct character conversion on certain chinese characters for CP936
 @SYMTestExpectedResults Test must not fail
 */
-void TestINC090073()
+void CT_CP950::TestINC090073L()
 	{
-	test.Next(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0003 "));
+    INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0003 "));
  	_LIT16(unicode, "\x7C91\x8026\x8160\x7633\x6DFC\x715C\x6600\x9785\x86D8\x7A37\x61A9\x80B1\x86A3\x89E5\x80F2\x9B48\x6C19\x7B71\x946B\x6B46\x6615");
 	_LIT8(CP950Code, "\xD3\x4A\xBD\xA2\xDF\x73\xEA\x6F\xD9\xE7\xB7\xD4\xA9\xFB\xBB\xDF\xDB\xB1\xBD\x5E\xBE\xCD\xAA\xD0\xB0\x47\xDF\xFD\xD3\x6A\xEF\x69\xCB\x49\xDF\x4E\xF8\xCA\xDD\xF5\xA9\xFD");
 
@@ -225,9 +235,9 @@
 	lib.Close();
 	}
 
-void OOMTest()
+void CT_CP950::OOMTestL()
 	{
-	test.Next(_L("OOM testing"));
+    INFO_PRINTF1(_L("OOM testing"));
 	TInt err, tryCount = 0;
 	do
 		{
@@ -240,7 +250,7 @@
 			// Setting Heap failure for OOM test
 		__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
 
-		TRAP(err,Test());
+		TRAP(err,TestL());
 
 		__UHEAP_SETFAIL(RHeap::ENone, 0);
 
@@ -256,32 +266,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()
-	{
-	Test();
-	TestINC090073();
-	TestINC080460();
-	OOMTest();
-	}
+CT_CP950::CT_CP950()
+    {
+    SetTestStepName(KTestStep_T_CP950);
+    }
+
 
-GLDEF_C TInt E32Main()
-	{
-	__UHEAP_MARK;
+TVerdict CT_CP950::doTestStepL()
+    {
+    SetTestStepResult(EFail);
+
+    __UHEAP_MARK;
 
-	test.Title();
-	test.Start(_L("CP950 test..."));
+    TRAPD(error1, TestL());
+    TRAPD(error2, TestINC090073L());
+    TRAPD(error3, TestINC080460L());
+    TRAPD(error4, OOMTestL());
 
-	CTrapCleanup* trapCleanup=CTrapCleanup::New();
-	TRAPD(error, DoE32MainL());
-	delete trapCleanup;
+    __UHEAP_MARKEND;
 
-	test.End();
-	test.Close();
+    if(error1 == KErrNone && error2 == KErrNone && error3 == KErrNone && error4 == KErrNone)
+        {
+        SetTestStepResult(EPass);
+        }
 
-	__UHEAP_MARKEND;
-	return error;
-	}
+    return TestStepResult();
+    }