1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/utilitylibraries/libutils/tsrc/src/integration_test_scenario29.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,200 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +#include <stdio.h>
1.22 +#include<e32std.h>
1.23 +#include "libutils.h"
1.24 +#include"std_log_result.h"
1.25 +#define LOG_FILENAME_LINE __FILE__, __LINE__
1.26 +#pragma diag_suppress 550
1.27 +int main()
1.28 +{
1.29 + bool assert_failed = false;
1.30 + __UHEAP_MARK;
1.31 + {
1.32 + string src1="testing";
1.33 + char tempChar[20];
1.34 + TPtr8 des1((unsigned char*)tempChar,20);
1.35 + int ret,size1=30,size2=42;
1.36 + int retval[50];
1.37 + retval[0] = StringToTptr8(src1, des1);
1.38 +
1.39 + TPtr8 src2 = des1;
1.40 + char *des2= new char[20];
1.41 + retval[1]= Tptr8ToChar(src2,des2,size1);
1.42 +
1.43 + char *src3=des2;
1.44 + wchar_t *aPtr= new wchar_t[20];
1.45 + wchar_t temp[30];
1.46 + TPtrC16 des3((unsigned short *)temp,30);
1.47 + retval[2]= CharpToTptrc16(src3,aPtr,des3);
1.48 +
1.49 + TPtrC16 src4= des3;
1.50 + string des4="";
1.51 + retval[3]=Tptrc16ToString(src4,des4);
1.52 +
1.53 + string src5=des4;
1.54 + HBufC16 *des5=HBufC16::NewMaxL(20);
1.55 + retval[4]= StringToHbufc16(src5,des5);
1.56 +
1.57 + HBufC16 *src6=des5;
1.58 + string des6("");
1.59 + retval[5]= Hbufc16ToString(src6,des6,size1);
1.60 +
1.61 + string src7=des4;
1.62 + HBufC8 *des7=HBufC8::NewMaxL(20);
1.63 + retval[6]= StringToHbufc8(src7,des7);
1.64 +
1.65 + HBufC8 *src8=des7;
1.66 + char *des8=new char[20];
1.67 + retval[7]= Hbufc8ToChar(src8,des8,size1);
1.68 +
1.69 + char *src9=des8;
1.70 + HBufC16 *des9=HBufC16::NewMaxL(20);
1.71 + retval[8]=CharToHbufc16(src9,des9);
1.72 +
1.73 + HBufC16 *src10=des9;
1.74 + string des10="";
1.75 + retval[9]= Hbufc16ToString(src10,des10,size2);
1.76 +
1.77 + string src11=des10;
1.78 + RBuf16 des11;
1.79 + des11.CreateL(30);
1.80 + retval[10]= StringToRbuf16(src11,des11);
1.81 +
1.82 + RBuf16 src12;
1.83 + src12.Create(14);
1.84 + src12.Copy((unsigned short*)des11.Ptr(), 14);
1.85 + des11.Close();
1.86 + char *des12=new char[30];
1.87 + int size3=50;
1.88 + retval[11]= Rbuf16ToChar(src12,des12,size3);
1.89 +
1.90 + char *src13=des12;
1.91 + RBuf16 des13;
1.92 + des13.CreateL(30);
1.93 + retval[12]=CharToRbuf16(src13,des13);
1.94 +
1.95 + string des14;
1.96 + retval[13]=Rbuf16ToString(des13,des14);
1.97 +
1.98 + string src15=des14;
1.99 + RBuf8 des15;
1.100 + des15.CreateL(30);
1.101 + retval[14]= StringToRbuf8(src15,des15);
1.102 +
1.103 + RBuf8 src16;
1.104 + src16.Create(des15);
1.105 + char * des16= new char[61];
1.106 + retval[15]=Rbuf8ToChar(src16,des16,size1);
1.107 +
1.108 + char *src17=des16;
1.109 + RBuf16 des17;
1.110 + des17.CreateL(30);
1.111 + retval[16]=CharToRbuf16(src17,des17);
1.112 +
1.113 + RBuf16 src18;
1.114 + src18.Create(des17);
1.115 + wchar_t *des18= new wchar_t[70];
1.116 + retval[17]=Rbuf16ToWchar(src18,des18,size1);
1.117 +
1.118 + wchar_t *src19=des18;
1.119 + RBuf8 des19;
1.120 + des19.CreateL(50);
1.121 + retval[18]=WcharToRbuf8(src19,des19);
1.122 +
1.123 + wstring src20;
1.124 + retval[19] = Rbuf8ToWstring(des19,src20);
1.125 +
1.126 + TBuf16 <100> des20;
1.127 + retval[20] = WstringToTbuf16(src20,des20);
1.128 +
1.129 + wchar_t* src21= new wchar_t[100];
1.130 + int size_new=30;
1.131 + retval[21] = Tbuf16ToWchar(des20,src21,size_new);
1.132 +
1.133 + RBuf16 des21;
1.134 + des21.CreateL(30);
1.135 + retval[22]= WcharToRbuf16(src21,des21);
1.136 +
1.137 + wstring src22;
1.138 + retval[23]= Rbuf16ToWstring(des21,src22);
1.139 +
1.140 + TBuf16 <100> des22;
1.141 + retval[24]= WstringToTbuf16(src22,des22);
1.142 +
1.143 + wchar_t* src23= new wchar_t[100];
1.144 + int size=100;
1.145 + retval[25]= Tbuf16ToWchar(des22,src23,size);
1.146 +
1.147 + RBuf8 des23;
1.148 + des23.CreateL(50);
1.149 + retval[26]= WcharToRbuf8(src23,des23);
1.150 +
1.151 + wstring src24;
1.152 + retval[27]= Rbuf8ToWstring(des23,src24);
1.153 +
1.154 + des23.Close();
1.155 + TBuf8 <100> des24;
1.156 + retval[28]= WstringToTbuf8(src24,des24);
1.157 +
1.158 + wchar_t* des25 = new wchar_t[150];
1.159 + int size8=150;
1.160 + retval[29]= Tbuf8ToWchar(des24,des25,size8);
1.161 +
1.162 + for(int i=1; i<=29; i++)
1.163 + {
1.164 + if (retval[i]!= 0)
1.165 + printf("Conversion failed for retval\n",retval[i]);
1.166 + }
1.167 +
1.168 + ret= strncmp((char *)src1.c_str(),(char *)des24.Ptr(),7);
1.169 + if(ret == ESuccess)
1.170 + {
1.171 + printf("integration_test_scenario_29 PASSED\n");
1.172 + }
1.173 + else
1.174 + {
1.175 + printf("integration_test_scenario_29 FAILED\n");
1.176 + assert_failed=true;
1.177 + }
1.178 + delete[] des2;
1.179 + delete[] des8;
1.180 + delete[] des12;
1.181 + delete[] aPtr;
1.182 + delete[] des16;
1.183 + delete[] des18;
1.184 + delete[] src21;
1.185 + delete[] src23;
1.186 + delete[] des25;
1.187 + delete des5;
1.188 + delete des7;
1.189 + delete des9;
1.190 + src12.Close();
1.191 + des13.Close();
1.192 + des15.Close();
1.193 + src16.Close();
1.194 + des17.Close();
1.195 + src18.Close();
1.196 + des19.Close();
1.197 + des21.Close();
1.198 + }
1.199 + __UHEAP_MARKEND;
1.200 + testResultXml("integration_test_scenario29");
1.201 + return 0;
1.202 +
1.203 +}