sl@0: /* sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef WIDECHARCLASSAPIBCTEST_H sl@0: #define WIDECHARCLASSAPIBCTEST_H sl@0: sl@0: // INCLUDES sl@0: #include "StifTestModule.h" sl@0: #include sl@0: #include sl@0: sl@0: // CONSTANTS sl@0: //const ?type ?constant_var = ?constant; sl@0: sl@0: // MACROS sl@0: //#define ?macro ?macro_def sl@0: #define TEST_MODULE_VERSION_MAJOR 50 sl@0: #define TEST_MODULE_VERSION_MINOR 9 sl@0: #define TEST_MODULE_VERSION_BUILD 06 sl@0: sl@0: // Logging path sl@0: _LIT( KwidecharclassapiBCTestLogPath, "\\logs\\testframework\\widecharclassapiBCTest\\" ); sl@0: // Log file sl@0: _LIT( KwidecharclassapiBCTestLogFile, "widecharclassapiBCTest.txt" ); sl@0: _LIT( KwidecharclassapiBCTestLogFileWithTitle, "widecharclassapiBCTest_[%S].txt" ); sl@0: sl@0: #define GETPTR & sl@0: #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0} sl@0: #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0} sl@0: #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c} sl@0: #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c} sl@0: sl@0: // FUNCTION PROTOTYPES sl@0: //?type ?function_name(?arg_list); sl@0: sl@0: // FORWARD DECLARATIONS sl@0: //class ?FORWARD_CLASSNAME; sl@0: class CwidecharclassapiBCTest; sl@0: sl@0: // DATA TYPES sl@0: //enum ?declaration sl@0: //typedef ?declaration sl@0: //extern ?data_type; sl@0: // A typedef for function that does the actual testing, sl@0: // function is a type sl@0: // TInt CwidecharclassapiBCTest:: ( TTestResult& aResult ) sl@0: typedef TInt (CwidecharclassapiBCTest::* TestFunction)(TTestResult&); sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: /** sl@0: * An internal structure containing a test case name and sl@0: * the pointer to function doing the test sl@0: * sl@0: * @lib ?library sl@0: * @since ?Series60_version sl@0: */ sl@0: class TCaseInfoInternal sl@0: { sl@0: public: sl@0: const TText* iCaseName; sl@0: TestFunction iMethod; sl@0: TBool iIsOOMTest; sl@0: TInt iFirstMemoryAllocation; sl@0: TInt iLastMemoryAllocation; sl@0: }; sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: /** sl@0: * A structure containing a test case name and sl@0: * the pointer to function doing the test sl@0: * sl@0: * @lib ?library sl@0: * @since ?Series60_version sl@0: */ sl@0: class TCaseInfo sl@0: { sl@0: public: sl@0: TPtrC iCaseName; sl@0: TestFunction iMethod; sl@0: TBool iIsOOMTest; sl@0: TInt iFirstMemoryAllocation; sl@0: TInt iLastMemoryAllocation; sl@0: sl@0: TCaseInfo( const TText* a ) : iCaseName( (TText*) a ) sl@0: { sl@0: }; sl@0: sl@0: }; sl@0: sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: /** sl@0: * This a widecharclassapiBCTest class. sl@0: * ?other_description_lines sl@0: * sl@0: * @lib ?library sl@0: * @since ?Series60_version sl@0: */ sl@0: NONSHARABLE_CLASS(CwidecharclassapiBCTest) : public CTestModuleBase sl@0: { sl@0: public: // Constructors and destructor sl@0: sl@0: sl@0: /** sl@0: * Two-phased constructor. sl@0: */ sl@0: static CwidecharclassapiBCTest* NewL(); sl@0: sl@0: /** sl@0: * Destructor. sl@0: */ sl@0: virtual ~CwidecharclassapiBCTest(); sl@0: sl@0: public: // New functions sl@0: sl@0: /** sl@0: * ?member_description. sl@0: * @since ?Series60_version sl@0: * @param ?arg1 ?description sl@0: * @return ?description sl@0: */ sl@0: //?type ?member_function( ?type ?arg1 ); sl@0: sl@0: public: // Functions from base classes sl@0: sl@0: /** sl@0: * From CTestModuleBase InitL is used to initialize the sl@0: * widecharclassapiBCTest. It is called once for every instance of sl@0: * TestModulewidecharclassapiBCTest after its creation. sl@0: * @since ?Series60_version sl@0: * @param aIniFile Initialization file for the test module (optional) sl@0: * @param aFirstTime Flag is true when InitL is executed for first sl@0: * created instance of widecharclassapiBCTest. sl@0: * @return Symbian OS error code sl@0: */ sl@0: TInt InitL( TFileName& aIniFile, TBool aFirstTime ); sl@0: sl@0: /** sl@0: * From CTestModuleBase GetTestCasesL is used to inquiry test cases sl@0: * from widecharclassapiBCTest. sl@0: * @since ?Series60_version sl@0: * @param aTestCaseFile Test case file (optional) sl@0: * @param aTestCases Array of TestCases returned to test framework sl@0: * @return Symbian OS error code sl@0: */ sl@0: TInt GetTestCasesL( const TFileName& aTestCaseFile, sl@0: RPointerArray& aTestCases ); sl@0: sl@0: /** sl@0: * From CTestModuleBase RunTestCaseL is used to run an individual sl@0: * test case. sl@0: * @since ?Series60_version sl@0: * @param aCaseNumber Test case number sl@0: * @param aTestCaseFile Test case file (optional) sl@0: * @param aResult Test case result returned to test framework (PASS/FAIL) sl@0: * @return Symbian OS error code (test case execution error, which is sl@0: * not reported in aResult parameter as test case failure). sl@0: */ sl@0: TInt RunTestCaseL( const TInt aCaseNumber, sl@0: const TFileName& aTestCaseFile, sl@0: TTestResult& aResult ); sl@0: sl@0: /** sl@0: * From CTestModuleBase; OOMTestQueryL is used to specify is particular sl@0: * test case going to be executed using OOM conditions sl@0: * @param aTestCaseFile Test case file (optional) sl@0: * @param aCaseNumber Test case number (optional) sl@0: * @param aFailureType OOM failure type (optional) sl@0: * @param aFirstMemFailure The first heap memory allocation failure value (optional) sl@0: * @param aLastMemFailure The last heap memory allocation failure value (optional) sl@0: * @return TBool sl@0: */ sl@0: virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, sl@0: const TInt /* aCaseNumber */, sl@0: TOOMFailureType& aFailureType, sl@0: TInt& /* aFirstMemFailure */, sl@0: TInt& /* aLastMemFailure */ ); sl@0: sl@0: /** sl@0: * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM sl@0: * test environment sl@0: * @param aTestCaseFile Test case file (optional) sl@0: * @param aCaseNumber Test case number (optional) sl@0: * @return None sl@0: */ sl@0: virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, sl@0: const TInt /* aCaseNumber */ ); sl@0: sl@0: /** sl@0: * From CTestModuleBase; OOMHandleWarningL sl@0: * @param aTestCaseFile Test case file (optional) sl@0: * @param aCaseNumber Test case number (optional) sl@0: * @param aFailNextValue FailNextValue for OOM test execution (optional) sl@0: * @return None sl@0: * sl@0: * User may add implementation for OOM test warning handling. Usually no sl@0: * implementation is required. sl@0: */ sl@0: virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */, sl@0: const TInt /* aCaseNumber */, sl@0: TInt& /* aFailNextValue */); sl@0: sl@0: /** sl@0: * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM sl@0: * test environment sl@0: * @param aTestCaseFile Test case file (optional) sl@0: * @param aCaseNumber Test case number (optional) sl@0: * @return None sl@0: * sl@0: */ sl@0: virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, sl@0: const TInt /* aCaseNumber */ ); sl@0: sl@0: /** sl@0: * Method used to log version of test module sl@0: */ sl@0: void SendTestModuleVersion(); sl@0: sl@0: protected: // New functions sl@0: sl@0: /** sl@0: * ?member_description. sl@0: * @since ?Series60_version sl@0: * @param ?arg1 ?description sl@0: * @return ?description sl@0: */ sl@0: //?type ?member_function( ?type ?arg1 ); sl@0: sl@0: protected: // Functions from base classes sl@0: sl@0: /** sl@0: * From ?base_class ?member_description sl@0: */ sl@0: //?type ?member_function(); sl@0: sl@0: private: sl@0: sl@0: /** sl@0: * C++ default constructor. sl@0: */ sl@0: CwidecharclassapiBCTest(); sl@0: sl@0: /** sl@0: * By default Symbian 2nd phase constructor is private. sl@0: */ sl@0: void ConstructL(); sl@0: sl@0: // Prohibit copy constructor if not deriving from CBase. sl@0: // ?classname( const ?classname& ); sl@0: // Prohibit assigment operator if not deriving from CBase. sl@0: // ?classname& operator=( const ?classname& ); sl@0: sl@0: /** sl@0: * Function returning test case name and pointer to test case function. sl@0: * @since ?Series60_version sl@0: * @param aCaseNumber test case number sl@0: * @return TCaseInfo sl@0: */ sl@0: const TCaseInfo Case ( const TInt aCaseNumber ) const; sl@0: sl@0: /** sl@0: * [test case declarations] - do not remove sl@0: */ sl@0: //ADD NEW METHOD DEC HERE" sl@0: sl@0: /** sl@0: * Printing test case. sl@0: * @since ?Series60_version sl@0: * @param aResult Test case result (PASS/FAIL) sl@0: * @return Symbian OS error code (test case execution error sl@0: * that is not returned as test case result in aResult) sl@0: */ sl@0: TInt PrintTest( TTestResult& aResult ); sl@0: sl@0: /** sl@0: * Printing loop test case. sl@0: * @since ?Series60_version sl@0: * @param aResult Test case result (PASS/FAIL) sl@0: * @return Symbian OS error code (test case execution error sl@0: * that is not returned as test case result in aResult) sl@0: */ sl@0: TInt LoopTest( TTestResult& aResult ); sl@0: sl@0: TInt ArithmeticTest( TTestResult& aResult ); sl@0: TInt FileManipulationTest( TTestResult& aResult ); sl@0: TInt ConsoleOperationsTest( TTestResult& aResult ); sl@0: TInt StringOperationsTest( TTestResult& aResult ); sl@0: TInt ConversionOperationsTest( TTestResult& aResult ); sl@0: sl@0: public: // Data sl@0: // ?one_line_short_description_of_data sl@0: //?data_declaration; sl@0: sl@0: protected: // Data sl@0: // ?one_line_short_description_of_data sl@0: //?data_declaration; sl@0: sl@0: private: // Data sl@0: // Pointer to test (function) to be executed sl@0: TestFunction iMethod; sl@0: sl@0: // Pointer to logger sl@0: CStifLogger * iLog; sl@0: sl@0: // Normal logger sl@0: CStifLogger* iStdLog; sl@0: sl@0: // Test case logger sl@0: CStifLogger* iTCLog; sl@0: sl@0: // Flag saying if test case title should be added to log file name sl@0: TBool iAddTestCaseTitleToLogName; sl@0: sl@0: // Flag saying if version of test module was already sent sl@0: TBool iVersionLogged; sl@0: sl@0: // ?one_line_short_description_of_data sl@0: //?data_declaration; sl@0: sl@0: // Reserved pointer for future extension sl@0: //TAny* iReserved; sl@0: sl@0: public: // Friend classes sl@0: //?friend_class_declaration; sl@0: protected: // Friend classes sl@0: //?friend_class_declaration; sl@0: private: // Friend classes sl@0: //?friend_class_declaration; sl@0: sl@0: }; sl@0: sl@0: #endif // WIDECHARCLASSAPIBCTEST_H sl@0: sl@0: // End of File