utilitylibraries/libutils/tsrc/src/integration_test_scenario21.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     int retval[10];
       
    28     wstring mystring(L"hellohello");
       
    29     TBufC16<30> buf;
       
    30     TPtr16 myTptr = buf.Des();
       
    31     retval[1] = WstringToTptr16(mystring,myTptr);
       
    32 
       
    33     wchar_t* myWchar = new wchar_t[30];
       
    34     int size=30;
       
    35     retval[2] = Tptr16ToWcharp(myTptr,myWchar,size);
       
    36 
       
    37     HBufC16 *hbufc = HBufC16::NewMaxL(30);
       
    38     retval[3] = WcharToHbufc16(myWchar,hbufc);
       
    39 
       
    40     wstring myFinalWstr(L"kjhskjfhsakhssjhfdkjshfdks") ;
       
    41     retval[4] = Hbufc16ToWstring(hbufc,myFinalWstr);
       
    42     
       
    43     for(int i=1; i<=4; i++)
       
    44         {
       
    45         if (retval[i]!= 0)
       
    46                 printf("Conversion failed for retval\n",retval[i]);
       
    47         }
       
    48 
       
    49     if(!wcscmp((wchar_t *)mystring.c_str(),(wchar_t *)myFinalWstr.c_str()))
       
    50     {
       
    51     printf("\nintegration_test_scenario21 case passed");
       
    52     }
       
    53     else
       
    54     {
       
    55     printf("\n\nintegration_test_scenario21 case failed");
       
    56     assert_failed = true;
       
    57     }
       
    58     delete[] myWchar;
       
    59     delete hbufc;
       
    60     }
       
    61     __UHEAP_MARKEND;
       
    62     testResultXml("integration_test_scenario21");
       
    63     return 0;
       
    64 }