lowlevellibsandfws/apputils/tsrc/t_strings/T_StringPoolTest.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Demonstrates a simple set of derived class implementations to
       
    15 // test the RStringPool class using the test bed.
       
    16 // It may be used as a basis to develop a full test bed dll.
       
    17 // For support and comment please contact the authors.
       
    18 // 
       
    19 //
       
    20 
       
    21 #ifdef __WINS__
       
    22 #pragma warning(disable : 4097)			// disable typedef warning
       
    23 #endif
       
    24 
       
    25 #include "StringPoolUnitTest.h"
       
    26 #include <ecom/test_bed/componenttester.h>
       
    27 
       
    28 // ______________________________________________________________________________
       
    29 //
       
    30 /**
       
    31 	@internalComponent
       
    32 	Comments : Test the RStringPool class.
       
    33  */
       
    34 class CStringPool_ComponentTest : public CComponentTester
       
    35 	{
       
    36 public:
       
    37 	/**
       
    38 		@fn				NewLC(CDataLogger& aDataLogger,
       
    39 							 MComponentTestObserver& aObserver)
       
    40 		Intended Usage	: Standard two-phase construction which leaves nothing on the
       
    41 						cleanup stack.
       
    42 		Error Condition	: Leaves with the error code.
       
    43 		@leave		KErrNoMemory
       
    44 		@since			6.0
       
    45 		@param			aDataLogger The output logging object.
       
    46 		@param			aObserver The observer of this component test.
       
    47 		@return			CStringPool_ComponentTest* The constructed object.
       
    48 		@pre 			None.
       
    49 		@post			CStringPool_ComponentTest is fully constructed.
       
    50 	*/
       
    51 	static CStringPool_ComponentTest* NewLC(CDataLogger& aDataLogger, 
       
    52 							MComponentTestObserver& aObserver);
       
    53 
       
    54 private:
       
    55 	/**
       
    56 		@fn				CStringPool_ComponentTest(CDataLogger& aDataLogger,
       
    57 											MComponentTestObserver& aObserver)
       
    58 		Intended Usage	: Standard c'tor method.
       
    59 		Error Condition	: None.
       
    60 		@since			6.0
       
    61 		@param			aDataLogger The logging object.
       
    62 		@param			aObserver The observer of this component test.
       
    63 		@pre 			None.
       
    64 		@post			CStringPool_ComponentTest is fully constructed.
       
    65 	*/
       
    66 	inline CStringPool_ComponentTest(CDataLogger& aDataLogger,
       
    67 												MComponentTestObserver& aObserver);
       
    68 	/**
       
    69 		@fn				void ConstructL()
       
    70 		Intended Usage	: Second phase of safe two phase construction, 
       
    71 						to complete the object initialisation.
       
    72 		Error Condition	: Leaves with an error code.
       
    73 		@leave		KErrNoMemory.
       
    74 		@since			6.0
       
    75 		@return			None 
       
    76 		@pre 			CStringPool_ComponentTest is fully constructed.
       
    77 		@post			CStringPool_ComponentTest is fully initialised.
       
    78 	*/
       
    79 	inline void ConstructL();
       
    80 
       
    81 	};	// CStringPool_ComponentTest
       
    82 
       
    83 // ______________________________________________________________________________
       
    84 //
       
    85 inline CStringPool_ComponentTest* CStringPool_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
       
    86 	{
       
    87 	CStringPool_ComponentTest* self = new (ELeave) CStringPool_ComponentTest(aDataLogger, aObserver);
       
    88 	CleanupStack::PushL(self);
       
    89 	self->ConstructL();
       
    90 	return self;
       
    91 	}
       
    92 
       
    93 inline CStringPool_ComponentTest::CStringPool_ComponentTest(CDataLogger& aDataLogger,
       
    94 									MComponentTestObserver& aObserver)
       
    95 : CComponentTester(aDataLogger, aObserver)
       
    96 	{
       
    97 	// Do nothing here.
       
    98 	}
       
    99 
       
   100 /**
       
   101 @SYMTestCaseID          SYSLIB-BAFL-CT-0493
       
   102 @SYMTestCaseDesc        Tests the functionality of RStringPool class
       
   103 @SYMTestPriority        High
       
   104 @SYMTestActions         Attempt to load short,large,multiple and irrelevant tables
       
   105 @SYMTestExpectedResults Test must not fail 
       
   106 @SYMREQ                 REQ0000
       
   107 */
       
   108 inline void CStringPool_ComponentTest::ConstructL()
       
   109 	{
       
   110 	// Perform base class initialization
       
   111 	ComponentTesterConstructL();
       
   112 	// CI tests with no table loaded 
       
   113 	AddUnitTestL(CStringPool_CaseInsensitive_UnitTest::NewL(iDataLogger, *this));
       
   114 	// CS tests with a Short table loaded
       
   115 	AddUnitTestL(CStringPool_CaseSensitive_UnitTest::NewL(iDataLogger, *this));
       
   116 	// CI tests with a Short table loaded, and callback test
       
   117 	//.Also tested defects : BEU-55DJG3 , KRN-56NDEZ, APY-57TEH3, HAD57SK27OK
       
   118 	AddUnitTestL(CStringPool_ShortTable_UnitTest::NewL(iDataLogger, *this));
       
   119 	// CS tests with a Short table loaded 
       
   120 	AddUnitTestL(CStringPool_ShortTableCS_UnitTest::NewL(iDataLogger, *this));
       
   121 	// CI tests with a Irrelevant table loaded
       
   122 	AddUnitTestL(CStringPool_IrrelevantTable_UnitTest::NewL(iDataLogger, *this));
       
   123 	// CS tests with a Irrelevant table loaded
       
   124 	AddUnitTestL(CStringPool_IrrelevantTableCS_UnitTest::NewL(iDataLogger, *this));
       
   125 	// CI tests with a Large table loaded
       
   126 	AddUnitTestL(CStringPool_LongTable_UnitTest::NewL(iDataLogger, *this));
       
   127 	// CS tests with a Large table loaded
       
   128 	AddUnitTestL(CStringPool_LongTableCS_UnitTest::NewL(iDataLogger, *this));
       
   129 	// CI tests with a Multiple Tables
       
   130 	AddUnitTestL(CStringPool_MultipleTableShortCI_UnitTest::NewL(iDataLogger, *this));
       
   131 	// CS tests with a Multiple Tables
       
   132 	AddUnitTestL(CStringPool_MultipleTableShortCS_UnitTest::NewL(iDataLogger, *this));
       
   133 
       
   134 	}
       
   135 
       
   136 // ______________________________________________________________________________
       
   137 //
       
   138 EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
       
   139 									MComponentTestObserver&	aComponentTestObserver)
       
   140 	{
       
   141 	return CStringPool_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
       
   142 	}
       
   143 
       
   144 
       
   145 // ___________________________________________________________________________
       
   146 //
       
   147 // This section of the module simply includes the exported test harness template which 
       
   148 // makes this a "whole" CPP file with a E32Main entry point below. The test MMP 
       
   149 // project file can then produce a EXE for the test project instead of a DLL.
       
   150 
       
   151 #include "ecom/test_bed/testharnesstemplate.h"
       
   152 
       
   153 GLDEF_C TInt E32Main()
       
   154 	{
       
   155  	return E32Main_TestHarness(NewComponentTestLC);
       
   156 	}