sl@0: /* sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: #include "libutils.h" sl@0: #include"std_log_result.h" sl@0: #define LOG_FILENAME_LINE __FILE__, __LINE__ sl@0: #pragma diag_suppress 550 sl@0: int main() sl@0: { sl@0: bool assert_failed = false; sl@0: __UHEAP_MARK; sl@0: { sl@0: string src1="testing"; sl@0: char tempChar[20]; sl@0: TPtr8 des1((unsigned char*)tempChar,20); sl@0: int ret,size1=30,size2=42; sl@0: int retval[50]; sl@0: retval[0] = StringToTptr8(src1, des1); sl@0: sl@0: TPtr8 src2 = des1; sl@0: char *des2= new char[20]; sl@0: retval[1]= Tptr8ToChar(src2,des2,size1); sl@0: sl@0: char *src3=des2; sl@0: wchar_t *aPtr= new wchar_t[20]; sl@0: wchar_t temp[30]; sl@0: TPtrC16 des3((unsigned short *)temp,30); sl@0: retval[2]= CharpToTptrc16(src3,aPtr,des3); sl@0: sl@0: TPtrC16 src4= des3; sl@0: string des4=""; sl@0: retval[3]=Tptrc16ToString(src4,des4); sl@0: sl@0: string src5=des4; sl@0: HBufC16 *des5=HBufC16::NewMaxL(20); sl@0: retval[4]= StringToHbufc16(src5,des5); sl@0: sl@0: HBufC16 *src6=des5; sl@0: string des6(""); sl@0: retval[5]= Hbufc16ToString(src6,des6,size1); sl@0: sl@0: string src7=des4; sl@0: HBufC8 *des7=HBufC8::NewMaxL(20); sl@0: retval[6]= StringToHbufc8(src7,des7); sl@0: sl@0: HBufC8 *src8=des7; sl@0: char *des8=new char[20]; sl@0: retval[7]= Hbufc8ToChar(src8,des8,size1); sl@0: sl@0: char *src9=des8; sl@0: HBufC16 *des9=HBufC16::NewMaxL(20); sl@0: retval[8]=CharToHbufc16(src9,des9); sl@0: sl@0: HBufC16 *src10=des9; sl@0: string des10=""; sl@0: retval[9]= Hbufc16ToString(src10,des10,size2); sl@0: sl@0: string src11=des10; sl@0: RBuf16 des11; sl@0: des11.CreateL(30); sl@0: retval[10]= StringToRbuf16(src11,des11); sl@0: sl@0: RBuf16 src12; sl@0: src12.Create(14); sl@0: src12.Copy((unsigned short*)des11.Ptr(), 14); sl@0: des11.Close(); sl@0: char *des12=new char[30]; sl@0: int size3=50; sl@0: retval[11]= Rbuf16ToChar(src12,des12,size3); sl@0: sl@0: char *src13=des12; sl@0: RBuf16 des13; sl@0: des13.CreateL(30); sl@0: retval[12]=CharToRbuf16(src13,des13); sl@0: sl@0: string des14; sl@0: retval[13]=Rbuf16ToString(des13,des14); sl@0: sl@0: string src15=des14; sl@0: RBuf8 des15; sl@0: des15.CreateL(30); sl@0: retval[14]= StringToRbuf8(src15,des15); sl@0: sl@0: RBuf8 src16; sl@0: src16.Create(des15); sl@0: char * des16= new char[61]; sl@0: retval[15]=Rbuf8ToChar(src16,des16,size1); sl@0: sl@0: char *src17=des16; sl@0: RBuf16 des17; sl@0: des17.CreateL(30); sl@0: retval[16]=CharToRbuf16(src17,des17); sl@0: sl@0: RBuf16 src18; sl@0: src18.Create(des17); sl@0: wchar_t *des18= new wchar_t[70]; sl@0: retval[17]=Rbuf16ToWchar(src18,des18,size1); sl@0: sl@0: wchar_t *src19=des18; sl@0: RBuf8 des19; sl@0: des19.CreateL(50); sl@0: retval[18]=WcharToRbuf8(src19,des19); sl@0: sl@0: wstring src20; sl@0: retval[19] = Rbuf8ToWstring(des19,src20); sl@0: sl@0: TBuf16 <100> des20; sl@0: retval[20] = WstringToTbuf16(src20,des20); sl@0: sl@0: wchar_t* src21= new wchar_t[100]; sl@0: int size_new=30; sl@0: retval[21] = Tbuf16ToWchar(des20,src21,size_new); sl@0: sl@0: RBuf16 des21; sl@0: des21.CreateL(30); sl@0: retval[22]= WcharToRbuf16(src21,des21); sl@0: sl@0: wstring src22; sl@0: retval[23]= Rbuf16ToWstring(des21,src22); sl@0: sl@0: TBuf16 <100> des22; sl@0: retval[24]= WstringToTbuf16(src22,des22); sl@0: sl@0: wchar_t* src23= new wchar_t[100]; sl@0: int size=100; sl@0: retval[25]= Tbuf16ToWchar(des22,src23,size); sl@0: sl@0: RBuf8 des23; sl@0: des23.CreateL(50); sl@0: retval[26]= WcharToRbuf8(src23,des23); sl@0: sl@0: wstring src24; sl@0: retval[27]= Rbuf8ToWstring(des23,src24); sl@0: sl@0: des23.Close(); sl@0: TBuf8 <100> des24; sl@0: retval[28]= WstringToTbuf8(src24,des24); sl@0: sl@0: wchar_t* des25 = new wchar_t[150]; sl@0: int size8=150; sl@0: retval[29]= Tbuf8ToWchar(des24,des25,size8); sl@0: sl@0: for(int i=1; i<=29; i++) sl@0: { sl@0: if (retval[i]!= 0) sl@0: printf("Conversion failed for retval\n",retval[i]); sl@0: } sl@0: sl@0: ret= strncmp((char *)src1.c_str(),(char *)des24.Ptr(),7); sl@0: if(ret == ESuccess) sl@0: { sl@0: printf("integration_test_scenario_29 PASSED\n"); sl@0: } sl@0: else sl@0: { sl@0: printf("integration_test_scenario_29 FAILED\n"); sl@0: assert_failed=true; sl@0: } sl@0: delete[] des2; sl@0: delete[] des8; sl@0: delete[] des12; sl@0: delete[] aPtr; sl@0: delete[] des16; sl@0: delete[] des18; sl@0: delete[] src21; sl@0: delete[] src23; sl@0: delete[] des25; sl@0: delete des5; sl@0: delete des7; sl@0: delete des9; sl@0: src12.Close(); sl@0: des13.Close(); sl@0: des15.Close(); sl@0: src16.Close(); sl@0: des17.Close(); sl@0: src18.Close(); sl@0: des19.Close(); sl@0: des21.Close(); sl@0: } sl@0: __UHEAP_MARKEND; sl@0: testResultXml("integration_test_scenario29"); sl@0: return 0; sl@0: sl@0: }