loggingservices/eventlogger/test/src/t_logtype.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include <s32file.h>
    16 #include <s32file.h>
    17 #include <logview.h>
    17 #include <logview.h>
    18 #include "TEST.H"
    18 #include "t_logutil2.h"
    19 
    19 
    20 #undef test  //there is a "test" macro which hides "RTest test" declaration.
    20 RTest TheTest(_L("t_logtype"));
    21 RTest test(_L("Event Type Test Harness"));
       
    22 
    21 
    23 /**
    22 /**
    24 @SYMTestCaseID          SYSLIB-LOGENG-CT-0830
    23 @SYMTestCaseID          SYSLIB-LOGENG-CT-0830
    25 @SYMTestCaseDesc	    Tests for CLogEventType::Uid(),CLogEventType::Description(),CLogEventType::Copying() functions
    24 @SYMTestCaseDesc	    Tests for CLogEventType::Uid(),CLogEventType::Description(),CLogEventType::Copying() functions
    26 @SYMTestPriority 	    High
    25 @SYMTestPriority 	    High
    29 @SYMTestExpectedResults Test must not fail
    28 @SYMTestExpectedResults Test must not fail
    30 @SYMREQ                 REQ0000
    29 @SYMREQ                 REQ0000
    31 */
    30 */
    32 LOCAL_C void TestTypeL()
    31 LOCAL_C void TestTypeL()
    33 	{
    32 	{
    34 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0830 "));
    33 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0830 "));
    35 	CLogEventType* type1 = CLogEventType::NewL();
    34 	CLogEventType* type1 = CLogEventType::NewL();
    36 	CleanupStack::PushL(type1);
    35 	CleanupStack::PushL(type1);
    37 
    36 
    38 	// Uid
    37 	// Uid
    39 	TEST(type1->Uid() == TUid::Null());
    38 	TEST(type1->Uid() == TUid::Null());
   114 LOCAL_C void TestTypeWithHeapFailL()
   113 LOCAL_C void TestTypeWithHeapFailL()
   115 //
   114 //
   116 //
   115 //
   117 //
   116 //
   118 	{
   117 	{
   119 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0831 "));
   118 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0831 "));
   120 #ifdef _DEBUG
   119 #ifdef _DEBUG
   121 	TInt failCount = 0;
   120 	TInt failCount = 0;
   122 #endif
   121 #endif
   123 	TInt error;
   122 	TInt error;
   124 	TBool finished = EFalse;
   123 	TBool finished = EFalse;
   151 @SYMTestExpectedResults Test must not fail
   150 @SYMTestExpectedResults Test must not fail
   152 @SYMREQ                 REQ0000
   151 @SYMREQ                 REQ0000
   153 */
   152 */
   154 LOCAL_C void TestInitialEventsL()
   153 LOCAL_C void TestInitialEventsL()
   155 	{
   154 	{
   156 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0832 "));
   155 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0832 "));
   157 	// Make sure the database is deleted
   156 	// Make sure the database is deleted
   158 	TestUtils::DeleteDatabaseL();
   157 	TestUtils::DeleteDatabaseL();
   159 
   158 
   160 	CTestActive* active = new(ELeave)CTestActive;
   159 	CTestActive* active = new(ELeave)CTestActive;
   161 	CleanupStack::PushL(active);
   160 	CleanupStack::PushL(active);
   265 	CleanupStack::PopAndDestroy(5); // event, filter, view, client, active
   264 	CleanupStack::PopAndDestroy(5); // event, filter, view, client, active
   266 	}
   265 	}
   267 
   266 
   268 void doTestsL()
   267 void doTestsL()
   269 	{
   268 	{
   270 	TestUtils::Initialize(_L("T_LOGTYPE"));
   269 	TestUtils::Initialize(_L("t_logtype"));
   271 	test.Start(_L("Event Type"));
   270 	TheTest.Start(_L("Event Type"));
   272 	TestTypeL();
   271 	TestTypeL();
   273 	theLog.Write(_L8("Test 1 OK\n"));
   272 	theLog.Write(_L8("Test 1 OK\n"));
   274 
   273 
   275 	test.Next(_L("Event Type with heap failure"));
   274 	TheTest.Next(_L("Event Type with heap failure"));
   276 	TestTypeWithHeapFailL();
   275 	TestTypeWithHeapFailL();
   277 	theLog.Write(_L8("Test 2 OK\n"));
   276 	theLog.Write(_L8("Test 2 OK\n"));
   278 
   277 
   279 	test.Next(_L("Initial events"));
   278 	TheTest.Next(_L("Initial events"));
   280 	TestInitialEventsL();
   279 	TestInitialEventsL();
   281 	theLog.Write(_L8("Test 3 OK\n"));
   280 	theLog.Write(_L8("Test 3 OK\n"));
   282 	 
   281 	 
   283 	// tidy up ready for the next test
   282 	// tidy up ready for the next test
   284 	TestUtils::DeleteDatabaseL();
   283 	TestUtils::DeleteDatabaseL();