equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <stdio.h> |
|
19 #include<e32std.h> |
|
20 #include "libutils.h" |
|
21 #include"std_log_result.h" |
|
22 #define LOG_FILENAME_LINE __FILE__, __LINE__ |
|
23 int main() |
|
24 { |
|
25 int retval =ESuccess, len = 0; |
|
26 wstring W(L"\xAE"); |
|
27 __UHEAP_MARK; |
|
28 TPtrC8 buf; |
|
29 char *temp = new char [23]; |
|
30 retval = WstringToTptrc8(W, temp, buf); |
|
31 if(retval == 0) |
|
32 printf("Conversion successful\n"); |
|
33 |
|
34 wchar_t *wChar = new wchar_t[2]; |
|
35 len = wcslen(W.c_str()); |
|
36 mbstowcs(wChar , (const char *)buf.Ptr(), len); |
|
37 wChar[1]= L'\0'; |
|
38 if (!wcscmp(wChar , L"\xAE")) |
|
39 { |
|
40 printf("wstringtotptrc8 Unicode Passed"); |
|
41 } |
|
42 else |
|
43 { |
|
44 assert_failed = true; |
|
45 printf("wstringtotptr8 Unicode Failed"); |
|
46 } |
|
47 delete[] wChar; |
|
48 delete[] temp; |
|
49 wChar = NULL; |
|
50 temp = NULL; |
|
51 __UHEAP_MARKEND; |
|
52 testResultXml("test_wstringtotptrc8_positive_unicode"); |
|
53 return 0; |
|
54 } |