equal
deleted
inserted
replaced
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 #include <s32mem.h> |
18 #include <s32mem.h> |
19 |
19 |
20 /* this fixes a MSVC link warning */ |
20 RTest TheTest(_L("t_logevent")); |
21 #ifdef __VC32__ |
|
22 #pragma comment (linker, "/opt:noref") |
|
23 #endif |
|
24 |
|
25 #undef test //there is a "TEST" macro which hides "RTest TEST" declaration. |
|
26 |
|
27 RTest test(_L("Log Event Test Harness")); |
|
28 |
21 |
29 TBool CompareEvents(const CLogEvent& aLeft, const CLogEvent& aRight) |
22 TBool CompareEvents(const CLogEvent& aLeft, const CLogEvent& aRight) |
30 { |
23 { |
31 TBool ret = aLeft.Data() == aRight.Data(); |
24 TBool ret = aLeft.Data() == aRight.Data(); |
32 ret = ret && aLeft.Description() == aRight.Description(); |
25 ret = ret && aLeft.Description() == aRight.Description(); |
75 @SYMTestActions Calls up TestStoreL() function |
68 @SYMTestActions Calls up TestStoreL() function |
76 @SYMTestExpectedResults Test must not fail |
69 @SYMTestExpectedResults Test must not fail |
77 @SYMREQ REQ0000 |
70 @SYMREQ REQ0000 |
78 */ |
71 */ |
79 LOCAL_C void TestEventL() |
72 LOCAL_C void TestEventL() |
80 // |
|
81 // |
|
82 // |
|
83 { |
73 { |
84 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1008 ")); |
74 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1008 ")); |
85 CLogEvent* event1 = CLogEvent::NewL(); |
75 CLogEvent* event1 = CLogEvent::NewL(); |
86 CleanupStack::PushL(event1); |
76 CleanupStack::PushL(event1); |
87 |
77 |
88 // Event Id |
78 // Event Id |
89 TEST(event1->Id() == KLogNullId); |
79 TEST(event1->Id() == KLogNullId); |
565 Check for memory errors |
555 Check for memory errors |
566 @SYMTestExpectedResults Test must not fail |
556 @SYMTestExpectedResults Test must not fail |
567 @SYMREQ REQ0000 |
557 @SYMREQ REQ0000 |
568 */ |
558 */ |
569 LOCAL_C void TestEventWithHeapFailL() |
559 LOCAL_C void TestEventWithHeapFailL() |
570 // |
|
571 // |
|
572 // |
|
573 |
|
574 { |
560 { |
575 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1009 ")); |
561 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1009 ")); |
576 #ifdef _DEBUG |
562 #ifdef _DEBUG |
577 TInt failCount = 0; |
563 TInt failCount = 0; |
578 #endif |
564 #endif |
579 TInt error; |
565 TInt error; |
580 TBool finished = EFalse; |
566 TBool finished = EFalse; |
824 Check for memory errors |
810 Check for memory errors |
825 @SYMTestExpectedResults Test must not fail |
811 @SYMTestExpectedResults Test must not fail |
826 @SYMREQ REQ0000 |
812 @SYMREQ REQ0000 |
827 */ |
813 */ |
828 LOCAL_C void TestEventWithFileFailL() |
814 LOCAL_C void TestEventWithFileFailL() |
829 // |
|
830 // |
|
831 // |
|
832 { |
815 { |
833 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1010 ")); |
816 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1010 ")); |
834 CLogEvent* event = CLogEvent::NewL(); |
817 CLogEvent* event = CLogEvent::NewL(); |
835 CleanupStack::PushL(event); |
818 CleanupStack::PushL(event); |
836 |
819 |
837 // streaming |
820 // streaming |
838 TFileName storename = _L("c:\\T_BASIC_DATA"); |
821 TFileName storename = _L("c:\\T_BASIC_DATA"); |
898 CleanupStack::PopAndDestroy(3); // buf8, store, event |
881 CleanupStack::PopAndDestroy(3); // buf8, store, event |
899 ::DeleteDataFile(storename); |
882 ::DeleteDataFile(storename); |
900 } |
883 } |
901 |
884 |
902 void doTestsL() |
885 void doTestsL() |
903 // |
|
904 // |
|
905 // |
|
906 { |
886 { |
907 TestUtils::Initialize(_L("T_LOGEVENT")); |
887 TestUtils::Initialize(_L("t_logevent")); |
908 |
888 |
909 test.Start(_L("Event")); |
889 TheTest.Start(_L("Event")); |
910 // TestServerL(); |
890 // TestServerL(); |
911 |
891 |
912 |
892 |
913 TestEventL(); |
893 TestEventL(); |
914 theLog.Write(_L8("Test 1 OK\n")); |
894 theLog.Write(_L8("Test 1 OK\n")); |
915 |
895 |
916 test.Next(_L("Event with heap failure")); |
896 TheTest.Next(_L("Event with heap failure")); |
917 TestEventWithHeapFailL(); |
897 TestEventWithHeapFailL(); |
918 theLog.Write(_L8("Test 2 OK\n")); |
898 theLog.Write(_L8("Test 2 OK\n")); |
919 |
899 |
920 test.Next(_L("Event with file failure")); |
900 TheTest.Next(_L("Event with file failure")); |
921 TestEventWithFileFailL(); |
901 TestEventWithFileFailL(); |
922 theLog.Write(_L8("Test 3 OK\n")); |
902 theLog.Write(_L8("Test 3 OK\n")); |
923 } |
903 } |
924 |
904 |