symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittestsuite.cpp
branchRCL_3
changeset 3 9397a16b6eb8
parent 1 6edeef394eb7
equal deleted inserted replaced
1:6edeef394eb7 3:9397a16b6eb8
     1 /*
       
     2 * Copyright (c) 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 "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 *
       
    16 */
       
    17 
       
    18 #include "ut_symbianunittestsuite.h"
       
    19 #include <symbianunittestsuite.h>
       
    20 #include <symbianunittestmacros.h>
       
    21 
       
    22 _LIT( KTestSuiteName, "TestSuite" );
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 //
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 UT_CSymbianUnitTestSuite* UT_CSymbianUnitTestSuite::NewL()
       
    29     {
       
    30     UT_CSymbianUnitTestSuite* self = UT_CSymbianUnitTestSuite::NewLC(); 
       
    31     CleanupStack::Pop( self );
       
    32     return self;
       
    33     }
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 UT_CSymbianUnitTestSuite* UT_CSymbianUnitTestSuite::NewLC()
       
    40     {
       
    41     UT_CSymbianUnitTestSuite* self = 
       
    42         new( ELeave )UT_CSymbianUnitTestSuite();
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL();
       
    45     return self;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 UT_CSymbianUnitTestSuite::UT_CSymbianUnitTestSuite()
       
    53     {
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void UT_CSymbianUnitTestSuite::ConstructL()
       
    61     {
       
    62     BASE_CONSTRUCT
       
    63     
       
    64     DEFINE_TEST_CLASS( UT_CSymbianUnitTestSuite )
       
    65     
       
    66     ADD_SUT( UT_NameL )
       
    67     ADD_SUT( UT_AddL )
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 UT_CSymbianUnitTestSuite::~UT_CSymbianUnitTestSuite()
       
    75     {
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 void UT_CSymbianUnitTestSuite::SetupL()
       
    83     {
       
    84     iUnitTestSuite = CSymbianUnitTestSuite::NewL( KTestSuiteName );
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void UT_CSymbianUnitTestSuite::Teardown()
       
    92     {
       
    93     delete iUnitTestSuite;
       
    94     iUnitTestSuite = NULL;
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void UT_CSymbianUnitTestSuite::UT_NameL()
       
   102     {
       
   103     SUT_ASSERT_EQUALS( KTestSuiteName, iUnitTestSuite->Name() )
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 void UT_CSymbianUnitTestSuite::UT_AddL()
       
   111     {
       
   112     SUT_ASSERT_EQUALS( 0, iUnitTestSuite->TestCaseCount() )
       
   113 
       
   114     UT_CSymbianUnitTestSuite* thisTest = UT_CSymbianUnitTestSuite::NewLC();
       
   115     iUnitTestSuite->AddL( thisTest );
       
   116     CleanupStack::Pop( thisTest );
       
   117     SUT_ASSERT_EQUALS( 
       
   118         thisTest->TestCaseCount(), iUnitTestSuite->TestCaseCount() )
       
   119     }