cryptoservices/certificateandkeymgmt/tasn1/testbase.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Defines interface that all test objects comply with
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __TESTBASE_H__
       
    21 #define __TESTBASE_H__
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "t_testactionspec.h"
       
    25 #include "testparameter.h"
       
    26 #include "t_testaction.h"
       
    27 
       
    28 
       
    29 class CConsoleBase;
       
    30 class CASN1NormalTest;
       
    31 
       
    32 #define KErrASN1EncodingError 100
       
    33 
       
    34 class CTestBase : public CBase
       
    35 	{
       
    36 	public:
       
    37 		// What's the name of this test?
       
    38 		virtual void GetName(TDes& aBuf) = 0;
       
    39 		// What's it parameter format in script file
       
    40 
       
    41 		// Run the test, Leave if things go wrong (ie alloc failure).
       
    42 		// Leaving with KErrASN1EncodingError means a problem with the
       
    43 		// encoder or the decoder functionality.
       
    44 		virtual TBool PerformTestsL(CConsoleBase& aConsole) = 0;
       
    45 		CTestAction::TScriptError ConstructL(const TTestActionSpec& aTestActionSpec);
       
    46 		virtual ~CTestBase();
       
    47 
       
    48 	protected:
       
    49 		CTestBase(CASN1NormalTest &aASN1Action);
       
    50 		void OutputEncodingL(CConsoleBase& aConsole, TDesC8& aData);
       
    51 		CTestAction::TScriptError CheckValueParametersL(const TDesC& aParameters);
       
    52 		CTestAction::TScriptError CheckRandomParametersL(const TDesC& aParameters);
       
    53 		TBool CountTests(TInt &aTotalTests);
       
    54 		CASN1NormalTest &iASN1Action;
       
    55 
       
    56 		// virtual functions
       
    57 	protected:
       
    58 		virtual void FillParameterArray(void) = 0;
       
    59 		RArray<CTestParameter::TType> *iParameters;
       
    60 		RPointerArray<CTestParameter> *iValues;
       
    61 		
       
    62 	public:
       
    63 		TBuf<KMaxErrorSize> iSyntaxErrorDescription;
       
    64 	};
       
    65 
       
    66 #endif