sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "T_CP54936.h"
|
sl@0
|
20 |
#include <e32des8.h>
|
sl@0
|
21 |
#include <hal.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
#define test(cond) \
|
sl@0
|
24 |
{ \
|
sl@0
|
25 |
TBool __bb = (cond); \
|
sl@0
|
26 |
TEST(__bb); \
|
sl@0
|
27 |
if (!__bb) \
|
sl@0
|
28 |
{ \
|
sl@0
|
29 |
ERR_PRINTF1(_L("ERROR: Test Failed")); \
|
sl@0
|
30 |
User::Leave(1); \
|
sl@0
|
31 |
} \
|
sl@0
|
32 |
}
|
sl@0
|
33 |
|
sl@0
|
34 |
|
sl@0
|
35 |
const TInt MaxCount = 10000; // iteration number for performance tests
|
sl@0
|
36 |
|
sl@0
|
37 |
// cp54936 should be faster than cp936
|
sl@0
|
38 |
_LIT(KName936,"CP936");
|
sl@0
|
39 |
const TUid KPluginUid936={0x10206A91};
|
sl@0
|
40 |
|
sl@0
|
41 |
|
sl@0
|
42 |
_LIT(KName,"CP54936");
|
sl@0
|
43 |
const TUid KPluginUid={0x1028703b};
|
sl@0
|
44 |
|
sl@0
|
45 |
|
sl@0
|
46 |
void CT_CP54936::TestOut(const TDesC16 &des)
|
sl@0
|
47 |
{
|
sl@0
|
48 |
for (TInt i=0; i<des.Length(); i++)
|
sl@0
|
49 |
INFO_PRINTF2(_L("%04X "), des[i]);
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
void CT_CP54936::TestOut(const TDesC8 &des)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
for (TInt i=0; i<des.Length(); i++)
|
sl@0
|
55 |
INFO_PRINTF2(_L("%02X "), des[i]);
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
// Used for supressing warning in OOM tests
|
sl@0
|
59 |
#define __UNUSED_VAR(var) var = var
|
sl@0
|
60 |
|
sl@0
|
61 |
/**
|
sl@0
|
62 |
@SYMTestCaseID SYSLIB-FATCHARSETCONV-CT-1778
|
sl@0
|
63 |
@SYMTestCaseDesc Tests API behaviours of UnicodeConv class
|
sl@0
|
64 |
@SYMTestPriority High
|
sl@0
|
65 |
@SYMTestActions Tests for conversions from/to Unicode, using a function pointer
|
sl@0
|
66 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
67 |
*/
|
sl@0
|
68 |
void CT_CP54936::TestL()
|
sl@0
|
69 |
{
|
sl@0
|
70 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1778 "));
|
sl@0
|
71 |
RLibrary lib;
|
sl@0
|
72 |
|
sl@0
|
73 |
const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
|
sl@0
|
74 |
// load the dll
|
sl@0
|
75 |
TInt returnValue = lib.Load(KName,serverUid);
|
sl@0
|
76 |
test(returnValue==0);
|
sl@0
|
77 |
|
sl@0
|
78 |
// get a pointer to the specified ordinal function and call it
|
sl@0
|
79 |
TLibraryFunction function1 = lib.Lookup(1);
|
sl@0
|
80 |
TLibraryFunction function2 = lib.Lookup(2);
|
sl@0
|
81 |
TLibraryFunction function3 = lib.Lookup(3);
|
sl@0
|
82 |
|
sl@0
|
83 |
//cast the function pointer f to a function of type void with two arguments
|
sl@0
|
84 |
typedef void (*TConvertFromUnicodeL)(TDes8&, const TDesC16&);
|
sl@0
|
85 |
TConvertFromUnicodeL aConvertFromUnicodeL = reinterpret_cast <TConvertFromUnicodeL> (function1);
|
sl@0
|
86 |
|
sl@0
|
87 |
typedef void (*TConvertToUnicodeL)(TDes16&, const TDesC8&);
|
sl@0
|
88 |
TConvertToUnicodeL aConvertToUnicodeL = reinterpret_cast <TConvertToUnicodeL> (function2);
|
sl@0
|
89 |
|
sl@0
|
90 |
typedef TBool (*TIsLegalShortNameCharacter)(TUint);
|
sl@0
|
91 |
TIsLegalShortNameCharacter aIsLegalShortNameCharacter = reinterpret_cast <TIsLegalShortNameCharacter> (function3);
|
sl@0
|
92 |
|
sl@0
|
93 |
// from Test Analysis:
|
sl@0
|
94 |
// p1: 0x40 -> 0x40
|
sl@0
|
95 |
// p2: 0x24 -> 0x24
|
sl@0
|
96 |
// p3: 0x706C -> 0xECE1
|
sl@0
|
97 |
// p4: 0x4E96 -> 0x8181
|
sl@0
|
98 |
// p5: 0x20AC -> 0xA2E3
|
sl@0
|
99 |
// p6: 0x3622 -> 0x8230A730, 0x060C -> 0x81318132
|
sl@0
|
100 |
// p7: 0x201AD (0xD840 0xDDAD) -> 0x9532AD35
|
sl@0
|
101 |
// p10-p15: N/A
|
sl@0
|
102 |
// p20-p22: N/A
|
sl@0
|
103 |
// p30: 0x32FF -> 0x8139D633
|
sl@0
|
104 |
// p31: 0x10500 (0xD801 0xDD00) -> 0x90318330
|
sl@0
|
105 |
// 0xFFFF -> 0x8431A439
|
sl@0
|
106 |
_LIT16(Uni_1, "\x0040\xD840\x0024\x060C\x706C\x4E96\x20AC\x3622\xD840\xDDAD\x32FF\xD801\xDD00\xDC00\xFFFF");
|
sl@0
|
107 |
_LIT8(CP54936_1, "\x40\x5F\x24\x81\x31\x81\x32\xEC\xE1\x81\x81\xA2\xE3\x82\x30\xA7\x30\x95\x32\xAD\x35\x81\x39\xD6\x33\x90\x31\x83\x30\x5F\x84\x31\xA4\x39");
|
sl@0
|
108 |
|
sl@0
|
109 |
TBuf8<200> foreign1;
|
sl@0
|
110 |
TBuf16<200> unicode2;
|
sl@0
|
111 |
|
sl@0
|
112 |
const TDesC16& unicode1(Uni_1);
|
sl@0
|
113 |
INFO_PRINTF1(_L("source: ")); TestOut(unicode1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
114 |
INFO_PRINTF1(_L("expect: ")); TestOut(CP54936_1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
115 |
//TRAPD(err, (*aConvertFromUnicodeL)(foreign1, unicode1));
|
sl@0
|
116 |
(*aConvertFromUnicodeL)(foreign1, unicode1); //testing conversion from Unicode
|
sl@0
|
117 |
INFO_PRINTF1(_L("result: ")); TestOut(foreign1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
118 |
TInt error = foreign1.Compare(CP54936_1);
|
sl@0
|
119 |
test(error==0);
|
sl@0
|
120 |
foreign1.Zero();
|
sl@0
|
121 |
|
sl@0
|
122 |
// from Test Analysis:
|
sl@0
|
123 |
// p1: 0x40
|
sl@0
|
124 |
// p2: 0x24
|
sl@0
|
125 |
// p3: 0x706C <- 0xECE1
|
sl@0
|
126 |
// p4: 0x4E96 <- 0x8181
|
sl@0
|
127 |
// p5: 0x20AC <- 0xA2E3
|
sl@0
|
128 |
// p6: 0x3622 <- 0x8230A730, 0x060C <- 0x81318132
|
sl@0
|
129 |
// p7: 0x201AD (0xD840 0xDDAD) <- 0x9532AD35
|
sl@0
|
130 |
// p10: //0x0E -> 0xFFFD
|
sl@0
|
131 |
// p11: //0xA0 -> 0xFFFD
|
sl@0
|
132 |
// p12: 0xA1A0 -> 0xE525
|
sl@0
|
133 |
// p13: 0xA07F -> 0xFFFD
|
sl@0
|
134 |
// p14: 0x95328230 -> 0x1FFFA (0xD83F 0xDFFA) //0xFFFD
|
sl@0
|
135 |
// p15: 0x8130813A -> 0xFFFD
|
sl@0
|
136 |
// p20-p22: N/A
|
sl@0
|
137 |
// p30-p31: N/A
|
sl@0
|
138 |
_LIT16(Uni_2, "\x0040\x0024\x706C\x4E96\x20AC\x3622\x060C\xD840\xDDAD\xE525\xFFFD\xD83F\xDFFA\xFFFD");
|
sl@0
|
139 |
_LIT8(CP54936_2, "\x40\x24\xEC\xE1\x81\x81\xA2\xE3\x82\x30\xA7\x30\x81\x31\x81\x32\x95\x32\xAD\x35\xA1\xA0\xA0\x7F\x95\x32\x82\x30\x81\x30\x81\x3A");
|
sl@0
|
140 |
|
sl@0
|
141 |
const TDesC8& foreign2(CP54936_2);
|
sl@0
|
142 |
INFO_PRINTF1(_L("source: ")); TestOut(foreign2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
143 |
INFO_PRINTF1(_L("expect: ")); TestOut(Uni_2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
144 |
//TRAP(err, (*aConvertToUnicodeL)(unicode2,foreign2));
|
sl@0
|
145 |
(*aConvertToUnicodeL)(unicode2,foreign2);//); //testing conversion to Unicode
|
sl@0
|
146 |
INFO_PRINTF1(_L("result: ")); TestOut(unicode2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
147 |
error = unicode2.Compare(Uni_2);
|
sl@0
|
148 |
test(error==0);
|
sl@0
|
149 |
unicode2.Zero();
|
sl@0
|
150 |
|
sl@0
|
151 |
|
sl@0
|
152 |
//testing for legal short name character
|
sl@0
|
153 |
TInt result = (*aIsLegalShortNameCharacter)(0x005F); //testing for existent character
|
sl@0
|
154 |
test(result==1);
|
sl@0
|
155 |
result = (*aIsLegalShortNameCharacter)(0x003F); //testing for illegal character
|
sl@0
|
156 |
test(result==0);
|
sl@0
|
157 |
result = (*aIsLegalShortNameCharacter)(0x2999);
|
sl@0
|
158 |
test(result==1);
|
sl@0
|
159 |
result = (*aIsLegalShortNameCharacter)(0x4E02); //testing for a double byte character
|
sl@0
|
160 |
test(result==1);
|
sl@0
|
161 |
|
sl@0
|
162 |
lib.Close();
|
sl@0
|
163 |
}
|
sl@0
|
164 |
|
sl@0
|
165 |
/**
|
sl@0
|
166 |
@SYMTestCaseID SYSLIB-FATCHARSETCONV-CT-1847-0001
|
sl@0
|
167 |
@SYMTestCaseDesc Tests API behaviours of UnicodeConv class as part of INC090073
|
sl@0
|
168 |
@SYMTestPriority High
|
sl@0
|
169 |
@SYMTestActions Tests for correct character conversion on certain chinese characters for CP936
|
sl@0
|
170 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
171 |
*/
|
sl@0
|
172 |
void CT_CP54936::TestINC090073L()
|
sl@0
|
173 |
{
|
sl@0
|
174 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0001 "));
|
sl@0
|
175 |
|
sl@0
|
176 |
_LIT16(unicode, "\x7CCD\x74EF\x8026\x8F8F\x94F3\x7633\x6DFC\x9785\x7F81\x7A37\x61A9\x80B1\x86A3\x89E5\x80F2\x9B48\x9E47\x6C19\x7B71\x946B\x6B46\x6615");
|
sl@0
|
177 |
_LIT8(CP932Code, "\xF4\xD9\xEA\xB1\xF1\xEE\xEA\xA3\xEF\xA5\xF1\xAC\xED\xB5\xF7\xB1\xEE\xBF\xF0\xA2\xED\xAC\xEB\xC5\xF2\xBC\xF6\xA1\xEB\xDC\xF7\xCC\xF0\xC2\xEB\xAF\xF3\xE3\xF6\xCE\xEC\xA7\xEA\xBF");
|
sl@0
|
178 |
|
sl@0
|
179 |
RLibrary lib;
|
sl@0
|
180 |
|
sl@0
|
181 |
const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
|
sl@0
|
182 |
// load the dll
|
sl@0
|
183 |
TInt returnValue = lib.Load(KName,serverUid);
|
sl@0
|
184 |
test(returnValue==0);
|
sl@0
|
185 |
|
sl@0
|
186 |
// get a pointer to the specified ordinal function and call it
|
sl@0
|
187 |
TLibraryFunction function1 = lib.Lookup(1);
|
sl@0
|
188 |
|
sl@0
|
189 |
|
sl@0
|
190 |
//cast the function pointer f to a function of type void with two arguments
|
sl@0
|
191 |
typedef void (*TConvertFromUnicodeL)(TDes8&, const TDesC16&);
|
sl@0
|
192 |
TConvertFromUnicodeL aConvertFromUnicodeL = reinterpret_cast <TConvertFromUnicodeL> (function1);
|
sl@0
|
193 |
|
sl@0
|
194 |
TBuf8<50> foreign1;
|
sl@0
|
195 |
|
sl@0
|
196 |
foreign1.Zero();
|
sl@0
|
197 |
const TDesC16& unicode1(unicode);
|
sl@0
|
198 |
TRAPD(err,(*aConvertFromUnicodeL)(foreign1, unicode1)); //testing conversion from Unicode
|
sl@0
|
199 |
test(err==0);
|
sl@0
|
200 |
TInt error = foreign1.Compare(CP932Code);
|
sl@0
|
201 |
test(error==0);
|
sl@0
|
202 |
foreign1.Zero();
|
sl@0
|
203 |
|
sl@0
|
204 |
lib.Close();
|
sl@0
|
205 |
}
|
sl@0
|
206 |
|
sl@0
|
207 |
void CT_CP54936::OOMTestL()
|
sl@0
|
208 |
{
|
sl@0
|
209 |
INFO_PRINTF1(_L("OOM testing"));
|
sl@0
|
210 |
TInt err, tryCount = 0;
|
sl@0
|
211 |
do
|
sl@0
|
212 |
{
|
sl@0
|
213 |
__UHEAP_MARK;
|
sl@0
|
214 |
// find out the number of open handles
|
sl@0
|
215 |
TInt startProcessHandleCount;
|
sl@0
|
216 |
TInt startThreadHandleCount;
|
sl@0
|
217 |
RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
|
sl@0
|
218 |
|
sl@0
|
219 |
// Setting Heap failure for OOM test
|
sl@0
|
220 |
__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
|
sl@0
|
221 |
|
sl@0
|
222 |
TRAP(err,TestL());
|
sl@0
|
223 |
|
sl@0
|
224 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
sl@0
|
225 |
|
sl@0
|
226 |
// check that no handles have leaked
|
sl@0
|
227 |
TInt endProcessHandleCount;
|
sl@0
|
228 |
TInt endThreadHandleCount;
|
sl@0
|
229 |
RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
|
sl@0
|
230 |
|
sl@0
|
231 |
test(startProcessHandleCount == endProcessHandleCount);
|
sl@0
|
232 |
test(startThreadHandleCount == endThreadHandleCount);
|
sl@0
|
233 |
|
sl@0
|
234 |
__UHEAP_MARKEND;
|
sl@0
|
235 |
}while (err == KErrNoMemory);
|
sl@0
|
236 |
|
sl@0
|
237 |
test(err == KErrNone);
|
sl@0
|
238 |
INFO_PRINTF2(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
|
sl@0
|
239 |
}
|
sl@0
|
240 |
|
sl@0
|
241 |
|
sl@0
|
242 |
void CT_CP54936::PerformanceTest1L()
|
sl@0
|
243 |
{
|
sl@0
|
244 |
INFO_PRINTF1(_L("Performance test 1 (comparing with cp936)"));
|
sl@0
|
245 |
RLibrary lib936;
|
sl@0
|
246 |
RLibrary lib54936;
|
sl@0
|
247 |
|
sl@0
|
248 |
const TUidType serverUid936(KNullUid,KNullUid,KPluginUid936);
|
sl@0
|
249 |
const TUidType serverUid54936(KNullUid,KNullUid,KPluginUid);
|
sl@0
|
250 |
|
sl@0
|
251 |
// load the dll
|
sl@0
|
252 |
TInt returnValue = lib936.Load(KName936,serverUid936);
|
sl@0
|
253 |
test(returnValue==0);
|
sl@0
|
254 |
TInt returnValue2 = lib54936.Load(KName,serverUid54936);
|
sl@0
|
255 |
test(returnValue2==0);
|
sl@0
|
256 |
|
sl@0
|
257 |
// get a pointer to the specified ordinal function and call it
|
sl@0
|
258 |
TLibraryFunction function9361 = lib936.Lookup(1);
|
sl@0
|
259 |
TLibraryFunction function9362 = lib936.Lookup(2);
|
sl@0
|
260 |
TLibraryFunction function9363 = lib936.Lookup(3);
|
sl@0
|
261 |
TLibraryFunction function549361 = lib54936.Lookup(1);
|
sl@0
|
262 |
TLibraryFunction function549362 = lib54936.Lookup(2);
|
sl@0
|
263 |
TLibraryFunction function549363 = lib54936.Lookup(3);
|
sl@0
|
264 |
|
sl@0
|
265 |
//cast the function pointer f to a function of type void with two arguments
|
sl@0
|
266 |
typedef void (*TConvertFromUnicodeL)(TDes8&, const TDesC16&);
|
sl@0
|
267 |
TConvertFromUnicodeL aConvertFromUnicode936L = reinterpret_cast <TConvertFromUnicodeL> (function9361);
|
sl@0
|
268 |
TConvertFromUnicodeL aConvertFromUnicode54936L = reinterpret_cast <TConvertFromUnicodeL> (function549361);
|
sl@0
|
269 |
|
sl@0
|
270 |
typedef void (*TConvertToUnicodeL)(TDes16&, const TDesC8&);
|
sl@0
|
271 |
TConvertToUnicodeL aConvertToUnicode936L = reinterpret_cast <TConvertToUnicodeL> (function9362);
|
sl@0
|
272 |
TConvertToUnicodeL aConvertToUnicode54936L = reinterpret_cast <TConvertToUnicodeL> (function549362);
|
sl@0
|
273 |
|
sl@0
|
274 |
// timer
|
sl@0
|
275 |
TInt count;
|
sl@0
|
276 |
TChar res2;
|
sl@0
|
277 |
TBuf<256> msg;
|
sl@0
|
278 |
TInt fastTimerFreq;
|
sl@0
|
279 |
HAL::Get(HALData::EFastCounterFrequency, fastTimerFreq);
|
sl@0
|
280 |
TReal ticksPerMicroSec = 1.0E-6 * fastTimerFreq;
|
sl@0
|
281 |
TUint prevTime;
|
sl@0
|
282 |
TUint timeDiff;
|
sl@0
|
283 |
TReal64 fsSessionMicroSecs;
|
sl@0
|
284 |
|
sl@0
|
285 |
_LIT16(Uni_1, "\x0053\x0059\x004D\x3125\x3122\x9673\xFA29");
|
sl@0
|
286 |
_LIT8(CP54936_1, "\x53\x59\x4D\xA8\xE5\xA8\xE2\xEA\x90\xFE\x4F");
|
sl@0
|
287 |
TBuf8<20> foreign1;
|
sl@0
|
288 |
TBuf16<20> unicode2;
|
sl@0
|
289 |
const TDesC16& unicode1(Uni_1);
|
sl@0
|
290 |
TInt error;
|
sl@0
|
291 |
|
sl@0
|
292 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
293 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
294 |
// 1, unicode -> 936
|
sl@0
|
295 |
// test result: 1448 ms for 100000 iterations
|
sl@0
|
296 |
INFO_PRINTF1(_L("unicode --> 936:\n"));
|
sl@0
|
297 |
INFO_PRINTF1(_L(" source: ")); TestOut(unicode1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
298 |
INFO_PRINTF1(_L(" expect: ")); TestOut(CP54936_1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
299 |
prevTime = User::FastCounter();
|
sl@0
|
300 |
for (count=0; count<MaxCount; count++)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
foreign1.Zero();
|
sl@0
|
303 |
(*aConvertFromUnicode936L)(foreign1, unicode1);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
timeDiff = User::FastCounter() - prevTime;
|
sl@0
|
306 |
fsSessionMicroSecs = timeDiff / (ticksPerMicroSec);
|
sl@0
|
307 |
msg.Format(_L(" %10.2lf us, "), fsSessionMicroSecs);
|
sl@0
|
308 |
INFO_PRINTF1(_L(" result: ")); TestOut(foreign1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
309 |
INFO_PRINTF1(msg);
|
sl@0
|
310 |
error = foreign1.Compare(CP54936_1);
|
sl@0
|
311 |
test(error==0);
|
sl@0
|
312 |
foreign1.Zero();
|
sl@0
|
313 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
314 |
|
sl@0
|
315 |
// 2, unicode -> 54936
|
sl@0
|
316 |
// test result: 44 ms for 100000 iterations
|
sl@0
|
317 |
INFO_PRINTF1(_L("unicode --> 54936:\n"));
|
sl@0
|
318 |
INFO_PRINTF1(_L(" source: ")); TestOut(unicode1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
319 |
INFO_PRINTF1(_L(" expect: ")); TestOut(CP54936_1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
320 |
prevTime = User::FastCounter();
|
sl@0
|
321 |
for (count=0; count<MaxCount; count++)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
foreign1.Zero();
|
sl@0
|
324 |
(*aConvertFromUnicode54936L)(foreign1, unicode1);
|
sl@0
|
325 |
}
|
sl@0
|
326 |
timeDiff = User::FastCounter() - prevTime;
|
sl@0
|
327 |
fsSessionMicroSecs = timeDiff / (ticksPerMicroSec);
|
sl@0
|
328 |
msg.Format(_L(" %10.2lf us, "), fsSessionMicroSecs);
|
sl@0
|
329 |
INFO_PRINTF1(_L(" result: ")); TestOut(foreign1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
330 |
INFO_PRINTF1(msg);
|
sl@0
|
331 |
error = foreign1.Compare(CP54936_1);
|
sl@0
|
332 |
test(error==0);
|
sl@0
|
333 |
foreign1.Zero();
|
sl@0
|
334 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
335 |
|
sl@0
|
336 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
337 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
338 |
_LIT16(Uni_2, "\x0032\xFFFD\x7FB1\x0032\xFFFD\x7FB1\x7FB1");
|
sl@0
|
339 |
_LIT8(CP54936_2, "\x32\xC1\x7F\xC1\x7E\x32\xC1\x7F\xC1\x7E\xC1\x7E");
|
sl@0
|
340 |
const TDesC8& foreign2(CP54936_2);
|
sl@0
|
341 |
|
sl@0
|
342 |
// 3, 936 -> unicode
|
sl@0
|
343 |
// test result: 89 ms for 100000 iterations
|
sl@0
|
344 |
INFO_PRINTF1(_L("936 ---> unicode:\n"));
|
sl@0
|
345 |
INFO_PRINTF1(_L(" source: ")); TestOut(foreign2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
346 |
INFO_PRINTF1(_L(" expect: ")); TestOut(Uni_2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
347 |
prevTime = User::FastCounter();
|
sl@0
|
348 |
for (count=0; count<MaxCount; count++)
|
sl@0
|
349 |
{
|
sl@0
|
350 |
unicode2.Zero();
|
sl@0
|
351 |
(*aConvertToUnicode936L)(unicode2,foreign2);
|
sl@0
|
352 |
}
|
sl@0
|
353 |
timeDiff = User::FastCounter() - prevTime;
|
sl@0
|
354 |
fsSessionMicroSecs = timeDiff / (ticksPerMicroSec);
|
sl@0
|
355 |
msg.Format(_L(" %10.2lf us, "), fsSessionMicroSecs);
|
sl@0
|
356 |
INFO_PRINTF1(_L(" result: ")); TestOut(unicode2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
357 |
INFO_PRINTF1(msg);
|
sl@0
|
358 |
error = unicode2.Compare(Uni_2);
|
sl@0
|
359 |
test(error==0);
|
sl@0
|
360 |
unicode2.Zero();
|
sl@0
|
361 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
362 |
|
sl@0
|
363 |
// 4, 54936 -> unicode
|
sl@0
|
364 |
// test result: 36 ms for 100000 iterations
|
sl@0
|
365 |
INFO_PRINTF1(_L("54936 ---> unicode:\n"));
|
sl@0
|
366 |
INFO_PRINTF1(_L(" source: ")); TestOut(foreign2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
367 |
INFO_PRINTF1(_L(" expect: ")); TestOut(Uni_2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
368 |
prevTime = User::FastCounter();
|
sl@0
|
369 |
for (count=0; count<MaxCount; count++)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
unicode2.Zero();
|
sl@0
|
372 |
(*aConvertToUnicode54936L)(unicode2,foreign2);
|
sl@0
|
373 |
}
|
sl@0
|
374 |
timeDiff = User::FastCounter() - prevTime;
|
sl@0
|
375 |
fsSessionMicroSecs = timeDiff / (ticksPerMicroSec);
|
sl@0
|
376 |
msg.Format(_L(" %10.2lf us, "), fsSessionMicroSecs);
|
sl@0
|
377 |
INFO_PRINTF1(_L(" result: ")); TestOut(unicode2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
378 |
INFO_PRINTF1(msg);
|
sl@0
|
379 |
error = unicode2.Compare(Uni_2);
|
sl@0
|
380 |
test(error==0);
|
sl@0
|
381 |
unicode2.Zero();
|
sl@0
|
382 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
383 |
|
sl@0
|
384 |
lib936.Close();
|
sl@0
|
385 |
lib54936.Close();
|
sl@0
|
386 |
|
sl@0
|
387 |
// INFO_PRINTF1(_L("Press any key...\n"));
|
sl@0
|
388 |
// test.Getch();
|
sl@0
|
389 |
}
|
sl@0
|
390 |
|
sl@0
|
391 |
|
sl@0
|
392 |
// performance when converting mixed data.
|
sl@0
|
393 |
// just for reference.
|
sl@0
|
394 |
// ideally, the test result should be similar to that in PerformanceTest1()
|
sl@0
|
395 |
void CT_CP54936::PerformanceTest2L()
|
sl@0
|
396 |
{
|
sl@0
|
397 |
INFO_PRINTF1(_L("Performance test 2 (reference)"));
|
sl@0
|
398 |
RLibrary lib54936;
|
sl@0
|
399 |
const TUidType serverUid54936(KNullUid,KNullUid,KPluginUid);
|
sl@0
|
400 |
|
sl@0
|
401 |
// load the dll
|
sl@0
|
402 |
TInt returnValue2 = lib54936.Load(KName,serverUid54936);
|
sl@0
|
403 |
test(returnValue2==0);
|
sl@0
|
404 |
|
sl@0
|
405 |
// get a pointer to the specified ordinal function and call it
|
sl@0
|
406 |
TLibraryFunction function549361 = lib54936.Lookup(1);
|
sl@0
|
407 |
TLibraryFunction function549362 = lib54936.Lookup(2);
|
sl@0
|
408 |
TLibraryFunction function549363 = lib54936.Lookup(3);
|
sl@0
|
409 |
|
sl@0
|
410 |
//cast the function pointer f to a function of type void with two arguments
|
sl@0
|
411 |
typedef void (*TConvertFromUnicodeL)(TDes8&, const TDesC16&);
|
sl@0
|
412 |
TConvertFromUnicodeL aConvertFromUnicode54936L = reinterpret_cast <TConvertFromUnicodeL> (function549361);
|
sl@0
|
413 |
|
sl@0
|
414 |
typedef void (*TConvertToUnicodeL)(TDes16&, const TDesC8&);
|
sl@0
|
415 |
TConvertToUnicodeL aConvertToUnicode54936L = reinterpret_cast <TConvertToUnicodeL> (function549362);
|
sl@0
|
416 |
|
sl@0
|
417 |
// timer
|
sl@0
|
418 |
TInt count;
|
sl@0
|
419 |
TBuf<256> msg;
|
sl@0
|
420 |
TInt fastTimerFreq;
|
sl@0
|
421 |
HAL::Get(HALData::EFastCounterFrequency, fastTimerFreq);
|
sl@0
|
422 |
TReal ticksPerMicroSec = 1.0E-6 * fastTimerFreq;
|
sl@0
|
423 |
TUint prevTime;
|
sl@0
|
424 |
TUint timeDiff;
|
sl@0
|
425 |
TReal64 fsSessionMicroSecs;
|
sl@0
|
426 |
|
sl@0
|
427 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
428 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
429 |
_LIT16(Uni_1, "\x0053\x0059\x004D\x3125\x3122\x9673\xFA29\x060C\xD840\xDC00");
|
sl@0
|
430 |
_LIT8(CP54936_1, "\x53\x59\x4D\xA8\xE5\xA8\xE2\xEA\x90\xFE\x4F\x81\x31\x81\x32\x95\x32\x82\x36");
|
sl@0
|
431 |
TBuf8<200> foreign1;
|
sl@0
|
432 |
TBuf16<200> unicode2;
|
sl@0
|
433 |
const TDesC16& unicode1(Uni_1);
|
sl@0
|
434 |
TInt error;
|
sl@0
|
435 |
|
sl@0
|
436 |
// 2, unicode -> 54936
|
sl@0
|
437 |
// test result: 130 ms for 100000 iterations (44 ms if one huge table for BMP characters)
|
sl@0
|
438 |
INFO_PRINTF1(_L("unicode --> 54936:\n"));
|
sl@0
|
439 |
INFO_PRINTF1(_L(" source: ")); TestOut(unicode1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
440 |
INFO_PRINTF1(_L(" expect: ")); TestOut(CP54936_1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
441 |
prevTime = User::FastCounter();
|
sl@0
|
442 |
for (count=0; count<MaxCount; count++)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
foreign1.Zero();
|
sl@0
|
445 |
(*aConvertFromUnicode54936L)(foreign1, unicode1);
|
sl@0
|
446 |
}
|
sl@0
|
447 |
timeDiff = User::FastCounter() - prevTime;
|
sl@0
|
448 |
fsSessionMicroSecs = timeDiff / (ticksPerMicroSec);
|
sl@0
|
449 |
msg.Format(_L(" %10.2lf us, "), fsSessionMicroSecs);
|
sl@0
|
450 |
INFO_PRINTF1(_L(" result: ")); TestOut(foreign1); INFO_PRINTF1(_L("\n"));
|
sl@0
|
451 |
INFO_PRINTF1(msg);
|
sl@0
|
452 |
error = foreign1.Compare(CP54936_1);
|
sl@0
|
453 |
test(error==0);
|
sl@0
|
454 |
foreign1.Zero();
|
sl@0
|
455 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
456 |
|
sl@0
|
457 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
458 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
459 |
_LIT16(Uni_2, "\x0032\x20AC\xFFFD\x7FB1\x47BB\xD840\xDC00");
|
sl@0
|
460 |
_LIT8(CP54936_2, "\x32\xA2\xE3\xC1\x7F\xC1\x7E\x82\x33\xED\x33\x95\x32\x82\x36");
|
sl@0
|
461 |
const TDesC8& foreign2(CP54936_2);
|
sl@0
|
462 |
|
sl@0
|
463 |
// 4, 54936 -> unicode
|
sl@0
|
464 |
// test result: 36 ms for 100000 iterations
|
sl@0
|
465 |
INFO_PRINTF1(_L("54936 ---> unicode:\n"));
|
sl@0
|
466 |
INFO_PRINTF1(_L(" source: ")); TestOut(foreign2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
467 |
INFO_PRINTF1(_L(" expect: ")); TestOut(Uni_2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
468 |
prevTime = User::FastCounter();
|
sl@0
|
469 |
for (count=0; count<MaxCount; count++)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
unicode2.Zero();
|
sl@0
|
472 |
(*aConvertToUnicode54936L)(unicode2,foreign2);
|
sl@0
|
473 |
}
|
sl@0
|
474 |
timeDiff = User::FastCounter() - prevTime;
|
sl@0
|
475 |
fsSessionMicroSecs = timeDiff / (ticksPerMicroSec);
|
sl@0
|
476 |
msg.Format(_L(" %10.2lf us, "), fsSessionMicroSecs);
|
sl@0
|
477 |
INFO_PRINTF1(_L(" result: ")); TestOut(unicode2); INFO_PRINTF1(_L("\n"));
|
sl@0
|
478 |
INFO_PRINTF1(msg);
|
sl@0
|
479 |
error = unicode2.Compare(Uni_2);
|
sl@0
|
480 |
test(error==0);
|
sl@0
|
481 |
unicode2.Zero();
|
sl@0
|
482 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
483 |
|
sl@0
|
484 |
lib54936.Close();
|
sl@0
|
485 |
|
sl@0
|
486 |
// INFO_PRINTF1(_L("Press any key...\n"));
|
sl@0
|
487 |
// test.Getch();
|
sl@0
|
488 |
}
|
sl@0
|
489 |
|
sl@0
|
490 |
/**
|
sl@0
|
491 |
@SYMTestCaseID TI18N-FATCHARCONV-CIT-4001
|
sl@0
|
492 |
@SYMTestCaseDesc Check GB18030 support
|
sl@0
|
493 |
@SYMTestPriority High
|
sl@0
|
494 |
@SYMTestActions 1. Get one-byte Unicode codepoint
|
sl@0
|
495 |
2. Convert to/from GB18030 to/from Unicode
|
sl@0
|
496 |
3. Get two-byte Unicode codepoint
|
sl@0
|
497 |
4. Convert to/from GB18030 to/from Unicode
|
sl@0
|
498 |
5. Get four-byte Unicode codepoint
|
sl@0
|
499 |
6. Convert to/from GB18030 to/from Unicode
|
sl@0
|
500 |
@SYMTestExpectedResults No side effect
|
sl@0
|
501 |
@SYMREQ REQ12067
|
sl@0
|
502 |
*/
|
sl@0
|
503 |
void CT_CP54936::TestConversionL( const TDesC16& aUnicode, const TDesC8& a54936, TBool aZero1, TBool aZero2)
|
sl@0
|
504 |
{
|
sl@0
|
505 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1778 "));
|
sl@0
|
506 |
RLibrary lib;
|
sl@0
|
507 |
|
sl@0
|
508 |
const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
|
sl@0
|
509 |
// load the dll
|
sl@0
|
510 |
TInt returnValue = lib.Load(KName,serverUid);
|
sl@0
|
511 |
test(returnValue==0);
|
sl@0
|
512 |
|
sl@0
|
513 |
// get a pointer to the specified ordinal function and call it
|
sl@0
|
514 |
TLibraryFunction function1 = lib.Lookup(1);
|
sl@0
|
515 |
TLibraryFunction function2 = lib.Lookup(2);
|
sl@0
|
516 |
TLibraryFunction function3 = lib.Lookup(3);
|
sl@0
|
517 |
|
sl@0
|
518 |
//cast the function pointer f to a function of type void with two arguments
|
sl@0
|
519 |
typedef void (*TConvertFromUnicodeL)(TDes8&, const TDesC16&);
|
sl@0
|
520 |
TConvertFromUnicodeL aConvertFromUnicodeL = reinterpret_cast <TConvertFromUnicodeL> (function1);
|
sl@0
|
521 |
|
sl@0
|
522 |
typedef void (*TConvertToUnicodeL)(TDes16&, const TDesC8&);
|
sl@0
|
523 |
TConvertToUnicodeL aConvertToUnicodeL = reinterpret_cast <TConvertToUnicodeL> (function2);
|
sl@0
|
524 |
|
sl@0
|
525 |
// testing conversion from Unicode
|
sl@0
|
526 |
TBuf8<200> generated54936;
|
sl@0
|
527 |
INFO_PRINTF1(_L("source: "));
|
sl@0
|
528 |
TestOut(aUnicode);
|
sl@0
|
529 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
530 |
INFO_PRINTF1(_L("expect: "));
|
sl@0
|
531 |
TestOut(a54936);
|
sl@0
|
532 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
533 |
(*aConvertFromUnicodeL)(generated54936, aUnicode);
|
sl@0
|
534 |
INFO_PRINTF1(_L("result: "));
|
sl@0
|
535 |
TestOut(generated54936);
|
sl@0
|
536 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
537 |
TInt error = generated54936.Compare(a54936);
|
sl@0
|
538 |
if ( aZero1 )
|
sl@0
|
539 |
{
|
sl@0
|
540 |
test(error==0);
|
sl@0
|
541 |
}
|
sl@0
|
542 |
else
|
sl@0
|
543 |
{
|
sl@0
|
544 |
test(error!=0);
|
sl@0
|
545 |
}
|
sl@0
|
546 |
|
sl@0
|
547 |
// testing conversion to Unicode
|
sl@0
|
548 |
TBuf16<200> generatedUnicode;
|
sl@0
|
549 |
INFO_PRINTF1(_L("source: "));
|
sl@0
|
550 |
TestOut(a54936);
|
sl@0
|
551 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
552 |
INFO_PRINTF1(_L("expect: "));
|
sl@0
|
553 |
TestOut(aUnicode);
|
sl@0
|
554 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
555 |
(*aConvertToUnicodeL)(generatedUnicode,a54936);
|
sl@0
|
556 |
INFO_PRINTF1(_L("result: "));
|
sl@0
|
557 |
TestOut(generatedUnicode);
|
sl@0
|
558 |
INFO_PRINTF1(_L("\n"));
|
sl@0
|
559 |
error = generatedUnicode.Compare(aUnicode);
|
sl@0
|
560 |
if ( aZero2 )
|
sl@0
|
561 |
{
|
sl@0
|
562 |
test(error==0);
|
sl@0
|
563 |
}
|
sl@0
|
564 |
else
|
sl@0
|
565 |
{
|
sl@0
|
566 |
test(error!=0);
|
sl@0
|
567 |
}
|
sl@0
|
568 |
|
sl@0
|
569 |
lib.Close();
|
sl@0
|
570 |
}
|
sl@0
|
571 |
|
sl@0
|
572 |
|
sl@0
|
573 |
/**
|
sl@0
|
574 |
@SYMTestCaseID TI18N-CHARCONV-CT-
|
sl@0
|
575 |
@SYMTestCaseDesc Check GB18030 support
|
sl@0
|
576 |
@SYMTestPriority High
|
sl@0
|
577 |
@SYMTestActions 1. Get one-byte Unicode codepoint
|
sl@0
|
578 |
2. Convert to/from GB18030 to/from Unicode
|
sl@0
|
579 |
3. Get two-byte Unicode codepoint
|
sl@0
|
580 |
4. Convert to/from GB18030 to/from Unicode
|
sl@0
|
581 |
5. Get four-byte Unicode codepoint
|
sl@0
|
582 |
6. Convert to/from GB18030 to/from Unicode
|
sl@0
|
583 |
@SYMTestExpectedResults No side effect
|
sl@0
|
584 |
@SYMREQ REQ12067
|
sl@0
|
585 |
*/
|
sl@0
|
586 |
void CT_CP54936::TestGbConversionL()
|
sl@0
|
587 |
{
|
sl@0
|
588 |
// TestL() function covers GB 1,2,4 bytes
|
sl@0
|
589 |
// one-byte
|
sl@0
|
590 |
// border 0x80
|
sl@0
|
591 |
_LIT16(Uni_0, "\x0000");
|
sl@0
|
592 |
_LIT8(CP54936_0, "\x00");
|
sl@0
|
593 |
TestConversionL( Uni_0, CP54936_0 );
|
sl@0
|
594 |
|
sl@0
|
595 |
_LIT16(Uni_1, "\x0079");
|
sl@0
|
596 |
_LIT8(CP54936_1, "\x79");
|
sl@0
|
597 |
TestConversionL( Uni_1, CP54936_1 );
|
sl@0
|
598 |
|
sl@0
|
599 |
_LIT16(Uni_2, "\x0080");
|
sl@0
|
600 |
_LIT8(CP54936_2, "\x81\x30\x81\x30");
|
sl@0
|
601 |
TestConversionL( Uni_2, CP54936_2 );
|
sl@0
|
602 |
|
sl@0
|
603 |
_LIT16(Uni_3, "\x0081");
|
sl@0
|
604 |
_LIT8(CP54936_3, "\x81\x30\x81\x31");
|
sl@0
|
605 |
TestConversionL( Uni_3, CP54936_3 );
|
sl@0
|
606 |
|
sl@0
|
607 |
_LIT16(Uni_4, "\x00fe");
|
sl@0
|
608 |
_LIT8(CP54936_4, "\x81\x30\x8B\x36");
|
sl@0
|
609 |
TestConversionL( Uni_4, CP54936_4 );
|
sl@0
|
610 |
|
sl@0
|
611 |
_LIT16(Uni_5, "\x00ff");
|
sl@0
|
612 |
_LIT8(CP54936_5, "\x81\x30\x8B\x37");
|
sl@0
|
613 |
TestConversionL( Uni_5, CP54936_5 );
|
sl@0
|
614 |
|
sl@0
|
615 |
// two-byte
|
sl@0
|
616 |
_LIT16(Uni_6, "\x0100");
|
sl@0
|
617 |
_LIT8(CP54936_6, "\x81\x30\x8B\x38");
|
sl@0
|
618 |
TestConversionL( Uni_6, CP54936_6 );
|
sl@0
|
619 |
|
sl@0
|
620 |
_LIT16(Uni_7, "\x0101");
|
sl@0
|
621 |
_LIT8(CP54936_7, "\xA8\xA1");
|
sl@0
|
622 |
TestConversionL( Uni_7, CP54936_7 );
|
sl@0
|
623 |
|
sl@0
|
624 |
_LIT16(Uni_8, "\x0ffe");
|
sl@0
|
625 |
_LIT8(CP54936_8, "\x81\x33\x83\x38");
|
sl@0
|
626 |
TestConversionL( Uni_8, CP54936_8 );
|
sl@0
|
627 |
|
sl@0
|
628 |
_LIT16(Uni_9, "\x0fff");
|
sl@0
|
629 |
_LIT8(CP54936_9, "\x81\x33\x83\x39");
|
sl@0
|
630 |
TestConversionL( Uni_9, CP54936_9 );
|
sl@0
|
631 |
|
sl@0
|
632 |
_LIT16(Uni_10, "\x1000");
|
sl@0
|
633 |
_LIT8(CP54936_10, "\x81\x33\x84\x30");
|
sl@0
|
634 |
TestConversionL( Uni_10, CP54936_10 );
|
sl@0
|
635 |
|
sl@0
|
636 |
_LIT16(Uni_11, "\x1001");
|
sl@0
|
637 |
_LIT8(CP54936_11, "\x81\x33\x84\x31");
|
sl@0
|
638 |
TestConversionL( Uni_11, CP54936_11 );
|
sl@0
|
639 |
|
sl@0
|
640 |
_LIT16(Uni_12, "\xfffe");
|
sl@0
|
641 |
_LIT8(CP54936_12, "\x84\x31\xA4\x38");
|
sl@0
|
642 |
TestConversionL( Uni_12, CP54936_12 );
|
sl@0
|
643 |
|
sl@0
|
644 |
_LIT16(Uni_13, "\xffff");
|
sl@0
|
645 |
_LIT8(CP54936_13, "\x84\x31\xA4\x39");
|
sl@0
|
646 |
TestConversionL( Uni_13, CP54936_13 );
|
sl@0
|
647 |
|
sl@0
|
648 |
// four-byte
|
sl@0
|
649 |
_LIT16(Uni_14, "\xd840\xdc00");
|
sl@0
|
650 |
_LIT8(CP54936_14, "\x95\x32\x82\x36");
|
sl@0
|
651 |
TestConversionL( Uni_14, CP54936_14 );
|
sl@0
|
652 |
|
sl@0
|
653 |
_LIT16(Uni_15, "\xd840\xdc01");
|
sl@0
|
654 |
_LIT8(CP54936_15, "\x95\x32\x82\x37");
|
sl@0
|
655 |
TestConversionL( Uni_15, CP54936_15 );
|
sl@0
|
656 |
|
sl@0
|
657 |
_LIT16(Uni_16, "\xD87F\xdffe");
|
sl@0
|
658 |
_LIT8(CP54936_16, "\x9a\x34\x84\x30");
|
sl@0
|
659 |
TestConversionL( Uni_16, CP54936_16 );
|
sl@0
|
660 |
|
sl@0
|
661 |
_LIT16(Uni_17, "\xD87F\xdfff");
|
sl@0
|
662 |
_LIT8(CP54936_17, "\x9a\x34\x84\x31");
|
sl@0
|
663 |
TestConversionL( Uni_17, CP54936_17 );
|
sl@0
|
664 |
|
sl@0
|
665 |
// 4-byte gb
|
sl@0
|
666 |
_LIT16(Uni_18, "\xd840\xddad");
|
sl@0
|
667 |
_LIT8(CP54936_18, "\x95\x32\xAD\x35");
|
sl@0
|
668 |
TestConversionL( Uni_18, CP54936_18 );
|
sl@0
|
669 |
|
sl@0
|
670 |
_LIT16(Uni_19, "\xd801\xdd00");
|
sl@0
|
671 |
_LIT8(CP54936_19, "\x90\x31\x83\x30");
|
sl@0
|
672 |
TestConversionL( Uni_19, CP54936_19 );
|
sl@0
|
673 |
}
|
sl@0
|
674 |
|
sl@0
|
675 |
|
sl@0
|
676 |
/**
|
sl@0
|
677 |
@SYMTestCaseID TI18N-CHARCONV-CT-
|
sl@0
|
678 |
@SYMTestCaseDesc Test FAT short name legal character
|
sl@0
|
679 |
@SYMTestPriority High
|
sl@0
|
680 |
@SYMTestActions 1. Get one-byte Unicode codepoint
|
sl@0
|
681 |
2. Check if it's legal short name character
|
sl@0
|
682 |
3. Get two-byte Unicode codepoint
|
sl@0
|
683 |
4. Check if it's legal short name character
|
sl@0
|
684 |
5. Get four-byte Unicode codepoint
|
sl@0
|
685 |
6. Check if it's legal short name character
|
sl@0
|
686 |
@SYMTestExpectedResults No side effect
|
sl@0
|
687 |
@SYMREQ REQ12067
|
sl@0
|
688 |
*/
|
sl@0
|
689 |
void CT_CP54936::TestShortNameCharacterL()
|
sl@0
|
690 |
{
|
sl@0
|
691 |
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1778 "));
|
sl@0
|
692 |
RLibrary lib;
|
sl@0
|
693 |
|
sl@0
|
694 |
const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
|
sl@0
|
695 |
// load the dll
|
sl@0
|
696 |
TInt returnValue = lib.Load(KName,serverUid);
|
sl@0
|
697 |
test(returnValue==0);
|
sl@0
|
698 |
|
sl@0
|
699 |
// get a pointer to the specified ordinal function and call it
|
sl@0
|
700 |
TLibraryFunction function1 = lib.Lookup(1);
|
sl@0
|
701 |
TLibraryFunction function2 = lib.Lookup(2);
|
sl@0
|
702 |
TLibraryFunction function3 = lib.Lookup(3);
|
sl@0
|
703 |
|
sl@0
|
704 |
typedef TBool (*TIsLegalShortNameCharacter)(TUint);
|
sl@0
|
705 |
TIsLegalShortNameCharacter aIsLegalShortNameCharacter = reinterpret_cast <TIsLegalShortNameCharacter> (function3);
|
sl@0
|
706 |
|
sl@0
|
707 |
// testing for legal short name character
|
sl@0
|
708 |
// one-byte unicode
|
sl@0
|
709 |
// 0x20 is space
|
sl@0
|
710 |
TInt result = (*aIsLegalShortNameCharacter)(0x0019);
|
sl@0
|
711 |
test(result==0);
|
sl@0
|
712 |
|
sl@0
|
713 |
result = (*aIsLegalShortNameCharacter)(0x0020);
|
sl@0
|
714 |
test(result==0);
|
sl@0
|
715 |
|
sl@0
|
716 |
result = (*aIsLegalShortNameCharacter)(0x0021);
|
sl@0
|
717 |
test(result==1);
|
sl@0
|
718 |
|
sl@0
|
719 |
result = (*aIsLegalShortNameCharacter)(0x005F);
|
sl@0
|
720 |
test(result==1);
|
sl@0
|
721 |
|
sl@0
|
722 |
// 0x80 is ascii border
|
sl@0
|
723 |
result = (*aIsLegalShortNameCharacter)(0x0079);
|
sl@0
|
724 |
test(result==1);
|
sl@0
|
725 |
|
sl@0
|
726 |
result = (*aIsLegalShortNameCharacter)(0x0080);
|
sl@0
|
727 |
test(result==1);
|
sl@0
|
728 |
|
sl@0
|
729 |
result = (*aIsLegalShortNameCharacter)(0x0081);
|
sl@0
|
730 |
test(result==1);
|
sl@0
|
731 |
|
sl@0
|
732 |
// testing for illegal character
|
sl@0
|
733 |
result = (*aIsLegalShortNameCharacter)(0x003F);
|
sl@0
|
734 |
test(result==0);
|
sl@0
|
735 |
|
sl@0
|
736 |
result = (*aIsLegalShortNameCharacter)(0x22);
|
sl@0
|
737 |
test(result==0);
|
sl@0
|
738 |
|
sl@0
|
739 |
result = (*aIsLegalShortNameCharacter)(0x2A);
|
sl@0
|
740 |
test(result==0);
|
sl@0
|
741 |
|
sl@0
|
742 |
result = (*aIsLegalShortNameCharacter)(0x2B);
|
sl@0
|
743 |
test(result==0);
|
sl@0
|
744 |
|
sl@0
|
745 |
result = (*aIsLegalShortNameCharacter)(0x2C);
|
sl@0
|
746 |
test(result==0);
|
sl@0
|
747 |
|
sl@0
|
748 |
result = (*aIsLegalShortNameCharacter)(0x2F);
|
sl@0
|
749 |
test(result==0);
|
sl@0
|
750 |
|
sl@0
|
751 |
result = (*aIsLegalShortNameCharacter)(0x3A);
|
sl@0
|
752 |
test(result==0);
|
sl@0
|
753 |
|
sl@0
|
754 |
result = (*aIsLegalShortNameCharacter)(0x3B);
|
sl@0
|
755 |
test(result==0);
|
sl@0
|
756 |
|
sl@0
|
757 |
result = (*aIsLegalShortNameCharacter)(0x3C);
|
sl@0
|
758 |
test(result==0);
|
sl@0
|
759 |
|
sl@0
|
760 |
result = (*aIsLegalShortNameCharacter)(0x3D);
|
sl@0
|
761 |
test(result==0);
|
sl@0
|
762 |
|
sl@0
|
763 |
result = (*aIsLegalShortNameCharacter)(0x3E);
|
sl@0
|
764 |
test(result==0);
|
sl@0
|
765 |
|
sl@0
|
766 |
result = (*aIsLegalShortNameCharacter)(0x5B);
|
sl@0
|
767 |
test(result==0);
|
sl@0
|
768 |
|
sl@0
|
769 |
result = (*aIsLegalShortNameCharacter)(0x5C);
|
sl@0
|
770 |
test(result==0);
|
sl@0
|
771 |
|
sl@0
|
772 |
result = (*aIsLegalShortNameCharacter)(0x5D);
|
sl@0
|
773 |
test(result==0);
|
sl@0
|
774 |
|
sl@0
|
775 |
result = (*aIsLegalShortNameCharacter)(0x7C);
|
sl@0
|
776 |
test(result==0);
|
sl@0
|
777 |
|
sl@0
|
778 |
// two-byte unicode
|
sl@0
|
779 |
result = (*aIsLegalShortNameCharacter)(0x1000);
|
sl@0
|
780 |
test(result==1);
|
sl@0
|
781 |
|
sl@0
|
782 |
result = (*aIsLegalShortNameCharacter)(0x1001);
|
sl@0
|
783 |
test(result==1);
|
sl@0
|
784 |
|
sl@0
|
785 |
result = (*aIsLegalShortNameCharacter)(0x2999); //testing for non-existent character
|
sl@0
|
786 |
test(result==1);
|
sl@0
|
787 |
|
sl@0
|
788 |
result = (*aIsLegalShortNameCharacter)(0x4E02); //testing for a double byte character
|
sl@0
|
789 |
test(result==1);
|
sl@0
|
790 |
|
sl@0
|
791 |
result = (*aIsLegalShortNameCharacter)(0xfffe);
|
sl@0
|
792 |
test(result==1);
|
sl@0
|
793 |
|
sl@0
|
794 |
result = (*aIsLegalShortNameCharacter)(0xffff);
|
sl@0
|
795 |
test(result==1);
|
sl@0
|
796 |
|
sl@0
|
797 |
result = (*aIsLegalShortNameCharacter)(0xd7ff);
|
sl@0
|
798 |
test(result==1);
|
sl@0
|
799 |
|
sl@0
|
800 |
// surrogate part
|
sl@0
|
801 |
result = (*aIsLegalShortNameCharacter)(0xd800);
|
sl@0
|
802 |
test(result==0);
|
sl@0
|
803 |
|
sl@0
|
804 |
result = (*aIsLegalShortNameCharacter)(0xdfff);
|
sl@0
|
805 |
test(result==0);
|
sl@0
|
806 |
|
sl@0
|
807 |
result = (*aIsLegalShortNameCharacter)(0xe000);
|
sl@0
|
808 |
test(result==1);
|
sl@0
|
809 |
|
sl@0
|
810 |
// four-byte unicode
|
sl@0
|
811 |
result = (*aIsLegalShortNameCharacter)(0x10000);
|
sl@0
|
812 |
test(result==1);
|
sl@0
|
813 |
|
sl@0
|
814 |
result = (*aIsLegalShortNameCharacter)(0x10001);
|
sl@0
|
815 |
test(result==1);
|
sl@0
|
816 |
|
sl@0
|
817 |
result = (*aIsLegalShortNameCharacter)(0x10fffe);
|
sl@0
|
818 |
test(result==1);
|
sl@0
|
819 |
|
sl@0
|
820 |
result = (*aIsLegalShortNameCharacter)(0x10ffff);
|
sl@0
|
821 |
test(result==1);
|
sl@0
|
822 |
|
sl@0
|
823 |
result = (*aIsLegalShortNameCharacter)(0x110000);
|
sl@0
|
824 |
test(result==0);
|
sl@0
|
825 |
|
sl@0
|
826 |
lib.Close();
|
sl@0
|
827 |
}
|
sl@0
|
828 |
|
sl@0
|
829 |
|
sl@0
|
830 |
CT_CP54936::CT_CP54936()
|
sl@0
|
831 |
{
|
sl@0
|
832 |
SetTestStepName(KTestStep_T_CP54936);
|
sl@0
|
833 |
}
|
sl@0
|
834 |
|
sl@0
|
835 |
|
sl@0
|
836 |
TVerdict CT_CP54936::doTestStepL()
|
sl@0
|
837 |
{
|
sl@0
|
838 |
SetTestStepResult(EFail);
|
sl@0
|
839 |
|
sl@0
|
840 |
__UHEAP_MARK;
|
sl@0
|
841 |
|
sl@0
|
842 |
TRAPD(error1, TestGbConversionL());
|
sl@0
|
843 |
TRAPD(error2, TestShortNameCharacterL());
|
sl@0
|
844 |
TRAPD(error3, TestL());
|
sl@0
|
845 |
TRAPD(error4, TestINC090073L());
|
sl@0
|
846 |
TRAPD(error5, OOMTestL());
|
sl@0
|
847 |
TRAPD(error6, PerformanceTest1L());
|
sl@0
|
848 |
TRAPD(error7, PerformanceTest2L());
|
sl@0
|
849 |
|
sl@0
|
850 |
__UHEAP_MARKEND;
|
sl@0
|
851 |
|
sl@0
|
852 |
if(error1 == KErrNone && error2 == KErrNone && error3 == KErrNone
|
sl@0
|
853 |
&& error4 == KErrNone && error5 == KErrNone
|
sl@0
|
854 |
&& error6 == KErrNone && error7 == KErrNone)
|
sl@0
|
855 |
{
|
sl@0
|
856 |
SetTestStepResult(EPass);
|
sl@0
|
857 |
}
|
sl@0
|
858 |
|
sl@0
|
859 |
return TestStepResult();
|
sl@0
|
860 |
}
|