testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittest.cpp
changeset 1 bbd31066657e
parent 0 3e07fef1e154
equal deleted inserted replaced
0:3e07fef1e154 1:bbd31066657e
    46     TPtrC8 classNamePtr( aName );
    46     TPtrC8 classNamePtr( aName );
    47     if ( doubleColonPos > 0 )
    47     if ( doubleColonPos > 0 )
    48         {
    48         {
    49         classNamePtr.Set( aName.Left( doubleColonPos ) );
    49         classNamePtr.Set( aName.Left( doubleColonPos ) );
    50         }
    50         }
    51     iName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( classNamePtr );
    51     
       
    52     iName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( classNamePtr ); 
       
    53     
       
    54     SUT_LOG_FORMAT(_L("enter CSymbianUnitTest::ConstructL -- aName : [%S]"), iName );
       
    55     
       
    56     // unify the same name for armv5 & winscw. 
       
    57     // on winscw, the function name is abc, 
       
    58     // on armv5,  the function name is void abc. 
       
    59     // unify to abc. 
       
    60     TChar chSpace( ' ' );
       
    61     TChar chTab( '\t' );
       
    62     TChar chAsterisk( '*' );
       
    63     TChar chAnd( '&' );
       
    64     TBuf<100> strTmp( *iName ); 
       
    65     strTmp.Trim();
       
    66     TInt pos;
       
    67     
       
    68     // "char * & abc" => abc
       
    69     pos = strTmp.LocateReverse( chAnd );
       
    70     if( KErrNotFound != pos ) 
       
    71     	{
       
    72     	TPtrC ptr = strTmp.Right( strTmp.Length() - pos - 1 );
       
    73     	strTmp = ptr;
       
    74     	strTmp.Trim();
       
    75     	}
       
    76     // "void * abc" => abc
       
    77     pos = strTmp.LocateReverse( chAsterisk );
       
    78     if( KErrNotFound != pos ) 
       
    79     	{
       
    80     	TPtrC ptr = strTmp.Right( strTmp.Length() - pos - 1 );
       
    81     	strTmp = ptr;
       
    82     	strTmp.Trim();
       
    83     	}
       
    84     // "void abc"
       
    85     pos = strTmp.LocateReverse( chSpace );
       
    86     if( KErrNotFound != pos ) 
       
    87     	{
       
    88     	TPtrC ptr = strTmp.Right( strTmp.Length() - pos - 1 );
       
    89     	strTmp = ptr;
       
    90     	strTmp.Trim();
       
    91     	}
       
    92     // "void 	abc"
       
    93     pos = strTmp.LocateReverse( chTab );
       
    94     if( KErrNotFound != pos ) 
       
    95     	{
       
    96     	TPtrC ptr = strTmp.Right( strTmp.Length() - pos - 1 );
       
    97     	strTmp = ptr;
       
    98     	strTmp.Trim();
       
    99     	}
       
   100     	
       
   101     *iName = strTmp;
       
   102     
       
   103     SUT_LOG_FORMAT(_L("exit CSymbianUnitTest::ConstructL -- aName : [%S]"), iName );
    52     }
   104     }
    53 
   105 
    54 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
    55 //
   107 //
    56 // -----------------------------------------------------------------------------
   108 // -----------------------------------------------------------------------------
   329     iHeapCellsReservedByAssertFailure = 
   381     iHeapCellsReservedByAssertFailure = 
   330         heapCellsAfterAddingTheFailure - heapCellsBeforeAddingTheFailure;
   382         heapCellsAfterAddingTheFailure - heapCellsBeforeAddingTheFailure;
   331     User::Leave( KErrSymbianUnitTestAssertionFailed );
   383     User::Leave( KErrSymbianUnitTestAssertionFailed );
   332     }
   384     }
   333 
   385 
       
   386 
       
   387 // -----------------------------------------------------------------------------
       
   388 //
       
   389 // -----------------------------------------------------------------------------
       
   390 //
       
   391 EXPORT_C void CSymbianUnitTest::AssertEqualsL(
       
   392     TInt aExpectedValue, 
       
   393     TInt aActualValue, 
       
   394     TInt aLineNumber,
       
   395     const TDesC8& aFileName,
       
   396     const TDesC8& aFailureMessage )
       
   397     {
       
   398     if ( aExpectedValue != aActualValue )
       
   399         {
       
   400         StopAllocFailureSimulation();
       
   401         AssertionFailedL( aFailureMessage, aLineNumber, aFileName );
       
   402         }
       
   403     }
       
   404 
       
   405 // -----------------------------------------------------------------------------
       
   406 //
       
   407 // -----------------------------------------------------------------------------
       
   408 //
       
   409 EXPORT_C void CSymbianUnitTest::AssertEqualsL(
       
   410     const TDesC8& aExpectedValue,
       
   411     const TDesC8& aActualValue,
       
   412     TInt aLineNumber,
       
   413     const TDesC8& aFileName,
       
   414     const TDesC8& aFailureMessage )
       
   415     {
       
   416     if ( aExpectedValue.Compare( aActualValue ) != 0 )
       
   417         {
       
   418         StopAllocFailureSimulation();
       
   419         AssertionFailedL( aFailureMessage, aLineNumber, aFileName );
       
   420         }
       
   421     }
       
   422 
       
   423 // -----------------------------------------------------------------------------
       
   424 //
       
   425 // -----------------------------------------------------------------------------
       
   426 //
       
   427 EXPORT_C void CSymbianUnitTest::AssertEqualsL(
       
   428     const TDesC16& aExpectedValue,
       
   429     const TDesC16& aActualValue,
       
   430     TInt aLineNumber,
       
   431     const TDesC8& aFileName,
       
   432     const TDesC8& aFailureMessage )
       
   433     {
       
   434     if ( aExpectedValue.Compare( aActualValue ) != 0 )
       
   435         {
       
   436         StopAllocFailureSimulation();
       
   437         AssertionFailedL( aFailureMessage, aLineNumber, aFileName );
       
   438         }
       
   439     }
       
   440 
   334 // -----------------------------------------------------------------------------
   441 // -----------------------------------------------------------------------------
   335 //
   442 //
   336 // -----------------------------------------------------------------------------
   443 // -----------------------------------------------------------------------------
   337 //
   444 //
   338 CSymbianUnitTest::CSymbianUnitTestCase* 
   445 CSymbianUnitTest::CSymbianUnitTestCase*