utilitylibraries/libutils/tsrc/src/integration_test_scenario7.cpp
changeset 31 ce057bb09d0b
child 45 4b03adbd26ca
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     TBuf8<20>src1((unsigned char*)"testing");
       
    28     char * des1= new char [20]; 
       
    29     int size1=20,ret,retval1,retval2,retval3,retval4,retval5,retval6;
       
    30     retval1= Tbuf8ToChar(src1,des1,size1);
       
    31     printf("retval1 value is %d\n", retval1);
       
    32 
       
    33     char * src2= des1;
       
    34     TPtr8 des2((unsigned char*)" ",7);
       
    35     retval2=CharpToTptr8(src2,des2);
       
    36     printf("retval2 value is %d\n", retval2);
       
    37 
       
    38     TPtrC8 src3= des2;
       
    39     string des3;
       
    40     retval3= Tptrc8ToString(src3,des3);
       
    41     printf("retval3 value is %d\n", retval3);
       
    42 
       
    43     string src4=des3;
       
    44     HBufC16 *des4= HBufC16::NewMaxL(20);
       
    45     retval4= StringToHbufc16(src4,des4);
       
    46     printf("retval4 value is %d\n", retval4);
       
    47 
       
    48     HBufC16 *src5= des4;
       
    49     string des5="";
       
    50     int size2=40;		
       
    51     retval5= Hbufc16ToString(src5,des5,size2);
       
    52     printf("retval5 value is %d\n", retval5);
       
    53 
       
    54     string src6=des5;
       
    55     TBuf8<50> des6;
       
    56     retval6= StringToTbuf8(src6,des6);
       
    57     printf("retval6 value is %d\n", retval6);
       
    58 
       
    59     ret= strncmp((char *)src1.Ptr(),(char *)des6.Ptr(),7);		
       
    60     if(ret == ESuccess)
       
    61     {
       
    62     printf("integration_test7 PASSED\n");
       
    63     }
       
    64     else
       
    65     {
       
    66     printf("integration_test7 FAILED\n");
       
    67     assert_failed = true;
       
    68     }
       
    69     delete des4;
       
    70     delete[] des1;
       
    71     des1= NULL;
       
    72     }
       
    73     __UHEAP_MARKEND;				
       
    74     testResultXml("integration_test_scenario7");
       
    75     return 0;
       
    76 }