utilitylibraries/libutils/tsrc/src/integration_test_scenario8.cpp
changeset 31 ce057bb09d0b
child 34 5fae379060a7
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     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     TBufC8<10> src1((unsigned char*)"testing");
       
    28     char * des1= new char[10];
       
    29     int size1=50,ret,retval1,retval2,retval3,retval4,retval5;
       
    30     retval1= Tbufc8ToChar(src1,des1,size1);
       
    31     printf("retval1 value is %d\n", retval1);
       
    32 
       
    33     char * src2= des1;
       
    34     TPtr16 des2 ((unsigned short*)" ",30);
       
    35     wchar_t *aPtr = new wchar_t[50];
       
    36     retval2= CharpToTptr16(src2,aPtr,des2);
       
    37     printf("retval2 value is %d\n", retval2);
       
    38 
       
    39     TPtr16 src3= des2;
       
    40     string des3;
       
    41     retval3= Tptr16ToString(src3,des3);
       
    42     printf("retval3 value is %d\n", retval3);
       
    43 
       
    44     string src4= des3;
       
    45     RBuf16 des4;
       
    46     retval4= StringToRbuf16(src4,des4);
       
    47     printf("retval4 value is %d\n", retval4);
       
    48 
       
    49     RBuf16 src5;
       
    50     src5.Create(des4);		
       
    51     char *des5= new char [50];
       
    52     retval5 = Rbuf16ToChar(src5,des5,size1);
       
    53     printf("retval5 value is %d\n", retval5);
       
    54 
       
    55     ret= strncmp("testing",(char*)des5,7);
       
    56     if(ret == ESuccess)
       
    57     {
       
    58     printf("integration_test8 PASSED\n");
       
    59     }
       
    60     else
       
    61     {
       
    62     printf("integration_test8 FAILED\n");
       
    63     assert_failed=true;
       
    64     }
       
    65     delete[] des5;
       
    66     des4.Close();
       
    67     src5.Close();
       
    68     delete[] aPtr;
       
    69     delete[] des1;
       
    70     }
       
    71     __UHEAP_MARKEND;
       
    72     testResultXml("integration_test_scenario8");
       
    73     return 0;
       
    74 }