loggingservices/eventlogger/test/src/t_logfilter.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".
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include <s32file.h>
    16 #include <s32file.h>
    17 #include "TEST.H"
    17 #include "t_logutil2.h"
    18 
    18 
    19 /* this fixes a MSVC link warning */
    19 RTest TheTest(_L("t_logfilter"));
    20 #ifdef __VC32__
       
    21 #pragma comment (linker, "/opt:noref") 
       
    22 #endif
       
    23 
       
    24 #undef test  //there is a "test" macro which hides "RTest test" declaration.
       
    25 
       
    26 RTest test(_L("Log Filter Test Harness"));
       
    27 
    20 
    28 /**
    21 /**
    29 @SYMTestCaseID          SYSLIB-LOGENG-CT-0924
    22 @SYMTestCaseID          SYSLIB-LOGENG-CT-0924
    30 @SYMTestCaseDesc	    CLogFilter functionality test
    23 @SYMTestCaseDesc	    CLogFilter functionality test
    31 @SYMTestPriority 	    High
    24 @SYMTestPriority 	    High
    33                         Tests for copying of two filter objects and test for its equality.
    26                         Tests for copying of two filter objects and test for its equality.
    34 @SYMTestExpectedResults Test must not fail
    27 @SYMTestExpectedResults Test must not fail
    35 @SYMREQ                 REQ0000
    28 @SYMREQ                 REQ0000
    36 */
    29 */
    37 LOCAL_C void TestFilterL()
    30 LOCAL_C void TestFilterL()
    38 //
       
    39 //
       
    40 //
       
    41 	{
    31 	{
    42 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0924 "));
    32 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0924 "));
    43 	CLogFilter* filter1 = CLogFilter::NewL();
    33 	CLogFilter* filter1 = CLogFilter::NewL();
    44 	CleanupStack::PushL(filter1);
    34 	CleanupStack::PushL(filter1);
    45 
    35 
    46 	// Event type
    36 	// Event type
    47 	TEST(filter1->EventType() == TUid::Null());
    37 	TEST(filter1->EventType() == TUid::Null());
   242 @SYMTestActions  	    Check for any memory and environment errors while creation
   232 @SYMTestActions  	    Check for any memory and environment errors while creation
   243 @SYMTestExpectedResults Test must not fail
   233 @SYMTestExpectedResults Test must not fail
   244 @SYMREQ                 REQ0000
   234 @SYMREQ                 REQ0000
   245 */
   235 */
   246 LOCAL_C void TestFilterWithHeapFailL()
   236 LOCAL_C void TestFilterWithHeapFailL()
   247 //
       
   248 //
       
   249 //
       
   250 	{
   237 	{
   251 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0925 "));
   238 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0925 "));
   252 #ifdef _DEBUG
   239 #ifdef _DEBUG
   253 	TInt failCount = 0;
   240 	TInt failCount = 0;
   254 #endif
   241 #endif
   255 
   242 
   256 	TBool finished = EFalse;
   243 	TBool finished = EFalse;
   276 			TEST2(error, KErrNoMemory);
   263 			TEST2(error, KErrNoMemory);
   277 		}
   264 		}
   278 	}
   265 	}
   279 
   266 
   280 void doTestsL()
   267 void doTestsL()
   281 //
       
   282 //
       
   283 //
       
   284 	{
   268 	{
   285 	TestUtils::Initialize(_L("T_LOGFILTER"));
   269 	TestUtils::Initialize(_L("t_logfilter"));
   286 
   270 
   287 	test.Start(_L("Filter"));
   271 	TheTest.Start(_L("Filter"));
   288 	TestFilterL();
   272 	TestFilterL();
   289 	theLog.Write(_L8("Test 1 OK\n"));
   273 	theLog.Write(_L8("Test 1 OK\n"));
   290 
   274 
   291 	test.Next(_L("Filter with heap failure"));
   275 	TheTest.Next(_L("Filter with heap failure"));
   292 	TestFilterWithHeapFailL();
   276 	TestFilterWithHeapFailL();
   293 	theLog.Write(_L8("Test 2 OK\n"));
   277 	theLog.Write(_L8("Test 2 OK\n"));
   294 	}
   278 	}