equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include "T_CP949.h" |
19 #include <e32test.h> |
20 #include <e32des8.h> |
20 #include <e32des8.h> |
21 |
21 |
22 #define test(cond) \ |
22 LOCAL_D RTest test(_L("T_CP949.exe")); |
23 { \ |
|
24 TBool __bb = (cond); \ |
|
25 TEST(__bb); \ |
|
26 if (!__bb) \ |
|
27 { \ |
|
28 ERR_PRINTF1(_L("ERROR: Test Failed")); \ |
|
29 User::Leave(1); \ |
|
30 } \ |
|
31 } |
|
32 |
|
33 |
23 |
34 _LIT16(Uni_1, "\xFFFF\x0053\x0059\x004D\x0042\x0049\x0041\x004E\xAC21\xC6AA\xFFFF\x9673\x8A70"); |
24 _LIT16(Uni_1, "\xFFFF\x0053\x0059\x004D\x0042\x0049\x0041\x004E\xAC21\xC6AA\xFFFF\x9673\x8A70"); |
35 _LIT8(CP949_1, "\x5F\x53\x59\x4D\x42\x49\x41\x4E\x81\x4D\x9F\x42\x5F\xF2\xE7\xFD\xFE"); |
25 _LIT8(CP949_1, "\x5F\x53\x59\x4D\x42\x49\x41\x4E\x81\x4D\x9F\x42\x5F\xF2\xE7\xFD\xFE"); |
36 _LIT16(Uni_2, "\xFFFD\x005F\x304A\xFFFD\xFFFD"); |
26 _LIT16(Uni_2, "\xFFFD\x005F\x304A\xFFFD\xFFFD"); |
37 _LIT8(CP949_2, "\xAA\x40\x5F\xAA\xAA\xFF\xFE"); |
27 _LIT8(CP949_2, "\xAA\x40\x5F\xAA\xAA\xFF\xFE"); |
48 @SYMTestCaseDesc Tests API behaviours of UnicodeConv class |
38 @SYMTestCaseDesc Tests API behaviours of UnicodeConv class |
49 @SYMTestPriority High |
39 @SYMTestPriority High |
50 @SYMTestActions Tests for conversions from/to Unicode, using a function pointer |
40 @SYMTestActions Tests for conversions from/to Unicode, using a function pointer |
51 @SYMTestExpectedResults Test must not fail |
41 @SYMTestExpectedResults Test must not fail |
52 */ |
42 */ |
53 void CT_CP949::TestL() |
43 void Test() |
54 { |
44 { |
55 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1777 ")); |
45 test.Next(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1777 ")); |
56 RLibrary lib; |
46 RLibrary lib; |
57 |
47 |
58 const TUidType serverUid(KNullUid,KNullUid,KPluginUid); |
48 const TUidType serverUid(KNullUid,KNullUid,KPluginUid); |
59 // load the dll |
49 // load the dll |
60 TInt returnValue = lib.Load(KName,serverUid); |
50 TInt returnValue = lib.Load(KName,serverUid); |
111 @SYMTestCaseDesc Tests API behaviours of UnicodeConv class as part of INC090073 |
101 @SYMTestCaseDesc Tests API behaviours of UnicodeConv class as part of INC090073 |
112 @SYMTestPriority High |
102 @SYMTestPriority High |
113 @SYMTestActions Tests for correct character conversion on certain chinese characters for CP936 |
103 @SYMTestActions Tests for correct character conversion on certain chinese characters for CP936 |
114 @SYMTestExpectedResults Test must not fail |
104 @SYMTestExpectedResults Test must not fail |
115 */ |
105 */ |
116 void CT_CP949::TestINC090073L() |
106 void TestINC090073() |
117 { |
107 { |
118 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0002 ")); |
108 test.Next(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0002 ")); |
119 _LIT16(unicode, "\x715C\x7A37\x61A9\x80B1\x86A3\x6B46\x6615"); |
109 _LIT16(unicode, "\x715C\x7A37\x61A9\x80B1\x86A3\x6B46\x6615"); |
120 _LIT8(CP932Code, "\xE9\xF2\xF2\xC3\xCC\xA8\xCE\xDD\xCD\xF7\xFD\xE4\xFD\xDA"); |
110 _LIT8(CP932Code, "\xE9\xF2\xF2\xC3\xCC\xA8\xCE\xDD\xCD\xF7\xFD\xE4\xFD\xDA"); |
121 |
111 |
122 RLibrary lib; |
112 RLibrary lib; |
123 |
113 |
145 foreign1.Zero(); |
135 foreign1.Zero(); |
146 |
136 |
147 lib.Close(); |
137 lib.Close(); |
148 } |
138 } |
149 |
139 |
150 void CT_CP949::OOMTestL() |
140 void OOMTest() |
151 { |
141 { |
152 INFO_PRINTF1(_L("OOM testing")); |
142 test.Next(_L("OOM testing")); |
153 TInt err, tryCount = 0; |
143 TInt err, tryCount = 0; |
154 do |
144 do |
155 { |
145 { |
156 __UHEAP_MARK; |
146 __UHEAP_MARK; |
157 // find out the number of open handles |
147 // find out the number of open handles |
160 RThread().HandleCount(startProcessHandleCount, startThreadHandleCount); |
150 RThread().HandleCount(startProcessHandleCount, startThreadHandleCount); |
161 |
151 |
162 // Setting Heap failure for OOM test |
152 // Setting Heap failure for OOM test |
163 __UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount); |
153 __UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount); |
164 |
154 |
165 TRAP(err,TestL()); |
155 TRAP(err,Test()); |
166 |
156 |
167 __UHEAP_SETFAIL(RHeap::ENone, 0); |
157 __UHEAP_SETFAIL(RHeap::ENone, 0); |
168 |
158 |
169 // check that no handles have leaked |
159 // check that no handles have leaked |
170 TInt endProcessHandleCount; |
160 TInt endProcessHandleCount; |
176 |
166 |
177 __UHEAP_MARKEND; |
167 __UHEAP_MARKEND; |
178 }while (err == KErrNoMemory); |
168 }while (err == KErrNoMemory); |
179 |
169 |
180 test(err == KErrNone); |
170 test(err == KErrNone); |
181 INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i\n"), tryCount); |
171 test.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount); |
182 } |
172 } |
183 |
173 |
184 |
174 |
185 CT_CP949::CT_CP949() |
175 LOCAL_C void DoE32MainL() |
186 { |
176 { |
187 SetTestStepName(KTestStep_T_CP949); |
177 __UHEAP_MARK; |
188 } |
178 |
189 |
179 Test(); |
190 |
180 TestINC090073(); |
191 |
181 OOMTest(); |
192 TVerdict CT_CP949::doTestStepL() |
182 |
193 { |
183 __UHEAP_MARKEND; |
194 SetTestStepResult(EFail); |
184 } |
195 |
185 |
196 __UHEAP_MARK; |
186 GLDEF_C TInt E32Main() |
197 |
187 { |
198 TRAPD(error1, TestL()); |
188 __UHEAP_MARK; |
199 TRAPD(error2, TestINC090073L()); |
189 |
200 TRAPD(error3, OOMTestL()); |
190 test.Title(); |
201 |
191 test.Start(_L("CP949 test...")); |
202 __UHEAP_MARKEND; |
192 |
203 |
193 CTrapCleanup* trapCleanup=CTrapCleanup::New(); |
204 if(error1 == KErrNone && error2 == KErrNone && error3 == KErrNone) |
194 TRAPD(error, DoE32MainL()); |
205 { |
195 test(error==KErrNone); |
206 SetTestStepResult(EPass); |
196 |
207 } |
197 delete trapCleanup; |
208 |
198 |
209 return TestStepResult(); |
199 test.End(); |
210 } |
200 test.Close(); |
|
201 |
|
202 __UHEAP_MARKEND; |
|
203 return error; |
|
204 } |