|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <e32debug.h> |
|
17 #include <e32base.h> |
|
18 #include <e32hashtab.h> |
|
19 #include <e32test.h> |
|
20 |
|
21 #include "teststatic.h" |
|
22 #include "testdll.h" |
|
23 |
|
24 RTest test(_L("Simple tests")); |
|
25 |
|
26 EXPORT_C void HashL() |
|
27 { |
|
28 TInt in = 0x12345678; |
|
29 TInt out = 0; |
|
30 out = DefaultHash::Integer(in); |
|
31 test(in != out); |
|
32 } |
|
33 |
|
34 void DefectsL() |
|
35 { |
|
36 // DEF132826: symport User:Alloc family error checking |
|
37 test(User::Alloc(-10) == NULL); |
|
38 } |
|
39 |
|
40 void doMainL() |
|
41 { |
|
42 CTestDll dll; |
|
43 |
|
44 test.Start(_L("Leaving")); |
|
45 TRAPD(err, TestStatic::LeaveL()); |
|
46 RDebug::Print(_L("... Leave code from lib: %d\n"), err); |
|
47 TRAP(err, dll.LeaveL()); |
|
48 RDebug::Print(_L("... Leave code from dll: %d\n"), err); |
|
49 test(err != KErrNone); |
|
50 |
|
51 test.Next(_L("Arrays")); |
|
52 test(TestStatic::ArrayL() == 3); |
|
53 test(dll.ArrayL() == 3); |
|
54 |
|
55 test.Next(_L("Descriptors")); |
|
56 TestStatic::DescriptorL(); |
|
57 dll.DescriptorL(); |
|
58 |
|
59 test.Next(_L("Hash")); |
|
60 HashL(); |
|
61 |
|
62 test.Next(_L("Defects")); |
|
63 DefectsL(); |
|
64 |
|
65 test.End(); |
|
66 } |
|
67 |
|
68 int E32Main() |
|
69 { |
|
70 RDebug::Print(_L("Called from E32Main\n")); |
|
71 |
|
72 __UHEAP_MARK; |
|
73 CTrapCleanup* theCleanup = CTrapCleanup::New(); |
|
74 TRAPD(ret, doMainL()); |
|
75 test(ret == KErrNone); |
|
76 test.Close(); |
|
77 delete theCleanup; |
|
78 __UHEAP_MARKEND; |
|
79 return ret; |
|
80 } |