utilitylibraries/libutils/tsrc/src/integration_test_scenario13.cpp
changeset 0 e4d67989cc36
child 22 ddc455616bd6
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 void main()
       
    24 {
       
    25     __UHEAP_MARK;
       
    26     {
       
    27     _LIT8(Kname,"testing");
       
    28     HBufC8 *src1=HBufC8::NewL(20);
       
    29     *src1=Kname;
       
    30     char *des1 = new char[30];
       
    31     int size1=30,retval1,retval2,retval3,retval4,ret;
       
    32     retval1= Hbufc8ToChar(src1,des1,size1);
       
    33 
       
    34     char *src2=des1;
       
    35     TPtrC16 des2((unsigned short *)"",20);
       
    36     wchar_t *aPtr=new wchar_t[20];	    				
       
    37     retval2=CharpToTptrc16(src2,aPtr,des2);
       
    38 
       
    39       
       
    40     TPtrC16 src3= des2;
       
    41     char *des3= new char[20];
       
    42     retval3= Tptrc16ToCharp(src3,des3,size1);      				
       
    43 
       
    44     char *src4=des3;
       
    45     HBufC16 *des4=HBufC16::NewMaxL(20);
       
    46     retval4= CharToHbufc16(src4,des4);
       
    47 
       
    48     char *temp = new char [des4->Length()];
       
    49     wcstombs(temp, (const wchar_t *)des4->Ptr() , 7);
       
    50     temp[7] = '\0';
       
    51     ret=strcmp(temp, "testing");				
       
    52     if(ret == 0)
       
    53     {
       
    54     printf("integration_test13 PASSED\n");
       
    55     }
       
    56     else
       
    57     {
       
    58     printf("integration_tes13 FAILED\n");
       
    59     assert_failed = true;
       
    60     }			
       
    61     delete[] des1;
       
    62     delete[] aPtr;
       
    63     delete[] temp;
       
    64     delete[] des3;
       
    65     delete src1;
       
    66     delete des4;
       
    67     }
       
    68     __UHEAP_MARKEND;
       
    69     testResultXml("integration_test_scenario13");
       
    70 }