charconvfw/fatfilenameconversionplugins/test/T_CP1250.CPP
changeset 51 a7c938434754
parent 0 1fb32624e06b
child 55 336bee5c2d35
--- a/charconvfw/fatfilenameconversionplugins/test/T_CP1250.CPP	Tue Jul 06 16:23:19 2010 +0300
+++ b/charconvfw/fatfilenameconversionplugins/test/T_CP1250.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_CP1250.h"
 #include <e32std.h>
 
-LOCAL_D RTest test(_L("T_CP1250.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\xAAAA\x20AC\x02C7\x2015");
 _LIT8(CP1250_1, "\x5F\x53\x59\x4D\x42\x49\x41\x4E\x5F\x80\xA1\x5F");
@@ -40,7 +50,7 @@
 @SYMTestActions  	    Tests for conversions from/to Unicode, using a function pointer
 @SYMTestExpectedResults Test must not fail
 */
-void Test()
+void CT_CP1250::TestL()
 	{
 	RLibrary lib;
 
@@ -98,9 +108,9 @@
 	lib.Close();
 	}
 
-void OOMTest()
+void CT_CP1250::OOMTestL()
 	{
-	test.Next(_L("OOM testing"));
+    INFO_PRINTF1(_L("OOM testing"));
 	TInt err, tryCount = 0;
 	do
 		{
@@ -113,7 +123,7 @@
 			// Setting Heap failure for OOM test
 		__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
 
-		TRAP(err,Test());
+		TRAP(err,TestL());
 
 		__UHEAP_SETFAIL(RHeap::ENone, 0);
 
@@ -129,31 +139,31 @@
 		}while (err == KErrNoMemory);
 
 	test(err == KErrNone);
-	test.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
-	}
-
-
-LOCAL_C void DoE32MainL()
-	{
-	Test();
-	OOMTest();
+	INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
 	}
 
 
-GLDEF_C TInt E32Main()
-	{
-	__UHEAP_MARK;
+CT_CP1250::CT_CP1250()
+    {
+    SetTestStepName(KTestStep_T_CP1250);
+    }
+
 
-	test.Title();
-	test.Start(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1789 CP1250 tests... "));
+TVerdict CT_CP1250::doTestStepL()
+    {
+    SetTestStepResult(EFail);
+
+    __UHEAP_MARK;
 
-	CTrapCleanup* trapCleanup=CTrapCleanup::New();
-	TRAPD(error, DoE32MainL());
-	delete trapCleanup;
+    TRAPD(error1, TestL());
+    TRAPD(error2, OOMTestL());
+
+    __UHEAP_MARKEND;
 
-	test.End();
-	test.Close();
+    if(error1 == KErrNone && error2 == KErrNone)
+        {
+        SetTestStepResult(EPass);
+        }
 
-	__UHEAP_MARKEND;
-	return error;
-	}
+    return TestStepResult();
+    }