utilitylibraries/libutils/tsrc/src/integration_test_scenario20.cpp
changeset 0 e4d67989cc36
child 22 ddc455616bd6
child 56 acd3cd4aaceb
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     int retval[10];
       
    28     wchar_t* mycharstring = L"hello";
       
    29     RBuf16 buf;
       
    30     retval[0]= WcharToRbuf16(mycharstring,buf);
       
    31 
       
    32     wstring str;
       
    33     retval[1]= Rbuf16ToWstring(buf,str);
       
    34 
       
    35     TPtr8 tptr8((unsigned char*)"",10,20);
       
    36     char* temp_c = new char[20];
       
    37     retval[2]= WstringToTptr8(str,temp_c,tptr8);
       
    38 
       
    39     char* mychar = new char[30];
       
    40     int size=30;
       
    41     retval[3]= Tptr8ToChar(tptr8,mychar,size);
       
    42 
       
    43     HBufC16 *hbufc = HBufC16::NewMaxL(20);
       
    44     retval[4]= CharToHbufc16(mychar,hbufc);
       
    45 
       
    46     string mystring;
       
    47     int size_hbufc=55;
       
    48     retval[5]= Hbufc16ToString(hbufc,mystring,size_hbufc);
       
    49 
       
    50     wchar_t* temp = new wchar_t[50];
       
    51     TPtrC16 tptrc;
       
    52     retval[6]= StringToTptrc16(mystring,temp,tptrc);
       
    53 
       
    54     wchar_t* myfinalstring = new wchar_t[50];
       
    55     int size_fin=55;
       
    56     retval[7]= Tptrc16ToWcharp(tptrc,myfinalstring,size_fin);
       
    57 
       
    58     if(!wcsncmp(mycharstring,myfinalstring,5))
       
    59     {
       
    60     printf("\nintegration_test_scenario20 case passed");
       
    61     }
       
    62     else
       
    63     {
       
    64     printf("\nintegration_test_scenario20 case failed");
       
    65     assert_failed = true;
       
    66     }
       
    67     buf.Close();
       
    68     delete[] temp_c;
       
    69     delete[] mychar;
       
    70     delete hbufc;
       
    71     delete[] temp;
       
    72     delete[] myfinalstring;
       
    73     }
       
    74     __UHEAP_MARKEND;
       
    75     testResultXml("integration_test_scenario20");
       
    76 }