utilitylibraries/libutils/tsrc/src/integration_test_scenario22.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     TBufC<30> buf;
       
    29     TPtrC16 myTptr=buf.Des();
       
    30     wchar_t* myWchar =L"hellohello";
       
    31     retval[0] = WcharpToTptrc16(myWchar,myTptr);
       
    32 
       
    33     wstring myWstring(L"gfgfdfdafggffghghf");
       
    34     retval[1] = Tptrc16ToWstring(myTptr,myWstring);
       
    35 
       
    36     HBufC16 *hbufc = HBufC16::NewMaxL(20);
       
    37     retval[2] = WstringToHbufc16(myWstring,hbufc);
       
    38 
       
    39     wstring myFinWstring(L"aghfgafdsgfg");
       
    40     retval[3] = Hbufc16ToWstring(hbufc,myFinWstring);
       
    41 
       
    42     char* temp = new char[30];
       
    43     TBufC8<30> buf8;
       
    44     TPtrC8 myTptr8 = buf8.Des();
       
    45     retval[4] = WstringToTptrc8(myFinWstring,temp,myTptr8);
       
    46 
       
    47     wchar_t* myFinWchar = new wchar_t[21];
       
    48     int size = 20;
       
    49     retval[5] = Tptrc8ToWcharp(myTptr8,myFinWchar,size);
       
    50     
       
    51     for(int i=1; i<=5; i++)
       
    52         {
       
    53         if (retval[i]!= 0)
       
    54                 printf("Conversion failed for retval\n",retval[i]);
       
    55         }
       
    56 
       
    57     if(!wcscmp(myWchar,myFinWchar))
       
    58     {
       
    59     printf("\n\nintegration_test_scenario22 case passed");
       
    60     }
       
    61     else
       
    62     {
       
    63     printf("\n\nintegration_test_scenario22 case failed");
       
    64     assert_failed = true;
       
    65     }
       
    66     delete[] temp;
       
    67     delete hbufc;
       
    68     delete[] myFinWchar;
       
    69     }
       
    70     __UHEAP_MARKEND;
       
    71     testResultXml("integration_test_scenario22");
       
    72     return 0;
       
    73 }