void CT_EntryData::DoCmdIsTypeValid( const TDesC& aSection ) /** Checks if TEntry has a valid UID using IsTypeValid() function */ { INFO_PRINTF1( _L( "IsTypeValid()" ) ); TBool result = iEntry->IsTypeValid(); TBool expected; if( GET_MANDATORY_BOOL_PARAMETER( KExpected, aSection, expected ) ) { if ( !( CompareBool(result, expected) ) ) { ERR_PRINTF1( _L( "Error compare function result and expected value" )); SetBlockResult(EFail); } } }
void CT_EntryData::DoCmdIsUidPresent( const TDesC& aSection ) /** Checks if TEntry has a valid UID using IsTypeValid() function */ { TInt theIntUid; TBool expected; if( GET_MANDATORY_BOOL_PARAMETER( KExpected, aSection, expected ) && GET_MANDATORY_INT_PARAMETER( KValue, aSection, theIntUid ) ) { INFO_PRINTF2( _L( "IsUidPresent( Uid(%d) )" ), theIntUid ); TUid theUid; theUid.iUid = theIntUid; TBool result = iEntry->IsUidPresent( theUid ); if ( !( CompareBool(result, expected) ) ) { ERR_PRINTF1( _L( "Error compare function result and expected value" )); SetBlockResult(EFail); } } }
TST_tpRetCode TST_CTestSpecific :: PerformSpecificTest( char * Command ) { // Interpret TSTR Reset // AE: Reset if ( strcmp( Command , Reset_CMD ) == 0 ) { for ( int i = 0 ; i < TSTR_dimVtObj ; i++ ) { delete vtObj[ i ] ; vtObj[ i ] = NULL ; } /* for */ return TST_RetCodeOK ; } // end selection: Interpret TSTR Reset // Test: String head constructor // AE: NewString <inxObj> <int string length> <char * string value> else if ( strcmp( Command , STR_CStringHead_002_CMD ) == 0 ) { /***** Function STR_CStringHead( int sizStringParm , char * valStringParm ) *****/ int inxObj = -1 ; int sizString = -1 ; char valString[ dimBuffer ] ; int numRead = TST_pReader->ReadCommandLine( "is" , &inxObj , &sizString , valString ) ; if ( ( numRead != 2 ) || !VerifyInxElem( inxObj , NO )) { return TST_RetCodeParmError ; } /* if */ vtObj[ inxObj ] = new STR_CStringHead( sizString , valString ) ; return TST_RetCodeOK ; } // end selection: Test: String head constructor // Test: String head destructor // AE: DestroyString <inxObj> else if ( strcmp( Command , DeleteSTR_CStringHead_003_CMD ) == 0 ) { /***** Function ~STR_CStringHead( ) *****/ int inxObj = -1 ; int numRead = TST_pReader->ReadCommandLine( "i" , &inxObj ) ; if ( ( numRead != 1 ) || !VerifyInxElem( inxObj , ANY )) { return TST_RetCodeParmError ; } /* if */ delete vtObj[ inxObj ] ; vtObj[ inxObj ] = NULL ; return TST_RetCodeOK ; } // end selection: Test: String head destructor // Test: Get string size // AE: GetStringSize <inxObj> <int expSize> else if ( strcmp( Command , GetStringSize_004_CMD ) == 0 ) { /***** Function int GetStringSize( ) *****/ int inxObj = -1 ; int expValue = -1 ; int numRead = TST_pReader->ReadCommandLine( "ii" , &inxObj , &expValue ) ; if ( ( numRead != 2 ) || !VerifyInxElem( inxObj , YES )) { return TST_RetCodeParmError ; } /* if */ return Compare( vtObj[ inxObj ]->GetStringSize( ) , expValue , "Incorrect string size." ) ; } // end selection: Test: Get string size // Test: Get string char value // AE: GetStringVal <inxObj> <char StringValue> else if ( strcmp( Command , GetStringCharValue_005_CMD ) == 0 ) { /***** Function int GetStringCharValue( int sizBuffer , char * pBuffer ) *****/ int inxObj = -1 ; int sizString = -1 ; char valString[ dimBuffer ] ; int numRead = TST_pReader->ReadCommandLine( "is" , &inxObj , &sizString , valString ) ; if ( ( numRead != 2 ) || !VerifyInxElem( inxObj , YES )) { return TST_RetCodeParmError ; } /* if */ char Buffer[ dimBuffer ] ; int isSizString = vtObj[ inxObj ]->GetStringCharValue( dimBuffer , Buffer ) ; TST_tpRetCode RetCode = Compare( isSizString , sizString , "Incorrect string size." ) ; if ( RetCode != TST_RetCodeOK ) { return RetCode ; } /* if */ return Compare( Buffer , valString , sizString , "Incorrect string value." ) ; } // end selection: Test: Get string char value // Test: Verify string // AE: VerifyString <inxObj> <bool expected bool> else if ( strcmp( Command , VerifyString_006_CMD ) == 0 ) { /***** Function bool VerifyString( ) *****/ int inxObj = -1 ; bool expBool = false ; int numRead = TST_pReader->ReadCommandLine( "ib" , &inxObj , &expBool ) ; if ( ( numRead != 2 ) || !VerifyInxElem( inxObj , YES )) { return TST_RetCodeParmError ; } /* if */ return CompareBool( vtObj[ inxObj ]->VerifyString( ) , expBool , "Incorrect verification." ) ; } // end selection: Test: Verify string // Test: Corrupt object // AE: CorruptString <inxObj> <int id action> else if ( strcmp( Command , CorruptObject_007_CMD ) == 0 ) { /***** Function void CorruptObject( int What ) *****/ int inxObj = -1 ; STR_tpIdAction idAction ; int numRead = TST_pReader->ReadCommandLine( "ii" , &inxObj , &idAction ) ; if ( ( numRead != 2 ) || !VerifyInxElem( inxObj , YES )) { return TST_RetCodeParmError ; } /* if */ vtObj[ inxObj ]->CorruptObject( idAction ) ; return TST_RetCodeOK ; } // end selection: Test: Corrupt object return TST_RetCodeUnknown ; } // End of function: TSTR !P Perform specific test actions
TST_tpRetCode TST_TestSpecific :: PerformSpecificTest( char * Command ) { char CounterName[ TAL_dimBuffer ] ; int numRead = -1 ; int lenName = -1 ; // Handle: Construct counter singleton if ( strcmp( Command , ConstructObjectCmd ) == 0 ) { /***** void ConstructCounterObject( ) *****/ CNT_Counters :: ConstructCounterObject( ) ; return TST_RetCodeOK ; } // end selection: Handle: Construct counter singleton // Handle: Delete counter singleton else if ( strcmp( Command , DeleteCounterCmd ) == 0 ) { /***** void CNT_DeleteGlobalCounter( ) *****/ CNT_DeleteGlobalCounter( ) ; return TST_RetCodeOK ; } // end selection: Handle: Delete counter singleton // Handle: Verify structural assertions else if ( strcmp( Command , VerifyCounterStructureCmd ) == 0 ) { /***** bool VerifyCounterStructure( const TAL_tpVerifyMode ModeParm ) *****/ if ( CNT_GetCounterObject( ) != NULL ) { int expBool = -1 ; numRead = TST_pReader->ReadCommandLine( "i" , &expBool ) ; if ( numRead != 1 ) { return TST_RetCodeParmError ; } /* if */ return CompareBool( CNT_GetCounterObject( )-> VerifyCounterStructure( TAL_VerifyLog ) , expBool , "Invalid counter structure." ) ; } /* if */ return TST_RetCodeOK ; } // end selection: Handle: Verify structural assertions // Handle: count else if ( strcmp( Command , CountCmd ) == 0 ) { /***** void Count( char * CounterName ) *****/ if ( CNT_GetCounterObject( ) != NULL ) { numRead = TST_pReader->ReadCommandLine( "s" , &lenName , CounterName ) ; if ( numRead != 1 ) { return TST_RetCodeParmError ; } /* if */ CNT_GetCounterObject( )->Count( lenName , CounterName ) ; } /* if */ return TST_RetCodeOK ; } // end selection: Handle: count // Handle: Global count else if ( strcmp( Command , GlobalCountCmd ) == 0 ) { /***** void CNT_Count( char * CounterName ) *****/ numRead = TST_pReader->ReadCommandLine( "s" , &lenName , CounterName ) ; if ( numRead != 1 ) { return TST_RetCodeParmError ; } /* if */ CNT_Count( CounterName ) ; return TST_RetCodeOK ; } // end selection: Handle: Global count return TST_RetCodeUnknown ; } // End of function: TCNT !Perform counter test
TST_tpRetCode TST_TestSpecific :: PerformSpecificTest( char * Command ) { // Interpret TCFG Reset // AE: Reset if ( strcmp( Command , Reset_CMD ) == 0 ) { for ( int i = 0 ; i < TCFG_dimVtObj ; i++ ) { delete vtObj[ i ] ; vtObj[ i ] = NULL ; } /* for */ return TST_RetCodeOK ; } // end selection: Interpret TCFG Reset // Test: CFG !Construct a configuration list // AE: NewParamList <inxObj> else if ( strcmp( Command , CFG_CParameterList_002_CMD ) == 0 ) { /***** Function CFG_ConfigurationList( ) *****/ int inxObj = -1 ; int numRead = TST_pReader->ReadCommandLine( "i" , &inxObj ) ; if ( ( numRead != 1 ) || !VerifyInxElem( inxObj , NO )) { return TST_RetCodeParmError ; } /* if */ vtObj[ inxObj ] = new CFG_ConfigurationList( ) ; return TST_RetCodeOK ; } // end selection: Test: CFG !Construct a configuration list // Test: CFG !Destroy a parameter list // AE: DeleteParamList <inxObj> else if ( strcmp( Command , DeleteCFG_CParameterList_003_CMD ) == 0 ) { /***** Function ~CFG_ConfigurationList( ) *****/ int inxObj = -1 ; int numRead = TST_pReader->ReadCommandLine( "i" , &inxObj ) ; if ( ( numRead != 1 ) || !VerifyInxElem( inxObj , ANY )) { return TST_RetCodeParmError ; } /* if */ delete vtObj[ inxObj ] ; vtObj[ inxObj ] = NULL ; return TST_RetCodeOK ; } // end selection: Test: CFG !Destroy a parameter list // Test: CFG !Build from given file // AE: BuildList <inxObj> <s EnvName> <s FileName> <s ExtensionName> <b expReturn> // EnvName == "." ==> NULL reads the file identified // by the "TALISMAN" environment variable // FileName == "." ==> NULL reads the file identified // by the environment variable // ExtName == "." ==> NULL uses "config" as deafult extension // name else if ( strcmp( Command , BuildLineList_006_CMD ) == 0 ) { /***** Function bool BuildLineList( char * FileName , char * FileExtension ) *****/ int inxObj = -1 ; bool expRet = false ; int sizFileName = -1 ; char FileName[ TAL_dimBuffer ] ; int sizExtName = -1 ; char ExtName[ TAL_dimBuffer ] ; int numRead = TST_pReader->ReadCommandLine( "issb" , &inxObj , &sizFileName , FileName , &sizExtName , ExtName , &expRet ) ; if ( ( numRead != 4 ) || !VerifyInxElem( inxObj , YES )) { return TST_RetCodeParmError ; } /* if */ return CompareBool( vtObj[ inxObj ]->BuildLineList( ( strcmp( FileName , "." ) != 0 ? FileName : NULL ) , ( strcmp( ExtName , "." ) != 0 ? ExtName : NULL )) , expRet , "Incorrect configuration build return." ) ; } // end selection: Test: CFG !Build from given file // Test: CFG !Write configuration file // AE: WriteList <inxObj> <s FileNmae> <s ExtensionName> <b expReturn> // FileName == "." ==> NULL // ExtName == "." ==> NULL else if ( strcmp( Command , WriteConfigurationList_006_CMD ) == 0 ) { /***** Function bool WriteConfigurationList( char * FileName , char * ExtensionName = NULL ) *****/ int inxObj = -1 ; bool expRet = false ; int sizFileName = -1 ; char FileName[ TAL_dimBuffer ] ; int sizExtName = -1 ; char ExtName[ TAL_dimBuffer ] ; int numRead = TST_pReader->ReadCommandLine( "issb" , &inxObj , &sizFileName , FileName , &sizExtName , ExtName , &expRet ) ; if ( ( numRead != 4 ) || !VerifyInxElem( inxObj , YES )) { return TST_RetCodeParmError ; } /* if */ return CompareBool( vtObj[ inxObj ]->WriteConfigurationList( ( strcmp( FileName , "." ) != 0 ? FileName : NULL ) , ( strcmp( ExtName , "." ) != 0 ? ExtName : NULL )) , expRet , "Incorrect configuration write return." ) ; } // end selection: Test: CFG !Write configuration file // Test: CFG !Get a parameter value // AE: GetParameter <inxObj> <s SectionName> <s ParameterName> <s expValue> else if ( strcmp( Command , GetParameter_007_CMD ) == 0 ) { /***** Function STR_String * GetParameterValue( char * SectionName , char * AttributeName ) *****/ int inxObj = -1 ; int sizSecName = -1 ; char SecName[ TAL_dimBuffer ] ; int sizParmName = -1 ; char ParmName[ TAL_dimBuffer ] ; int sizexpValue = -1 ; char expValue[ TAL_dimBuffer ] ; int numRead = TST_pReader->ReadCommandLine( "isss" , &inxObj , &sizSecName , SecName , &sizParmName , ParmName , &sizexpValue , expValue ) ; if ( ( numRead != 4 ) || !VerifyInxElem( inxObj , YES )) { return TST_RetCodeParmError ; } /* if */ STR_String * pStr = vtObj[ inxObj ]->GetParameterValue( SecName , ParmName ) ; if ( pStr == NULL ) { if ( strcmp( expValue , "." ) == 0 ) { return TST_RetCodeOK ; } /* if */ DisplayErrorMsg( "Expected parameter has not been found." ) ; return TST_RetCodeFailure ; } /* if */ TST_tpRetCode retCode = Compare( pStr->GetString( ) , expValue , sizexpValue , "Incorrect parameter value." ) ; delete pStr ; return retCode ; } // end selection: Test: CFG !Get a parameter value // Test: CFG !Set a parameter value // AE: SetParameter <inxObj> <s SectionName> <s ParameterName> <s newValue> <b expRet> else if ( strcmp( Command , SetParameter_013_CMD ) == 0 ) { /***** Function bool SetParameterValue( char * SectionName , char * ParameterName , STR_String * ParameterValue ) *****/ int inxObj = -1 ; bool expRet = false ; int sizSecName = -1 ; char SecName[ TAL_dimBuffer ] ; int sizParmName = -1 ; char ParmName[ TAL_dimBuffer ] ; int sizValue = -1 ; char Value[ TAL_dimBuffer ] ; int numRead = TST_pReader->ReadCommandLine( "isssb" , &inxObj , &sizSecName , SecName , &sizParmName , ParmName , &sizValue , Value , &expRet ) ; if ( ( numRead != 5 ) || !VerifyInxElem( inxObj , YES )) { return TST_RetCodeParmError ; } /* if */ STR_String * pVal = new STR_String( sizValue , Value ) ; bool isRet = vtObj[ inxObj ]->SetParameterValue( SecName , ParmName , pVal ) ; return CompareBool( isRet , expRet , "Incorrect set parameter return." ); } // end selection: Test: CFG !Set a parameter value // Perform compare file // AE: CompareFile <s FileA> <s extFileA> <s FileB> <s extFileB> <b expRet> else if ( strcmp( Command , CompareFile_CMD ) == 0 ) { int lenFileA = -1 ; char fileA[ TAL_dimBuffer ] ; int lenExtA = -1 ; char ExtA[ TAL_dimBuffer ] ; int lenFileB = -1 ; char fileB[ TAL_dimBuffer ] ; int lenExtB = -1 ; char ExtB[ TAL_dimBuffer ] ; bool expBool = false ; int numRead = TST_pReader->ReadCommandLine( "ssssb" , &lenFileA , fileA , &lenExtA , ExtA , &lenFileB , fileB , &lenExtB , ExtB , &expBool ) ; if ( numRead != 5 ) { return TST_RetCodeParmError ; } /* if */ return CompareBool( SIO_CompareFile( fileA , ExtA , fileB , ExtB ) , expBool , "Incorrect comparison." ) ; } // end selection: Perform compare file // Test: CFGE !Configuration element constructor // AE: CFGE_LineListElem_002_CMD else if ( strcmp( Command , CFGE_CLineListElem_002_CMD ) == 0 ) { /***** Function CFGE_LineListElem( ) *****/ return TST_RetCodeNotImplemented ; } // end selection: Test: CFGE !Configuration element constructor // Test: CFGE !Configuration element destructor // AE: DeleteCFGE_LineListElem_003_CMD else if ( strcmp( Command , DeleteCFGE_CLineListElem_003_CMD ) == 0 ) { /***** Function ~CFGE_LineListElem( ) *****/ return TST_RetCodeNotImplemented ; } // end selection: Test: CFGE !Configuration element destructor // Test var: Line type // AE: LineType_006 else if ( strcmp( Command , LineType_006 ) == 0 ) { /***** Variable tpLineType LineType ; *****/ return TST_RetCodeNotImplemented ; } // end selection: Test var: Line type // Test var: Next section element // AE: proxSection_007 else if ( strcmp( Command , proxSection_007 ) == 0 ) { /***** Variable CFG_ParamenterListElement * proxSection ; *****/ return TST_RetCodeNotImplemented ; } // end selection: Test var: Next section element // Test var: Next atribute element // AE: proxAttribute_008 else if ( strcmp( Command , proxAttribute_008 ) == 0 ) { /***** Variable CFG_ParamenterListElement * proxAttribute ; *****/ return TST_RetCodeNotImplemented ; } // end selection: Test var: Next atribute element // Test var: Element name // AE: pElementName_009 else if ( strcmp( Command , pElementName_009 ) == 0 ) { /***** Variable STR_String * pElementName ; *****/ return TST_RetCodeNotImplemented ; } // end selection: Test var: Element name // Test var: Element value // AE: pElementValue_021 else if ( strcmp( Command , pElementValue_021 ) == 0 ) { /***** Variable STR_String * pElementValue ; *****/ return TST_RetCodeNotImplemented ; } // end selection: Test var: Element value return TST_RetCodeUnknown ; } // End of function: TCFG !P Perform specific test actions
TST_tpRetCode TST_TestSpecific :: PerformSpecificTest( char * Command ) { // Reset symbol table test setup if ( strcmp( Command , RESET_TAB_CMD ) == 0 ) { ResetTables( ) ; return TST_RetCodeOK ; } // end selection: Reset symbol table test setup // Test Construct symbol table else if ( strcmp( Command , CREATE_TAB_CMD ) == 0 ) { /***** SMT_SymbolTable( int dimVetor ) *****/ int numRead = -1 ; int inxTable = -1 ; int dimTable = -1 ; numRead = TST_pReader->ReadCommandLine( "ii" , &inxTable , &dimTable ) ; if ( ( numRead != 2 ) || ( !VerifyInxTable( inxTable , NO )) || ( dimTable < 1 )) { return TST_RetCodeParmError ; } /* if */ vtTable[ inxTable ] = new SMT_SymbolTable( dimTable ) ; return TST_RetCodeOK ; } // end selection: Test Construct symbol table // Test destruct table else if ( strcmp( Command , DESTRUCT_TAB_CMD ) == 0 ) { /***** ~SMT_SymbolTable( ) *****/ int numRead = -1 ; int inxTable = -1 ; numRead = TST_pReader->ReadCommandLine( "i" , &inxTable ) ; if ( ( numRead != 1 ) || ( !VerifyInxTable( inxTable , YES ))) { return TST_RetCodeParmError ; } /* if */ delete vtTable[ inxTable ] ; vtTable[ inxTable ] = NULL ; return TST_RetCodeOK ; } // end selection: Test destruct table // Test search symbol else if ( strcmp( Command , SEARCH_SYMBOL_CMD ) == 0 ) { /***** SMTE_SymbolTableElement * SearchSymbol( int lenString , char * pString ) *****/ int numRead = -1 ; int inxTable = -1 ; int Exists = 0 ; int sizSymb = -1 ; char Symbol[ TAL_dimBuffer ] ; numRead = TST_pReader->ReadCommandLine( "isi" , &inxTable , &sizSymb , Symbol , &Exists ) ; if ( ( numRead != 3 ) || ( !VerifyInxTable( inxTable , YES ))) { return TST_RetCodeParmError ; } /* if */ TST_tpRetCode RetCode = CompareBool( vtTable[ inxTable ]->SearchSymbol( sizSymb , Symbol ) != NULL , Exists , "Incorrect symbol search return" ) ; return RetCode ; } // end selection: Test search symbol // Test insert symbol else if ( strcmp( Command , INSERT_SYMBOL_CMD ) == 0 ) { /***** SMTE_SymbolTableElement * SMT_InsertSymbol( SMTE_SymbolTableElement * pSymbol ) *****/ int numRead = -1 ; int inxTable = -1 ; int Exists = 0 ; int sizSymb = -1 ; char Symbol[ TAL_dimBuffer ] ; numRead = TST_pReader->ReadCommandLine( "isi" , &inxTable , &sizSymb , Symbol , &Exists ) ; if ( ( numRead != 3 ) || ( !VerifyInxTable( inxTable , YES ))) { return TST_RetCodeParmError ; } /* if */ SMTE_SymbolTableElement * pSymbol = new TSMT_Element( sizSymb , Symbol ) ; pSymbol = vtTable[ inxTable ]->InsertSymbol( pSymbol ) ; TST_tpRetCode RetCode = CompareBool( pSymbol != NULL , Exists , "Incorrect symbol search return" ) ; delete pSymbol ; return RetCode ; } // end selection: Test insert symbol // Test delete symbol else if ( strcmp( Command , DELETE_SYMBOL_CMD ) == 0 ) { /***** bool DeleteSymbol( int lenString , char * pString ) *****/ int numRead = -1 ; int inxTable = -1 ; int Exists = 0 ; int sizSymb = -1 ; char Symbol[ TAL_dimBuffer ] ; numRead = TST_pReader->ReadCommandLine( "isi" , &inxTable , &sizSymb , Symbol , &Exists ) ; if ( ( numRead != 3 ) || ( !VerifyInxTable( inxTable , YES ))) { return TST_RetCodeParmError ; } /* if */ TST_tpRetCode RetCode = CompareBool( vtTable[ inxTable ]->DeleteSymbol( sizSymb , Symbol ) != NULL , Exists , "Incorrect symbol delete return" ) ; return RetCode ; } // end selection: Test delete symbol // Test verify symbol table structure else if ( strcmp( Command , VERIFY_TABLE_CMD ) == 0 ) { /***** bool Verify( const TAL_tpVerifyMode ModeParm ) *****/ int numRead = -1 ; int inxTable = -1 ; int Mode = -1 ; int VerifyCond = 0 ; numRead = TST_pReader->ReadCommandLine( "iii" , &inxTable , &Mode , &VerifyCond ) ; if ( ( numRead != 3 ) || ( !VerifyInxTable( inxTable , YES ))) { return TST_RetCodeParmError ; } /* if */ return CompareBool( vtTable[ inxTable ]->Verify( ( Mode == 0 ? TAL_VerifyNoLog : TAL_VerifyLog )) , VerifyCond , "Incorrect verify structure return" ) ; } // end selection: Test verify symbol table structure // Generate and test a table using a generated random suite else if ( strcmp( Command , GENERATE_TEST_CMD ) == 0 ) { bool VerifyCond = false ; int numRead = TST_pReader->ReadCommandLine( "b" , &VerifyCond ) ; if ( numRead != 1 ) { return TST_RetCodeParmError ; } /* if */ TST_GenerateTestSuite testGenerator ; testGenerator.SetTesterReference( this ) ; if ( ! testGenerator.ReadGenerationParameters( )) { return TST_RetCodeParmError ; } /* if */ bool retVal = testGenerator.TST_GenerateAndTest( ) ; testGenerator.DisplayRandomTestResult( ) ; return CompareBool( retVal , VerifyCond , "Incorrect random test return" ) ; } // end selection: Generate and test a table using a generated random suite return TST_RetCodeUnknown ; } // End of function: TSMT !Symbol table specific test method