|
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 __UHEAP_MARK; |
|
26 { |
|
27 int retval[10]; |
|
28 wchar_t* mycharstring = L"hello"; |
|
29 RBuf16 buf; |
|
30 retval[0]= WcharToRbuf16(mycharstring,buf); |
|
31 |
|
32 wstring str; |
|
33 retval[1]= Rbuf16ToWstring(buf,str); |
|
34 |
|
35 TPtr8 tptr8((unsigned char*)"",10,20); |
|
36 char* temp_c = new char[20]; |
|
37 retval[2]= WstringToTptr8(str,temp_c,tptr8); |
|
38 |
|
39 char* mychar = new char[30]; |
|
40 int size=30; |
|
41 retval[3]= Tptr8ToChar(tptr8,mychar,size); |
|
42 |
|
43 HBufC16 *hbufc = HBufC16::NewMaxL(20); |
|
44 retval[4]= CharToHbufc16(mychar,hbufc); |
|
45 |
|
46 string mystring; |
|
47 int size_hbufc=55; |
|
48 retval[5]= Hbufc16ToString(hbufc,mystring,size_hbufc); |
|
49 |
|
50 wchar_t* temp = new wchar_t[50]; |
|
51 TPtrC16 tptrc; |
|
52 retval[6]= StringToTptrc16(mystring,temp,tptrc); |
|
53 |
|
54 for(int i=1; i<=6; i++) |
|
55 { |
|
56 if (retval[i]!= 0) |
|
57 printf("Conversion failed for retval\n",retval[i]); |
|
58 } |
|
59 |
|
60 wchar_t* myfinalstring = new wchar_t[50]; |
|
61 int size_fin=55; |
|
62 retval[7]= Tptrc16ToWcharp(tptrc,myfinalstring,size_fin); |
|
63 |
|
64 if(!wcsncmp(mycharstring,myfinalstring,5)) |
|
65 { |
|
66 printf("\nintegration_test_scenario20 case passed"); |
|
67 } |
|
68 else |
|
69 { |
|
70 printf("\nintegration_test_scenario20 case failed"); |
|
71 assert_failed = true; |
|
72 } |
|
73 buf.Close(); |
|
74 delete[] temp_c; |
|
75 delete[] mychar; |
|
76 delete hbufc; |
|
77 delete[] temp; |
|
78 delete[] myfinalstring; |
|
79 } |
|
80 __UHEAP_MARKEND; |
|
81 testResultXml("integration_test_scenario20"); |
|
82 return 0; |
|
83 } |