sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2009 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 |
#include <stdio.h>
|
sl@0
|
19 |
#include<e32std.h>
|
sl@0
|
20 |
#include "libutils.h"
|
sl@0
|
21 |
#include"std_log_result.h"
|
sl@0
|
22 |
#define LOG_FILENAME_LINE __FILE__, __LINE__
|
sl@0
|
23 |
#pragma diag_suppress 550
|
sl@0
|
24 |
int main()
|
sl@0
|
25 |
{
|
sl@0
|
26 |
bool assert_failed = false;
|
sl@0
|
27 |
__UHEAP_MARK;
|
sl@0
|
28 |
{
|
sl@0
|
29 |
string src1="testing";
|
sl@0
|
30 |
char tempChar[20];
|
sl@0
|
31 |
TPtr8 des1((unsigned char*)tempChar,20);
|
sl@0
|
32 |
int ret,size1=30,size2=42;
|
sl@0
|
33 |
int retval[50];
|
sl@0
|
34 |
retval[0] = StringToTptr8(src1, des1);
|
sl@0
|
35 |
|
sl@0
|
36 |
TPtr8 src2 = des1;
|
sl@0
|
37 |
char *des2= new char[20];
|
sl@0
|
38 |
retval[1]= Tptr8ToChar(src2,des2,size1);
|
sl@0
|
39 |
|
sl@0
|
40 |
char *src3=des2;
|
sl@0
|
41 |
wchar_t *aPtr= new wchar_t[20];
|
sl@0
|
42 |
wchar_t temp[30];
|
sl@0
|
43 |
TPtrC16 des3((unsigned short *)temp,30);
|
sl@0
|
44 |
retval[2]= CharpToTptrc16(src3,aPtr,des3);
|
sl@0
|
45 |
|
sl@0
|
46 |
TPtrC16 src4= des3;
|
sl@0
|
47 |
string des4="";
|
sl@0
|
48 |
retval[3]=Tptrc16ToString(src4,des4);
|
sl@0
|
49 |
|
sl@0
|
50 |
string src5=des4;
|
sl@0
|
51 |
HBufC16 *des5=HBufC16::NewMaxL(20);
|
sl@0
|
52 |
retval[4]= StringToHbufc16(src5,des5);
|
sl@0
|
53 |
|
sl@0
|
54 |
HBufC16 *src6=des5;
|
sl@0
|
55 |
string des6("");
|
sl@0
|
56 |
retval[5]= Hbufc16ToString(src6,des6,size1);
|
sl@0
|
57 |
|
sl@0
|
58 |
string src7=des4;
|
sl@0
|
59 |
HBufC8 *des7=HBufC8::NewMaxL(20);
|
sl@0
|
60 |
retval[6]= StringToHbufc8(src7,des7);
|
sl@0
|
61 |
|
sl@0
|
62 |
HBufC8 *src8=des7;
|
sl@0
|
63 |
char *des8=new char[20];
|
sl@0
|
64 |
retval[7]= Hbufc8ToChar(src8,des8,size1);
|
sl@0
|
65 |
|
sl@0
|
66 |
char *src9=des8;
|
sl@0
|
67 |
HBufC16 *des9=HBufC16::NewMaxL(20);
|
sl@0
|
68 |
retval[8]=CharToHbufc16(src9,des9);
|
sl@0
|
69 |
|
sl@0
|
70 |
HBufC16 *src10=des9;
|
sl@0
|
71 |
string des10="";
|
sl@0
|
72 |
retval[9]= Hbufc16ToString(src10,des10,size2);
|
sl@0
|
73 |
|
sl@0
|
74 |
string src11=des10;
|
sl@0
|
75 |
RBuf16 des11;
|
sl@0
|
76 |
des11.CreateL(30);
|
sl@0
|
77 |
retval[10]= StringToRbuf16(src11,des11);
|
sl@0
|
78 |
|
sl@0
|
79 |
RBuf16 src12;
|
sl@0
|
80 |
src12.Create(14);
|
sl@0
|
81 |
src12.Copy((unsigned short*)des11.Ptr(), 14);
|
sl@0
|
82 |
des11.Close();
|
sl@0
|
83 |
char *des12=new char[30];
|
sl@0
|
84 |
int size3=50;
|
sl@0
|
85 |
retval[11]= Rbuf16ToChar(src12,des12,size3);
|
sl@0
|
86 |
|
sl@0
|
87 |
char *src13=des12;
|
sl@0
|
88 |
RBuf16 des13;
|
sl@0
|
89 |
des13.CreateL(30);
|
sl@0
|
90 |
retval[12]=CharToRbuf16(src13,des13);
|
sl@0
|
91 |
|
sl@0
|
92 |
string des14;
|
sl@0
|
93 |
retval[13]=Rbuf16ToString(des13,des14);
|
sl@0
|
94 |
|
sl@0
|
95 |
string src15=des14;
|
sl@0
|
96 |
RBuf8 des15;
|
sl@0
|
97 |
des15.CreateL(30);
|
sl@0
|
98 |
retval[14]= StringToRbuf8(src15,des15);
|
sl@0
|
99 |
|
sl@0
|
100 |
RBuf8 src16;
|
sl@0
|
101 |
src16.Create(des15);
|
sl@0
|
102 |
char * des16= new char[61];
|
sl@0
|
103 |
retval[15]=Rbuf8ToChar(src16,des16,size1);
|
sl@0
|
104 |
|
sl@0
|
105 |
char *src17=des16;
|
sl@0
|
106 |
RBuf16 des17;
|
sl@0
|
107 |
des17.CreateL(30);
|
sl@0
|
108 |
retval[16]=CharToRbuf16(src17,des17);
|
sl@0
|
109 |
|
sl@0
|
110 |
RBuf16 src18;
|
sl@0
|
111 |
src18.Create(des17);
|
sl@0
|
112 |
wchar_t *des18= new wchar_t[70];
|
sl@0
|
113 |
retval[17]=Rbuf16ToWchar(src18,des18,size1);
|
sl@0
|
114 |
|
sl@0
|
115 |
wchar_t *src19=des18;
|
sl@0
|
116 |
RBuf8 des19;
|
sl@0
|
117 |
des19.CreateL(50);
|
sl@0
|
118 |
retval[18]=WcharToRbuf8(src19,des19);
|
sl@0
|
119 |
|
sl@0
|
120 |
wstring src20;
|
sl@0
|
121 |
retval[19] = Rbuf8ToWstring(des19,src20);
|
sl@0
|
122 |
|
sl@0
|
123 |
TBuf16 <100> des20;
|
sl@0
|
124 |
retval[20] = WstringToTbuf16(src20,des20);
|
sl@0
|
125 |
|
sl@0
|
126 |
wchar_t* src21= new wchar_t[100];
|
sl@0
|
127 |
int size_new=30;
|
sl@0
|
128 |
retval[21] = Tbuf16ToWchar(des20,src21,size_new);
|
sl@0
|
129 |
|
sl@0
|
130 |
RBuf16 des21;
|
sl@0
|
131 |
des21.CreateL(30);
|
sl@0
|
132 |
retval[22]= WcharToRbuf16(src21,des21);
|
sl@0
|
133 |
|
sl@0
|
134 |
wstring src22;
|
sl@0
|
135 |
retval[23]= Rbuf16ToWstring(des21,src22);
|
sl@0
|
136 |
|
sl@0
|
137 |
TBuf16 <100> des22;
|
sl@0
|
138 |
retval[24]= WstringToTbuf16(src22,des22);
|
sl@0
|
139 |
|
sl@0
|
140 |
wchar_t* src23= new wchar_t[100];
|
sl@0
|
141 |
int size=100;
|
sl@0
|
142 |
retval[25]= Tbuf16ToWchar(des22,src23,size);
|
sl@0
|
143 |
|
sl@0
|
144 |
RBuf8 des23;
|
sl@0
|
145 |
des23.CreateL(50);
|
sl@0
|
146 |
retval[26]= WcharToRbuf8(src23,des23);
|
sl@0
|
147 |
|
sl@0
|
148 |
wstring src24;
|
sl@0
|
149 |
retval[27]= Rbuf8ToWstring(des23,src24);
|
sl@0
|
150 |
|
sl@0
|
151 |
des23.Close();
|
sl@0
|
152 |
TBuf8 <100> des24;
|
sl@0
|
153 |
retval[28]= WstringToTbuf8(src24,des24);
|
sl@0
|
154 |
|
sl@0
|
155 |
wchar_t* des25 = new wchar_t[150];
|
sl@0
|
156 |
int size8=150;
|
sl@0
|
157 |
retval[29]= Tbuf8ToWchar(des24,des25,size8);
|
sl@0
|
158 |
|
sl@0
|
159 |
for(int i=1; i<=29; i++)
|
sl@0
|
160 |
{
|
sl@0
|
161 |
if (retval[i]!= 0)
|
sl@0
|
162 |
printf("Conversion failed for retval\n",retval[i]);
|
sl@0
|
163 |
}
|
sl@0
|
164 |
|
sl@0
|
165 |
ret= strncmp((char *)src1.c_str(),(char *)des24.Ptr(),7);
|
sl@0
|
166 |
if(ret == ESuccess)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
printf("integration_test_scenario_29 PASSED\n");
|
sl@0
|
169 |
}
|
sl@0
|
170 |
else
|
sl@0
|
171 |
{
|
sl@0
|
172 |
printf("integration_test_scenario_29 FAILED\n");
|
sl@0
|
173 |
assert_failed=true;
|
sl@0
|
174 |
}
|
sl@0
|
175 |
delete[] des2;
|
sl@0
|
176 |
delete[] des8;
|
sl@0
|
177 |
delete[] des12;
|
sl@0
|
178 |
delete[] aPtr;
|
sl@0
|
179 |
delete[] des16;
|
sl@0
|
180 |
delete[] des18;
|
sl@0
|
181 |
delete[] src21;
|
sl@0
|
182 |
delete[] src23;
|
sl@0
|
183 |
delete[] des25;
|
sl@0
|
184 |
delete des5;
|
sl@0
|
185 |
delete des7;
|
sl@0
|
186 |
delete des9;
|
sl@0
|
187 |
src12.Close();
|
sl@0
|
188 |
des13.Close();
|
sl@0
|
189 |
des15.Close();
|
sl@0
|
190 |
src16.Close();
|
sl@0
|
191 |
des17.Close();
|
sl@0
|
192 |
src18.Close();
|
sl@0
|
193 |
des19.Close();
|
sl@0
|
194 |
des21.Close();
|
sl@0
|
195 |
}
|
sl@0
|
196 |
__UHEAP_MARKEND;
|
sl@0
|
197 |
testResultXml("integration_test_scenario29");
|
sl@0
|
198 |
return 0;
|
sl@0
|
199 |
|
sl@0
|
200 |
}
|