os/ossrv/stdcpp/tsrc/BC/apps/widecharclassapiBCTest/inc/widecharclassapiBCTest.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/stdcpp/tsrc/BC/apps/widecharclassapiBCTest/inc/widecharclassapiBCTest.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,352 @@
     1.4 +/*
     1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:       
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef WIDECHARCLASSAPIBCTEST_H
    1.23 +#define WIDECHARCLASSAPIBCTEST_H
    1.24 +
    1.25 +// INCLUDES
    1.26 +#include "StifTestModule.h"
    1.27 +#include <StifLogger.h>
    1.28 +#include <stl\_cwchar.h>
    1.29 +
    1.30 +// CONSTANTS
    1.31 +//const ?type ?constant_var = ?constant;
    1.32 +
    1.33 +// MACROS
    1.34 +//#define ?macro ?macro_def
    1.35 +#define TEST_MODULE_VERSION_MAJOR 50
    1.36 +#define TEST_MODULE_VERSION_MINOR 9
    1.37 +#define TEST_MODULE_VERSION_BUILD 06
    1.38 +
    1.39 +// Logging path
    1.40 +_LIT( KwidecharclassapiBCTestLogPath, "\\logs\\testframework\\widecharclassapiBCTest\\" ); 
    1.41 +// Log file
    1.42 +_LIT( KwidecharclassapiBCTestLogFile, "widecharclassapiBCTest.txt" ); 
    1.43 +_LIT( KwidecharclassapiBCTestLogFileWithTitle, "widecharclassapiBCTest_[%S].txt" );
    1.44 +
    1.45 +#define GETPTR &
    1.46 +#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
    1.47 +#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
    1.48 +#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
    1.49 +#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
    1.50 +
    1.51 +// FUNCTION PROTOTYPES
    1.52 +//?type ?function_name(?arg_list);
    1.53 +
    1.54 +// FORWARD DECLARATIONS
    1.55 +//class ?FORWARD_CLASSNAME;
    1.56 +class CwidecharclassapiBCTest;
    1.57 +
    1.58 +// DATA TYPES
    1.59 +//enum ?declaration
    1.60 +//typedef ?declaration
    1.61 +//extern ?data_type;
    1.62 +// A typedef for function that does the actual testing,
    1.63 +// function is a type 
    1.64 +// TInt CwidecharclassapiBCTest::<NameOfFunction> ( TTestResult& aResult )
    1.65 +typedef TInt (CwidecharclassapiBCTest::* TestFunction)(TTestResult&);
    1.66 +
    1.67 +// CLASS DECLARATION
    1.68 +
    1.69 +/**
    1.70 +*  An internal structure containing a test case name and
    1.71 +*  the pointer to function doing the test
    1.72 +*
    1.73 +*  @lib ?library
    1.74 +*  @since ?Series60_version
    1.75 +*/
    1.76 +class TCaseInfoInternal
    1.77 +    {
    1.78 +    public:
    1.79 +        const TText*    iCaseName;
    1.80 +        TestFunction    iMethod;
    1.81 +        TBool           iIsOOMTest;
    1.82 +        TInt            iFirstMemoryAllocation;
    1.83 +        TInt            iLastMemoryAllocation;
    1.84 +    };
    1.85 +
    1.86 +// CLASS DECLARATION
    1.87 +
    1.88 +/**
    1.89 +*  A structure containing a test case name and
    1.90 +*  the pointer to function doing the test
    1.91 +*
    1.92 +*  @lib ?library
    1.93 +*  @since ?Series60_version
    1.94 +*/
    1.95 +class TCaseInfo
    1.96 +    {
    1.97 +    public:
    1.98 +        TPtrC iCaseName;
    1.99 +        TestFunction iMethod;
   1.100 +        TBool           iIsOOMTest;
   1.101 +        TInt            iFirstMemoryAllocation;
   1.102 +        TInt            iLastMemoryAllocation;
   1.103 +
   1.104 +    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
   1.105 +        {
   1.106 +        };
   1.107 +
   1.108 +    };
   1.109 +
   1.110 +
   1.111 +// CLASS DECLARATION
   1.112 +
   1.113 +/**
   1.114 +*  This a widecharclassapiBCTest class.
   1.115 +*  ?other_description_lines
   1.116 +*
   1.117 +*  @lib ?library
   1.118 +*  @since ?Series60_version
   1.119 +*/
   1.120 +NONSHARABLE_CLASS(CwidecharclassapiBCTest) : public CTestModuleBase
   1.121 +    {
   1.122 +    public:  // Constructors and destructor
   1.123 +
   1.124 +
   1.125 +        /**
   1.126 +        * Two-phased constructor.
   1.127 +        */
   1.128 +        static CwidecharclassapiBCTest* NewL();
   1.129 +
   1.130 +        /**
   1.131 +        * Destructor.
   1.132 +        */
   1.133 +        virtual ~CwidecharclassapiBCTest();
   1.134 +
   1.135 +    public: // New functions
   1.136 +
   1.137 +        /**
   1.138 +        * ?member_description.
   1.139 +        * @since ?Series60_version
   1.140 +        * @param ?arg1 ?description
   1.141 +        * @return ?description
   1.142 +        */
   1.143 +        //?type ?member_function( ?type ?arg1 );
   1.144 +
   1.145 +    public: // Functions from base classes
   1.146 +
   1.147 +        /**
   1.148 +        * From CTestModuleBase InitL is used to initialize the 
   1.149 +        *       widecharclassapiBCTest. It is called once for every instance of 
   1.150 +        *       TestModulewidecharclassapiBCTest after its creation.
   1.151 +        * @since ?Series60_version
   1.152 +        * @param aIniFile Initialization file for the test module (optional)
   1.153 +        * @param aFirstTime Flag is true when InitL is executed for first 
   1.154 +        *               created instance of widecharclassapiBCTest.
   1.155 +        * @return Symbian OS error code
   1.156 +        */
   1.157 +        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
   1.158 +
   1.159 +        /**
   1.160 +        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
   1.161 +        *   from widecharclassapiBCTest. 
   1.162 +        * @since ?Series60_version
   1.163 +        * @param aTestCaseFile Test case file (optional)
   1.164 +        * @param aTestCases  Array of TestCases returned to test framework
   1.165 +        * @return Symbian OS error code
   1.166 +        */
   1.167 +        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
   1.168 +                            RPointerArray<TTestCaseInfo>& aTestCases );
   1.169 +
   1.170 +        /**
   1.171 +        * From CTestModuleBase RunTestCaseL is used to run an individual 
   1.172 +        *   test case. 
   1.173 +        * @since ?Series60_version
   1.174 +        * @param aCaseNumber Test case number
   1.175 +        * @param aTestCaseFile Test case file (optional)
   1.176 +        * @param aResult Test case result returned to test framework (PASS/FAIL)
   1.177 +        * @return Symbian OS error code (test case execution error, which is 
   1.178 +        *           not reported in aResult parameter as test case failure).
   1.179 +        */   
   1.180 +        TInt RunTestCaseL( const TInt aCaseNumber, 
   1.181 +                           const TFileName& aTestCaseFile,
   1.182 +                           TTestResult& aResult );
   1.183 +
   1.184 +        /**
   1.185 +        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
   1.186 +        * test case going to be executed using OOM conditions
   1.187 +        * @param aTestCaseFile Test case file (optional)
   1.188 +        * @param aCaseNumber Test case number (optional)
   1.189 +        * @param aFailureType OOM failure type (optional)
   1.190 +        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
   1.191 +        * @param aLastMemFailure The last heap memory allocation failure value (optional)
   1.192 +        * @return TBool
   1.193 +        */
   1.194 +        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
   1.195 +                                     const TInt /* aCaseNumber */, 
   1.196 +                                     TOOMFailureType& aFailureType, 
   1.197 +                                     TInt& /* aFirstMemFailure */, 
   1.198 +                                     TInt& /* aLastMemFailure */ );
   1.199 +
   1.200 +        /**
   1.201 +        * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
   1.202 +        * test environment
   1.203 +        * @param aTestCaseFile Test case file (optional)
   1.204 +        * @param aCaseNumber Test case number (optional)
   1.205 +        * @return None
   1.206 +        */
   1.207 +        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
   1.208 +                                    const TInt /* aCaseNumber */ ); 
   1.209 +
   1.210 +        /**
   1.211 +        * From CTestModuleBase; OOMHandleWarningL
   1.212 +        * @param aTestCaseFile Test case file (optional)
   1.213 +        * @param aCaseNumber Test case number (optional)
   1.214 +        * @param aFailNextValue FailNextValue for OOM test execution (optional)
   1.215 +        * @return None
   1.216 +        *
   1.217 +        * User may add implementation for OOM test warning handling. Usually no
   1.218 +        * implementation is required.           
   1.219 +        */
   1.220 +        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
   1.221 +                                        const TInt /* aCaseNumber */, 
   1.222 +                                        TInt& /* aFailNextValue */); 
   1.223 +
   1.224 +        /**
   1.225 +        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
   1.226 +        * test environment
   1.227 +        * @param aTestCaseFile Test case file (optional)
   1.228 +        * @param aCaseNumber Test case number (optional)
   1.229 +        * @return None
   1.230 +        *
   1.231 +        */
   1.232 +        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
   1.233 +                                       const TInt /* aCaseNumber */ );
   1.234 +        
   1.235 +        /**
   1.236 +         * Method used to log version of test module
   1.237 +         */
   1.238 +        void SendTestModuleVersion();
   1.239 +
   1.240 +    protected:  // New functions
   1.241 +
   1.242 +        /**
   1.243 +        * ?member_description.
   1.244 +        * @since ?Series60_version
   1.245 +        * @param ?arg1 ?description
   1.246 +        * @return ?description
   1.247 +        */
   1.248 +        //?type ?member_function( ?type ?arg1 );
   1.249 +
   1.250 +    protected:  // Functions from base classes
   1.251 +
   1.252 +        /**
   1.253 +        * From ?base_class ?member_description
   1.254 +        */
   1.255 +        //?type ?member_function();
   1.256 +
   1.257 +    private:
   1.258 +
   1.259 +        /**
   1.260 +        * C++ default constructor.
   1.261 +        */
   1.262 +        CwidecharclassapiBCTest();
   1.263 +
   1.264 +        /**
   1.265 +        * By default Symbian 2nd phase constructor is private.
   1.266 +        */
   1.267 +        void ConstructL();
   1.268 +
   1.269 +        // Prohibit copy constructor if not deriving from CBase.
   1.270 +        // ?classname( const ?classname& );
   1.271 +        // Prohibit assigment operator if not deriving from CBase.
   1.272 +        // ?classname& operator=( const ?classname& );
   1.273 +
   1.274 +        /**
   1.275 +        * Function returning test case name and pointer to test case function.
   1.276 +        * @since ?Series60_version
   1.277 +        * @param aCaseNumber test case number
   1.278 +        * @return TCaseInfo 
   1.279 +        */
   1.280 +        const TCaseInfo Case ( const TInt aCaseNumber ) const;
   1.281 +
   1.282 +        /**
   1.283 +        * [test case declarations] - do not remove
   1.284 +        */
   1.285 +        //ADD NEW METHOD DEC HERE"
   1.286 +
   1.287 +        /**
   1.288 +        * Printing test case.
   1.289 +        * @since ?Series60_version
   1.290 +        * @param aResult Test case result (PASS/FAIL)
   1.291 +        * @return Symbian OS error code (test case execution error 
   1.292 +        *   that is not returned as test case result in aResult)
   1.293 +        */
   1.294 +        TInt PrintTest( TTestResult& aResult );
   1.295 +
   1.296 +        /**
   1.297 +        * Printing loop test case.
   1.298 +        * @since ?Series60_version
   1.299 +        * @param aResult Test case result (PASS/FAIL)
   1.300 +        * @return Symbian OS error code (test case execution error 
   1.301 +        *   that is not returned as test case result in aResult)
   1.302 +        */
   1.303 +        TInt LoopTest( TTestResult& aResult );
   1.304 +        
   1.305 +        TInt ArithmeticTest( TTestResult& aResult );
   1.306 +        TInt FileManipulationTest( TTestResult& aResult );
   1.307 +        TInt ConsoleOperationsTest( TTestResult& aResult );
   1.308 +        TInt StringOperationsTest( TTestResult& aResult );
   1.309 +        TInt ConversionOperationsTest( TTestResult& aResult );
   1.310 +		
   1.311 +    public:     // Data
   1.312 +        // ?one_line_short_description_of_data
   1.313 +        //?data_declaration;
   1.314 +
   1.315 +    protected:  // Data
   1.316 +        // ?one_line_short_description_of_data
   1.317 +        //?data_declaration;
   1.318 +
   1.319 +    private:    // Data
   1.320 +        // Pointer to test (function) to be executed
   1.321 +        TestFunction iMethod;
   1.322 +
   1.323 +        // Pointer to logger
   1.324 +        CStifLogger * iLog; 
   1.325 +
   1.326 +        // Normal logger
   1.327 +        CStifLogger* iStdLog;
   1.328 +
   1.329 +        // Test case logger
   1.330 +        CStifLogger* iTCLog;
   1.331 +
   1.332 +        // Flag saying if test case title should be added to log file name
   1.333 +        TBool iAddTestCaseTitleToLogName;
   1.334 +
   1.335 +        // Flag saying if version of test module was already sent
   1.336 +        TBool iVersionLogged;
   1.337 +
   1.338 +        // ?one_line_short_description_of_data
   1.339 +        //?data_declaration;
   1.340 +
   1.341 +        // Reserved pointer for future extension
   1.342 +        //TAny* iReserved;
   1.343 +
   1.344 +    public:     // Friend classes
   1.345 +        //?friend_class_declaration;
   1.346 +    protected:  // Friend classes
   1.347 +        //?friend_class_declaration;
   1.348 +    private:    // Friend classes
   1.349 +        //?friend_class_declaration;
   1.350 +
   1.351 +    };
   1.352 +
   1.353 +#endif      // WIDECHARCLASSAPIBCTEST_H
   1.354 +
   1.355 +// End of File