os/ossrv/utilitylibraries/libutils/tsrc/src/integration_test_scenario24.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
#include <stdio.h>
sl@0
    19
#include<e32std.h>
sl@0
    20
#include "libutils.h"
sl@0
    21
#include"std_log_result.h"
sl@0
    22
#define LOG_FILENAME_LINE __FILE__, __LINE__
sl@0
    23
int main()
sl@0
    24
{
sl@0
    25
    __UHEAP_MARK;
sl@0
    26
    {
sl@0
    27
    int retval[10];
sl@0
    28
    RBuf8 rbuf;
sl@0
    29
    int size=10;
sl@0
    30
    _LIT8(Ktext_rbuf,"hello hi");
sl@0
    31
    rbuf.CreateL(Ktext_rbuf,size);
sl@0
    32
    wchar_t* myWchar = new wchar_t[10];
sl@0
    33
    retval[0] = Rbuf8ToWchar(rbuf,myWchar,size);
sl@0
    34
sl@0
    35
    TBufC8<30> buf;
sl@0
    36
    TPtrC8 myTptr8 = buf.Des();
sl@0
    37
    char* temp = new char[15];
sl@0
    38
    retval[0] = WcharpToTptrc8(myWchar,temp,myTptr8);
sl@0
    39
sl@0
    40
    wstring myWstring(L"gdfgdsgghdfssfsafdsf");
sl@0
    41
    retval[1] = Tptrc8ToWstring(myTptr8,myWstring);
sl@0
    42
sl@0
    43
    TBufC<30> tbuf;
sl@0
    44
    TPtrC16 myTptr16 = tbuf.Des();
sl@0
    45
    retval[2] = WstringToTptrc16(myWstring,myTptr16);
sl@0
    46
sl@0
    47
    char* myChar = new char[40];     
sl@0
    48
    int size_new = 40;
sl@0
    49
    retval[3] = Tptrc16ToCharp(myTptr16,myChar,size_new);
sl@0
    50
sl@0
    51
    TBufC8<30> buf8;
sl@0
    52
    TPtr8 myTptr = buf8.Des();  
sl@0
    53
    retval[4] = CharpToTptr8(myChar,myTptr);
sl@0
    54
sl@0
    55
    wchar_t* Wstr_fin = new wchar_t[36];
sl@0
    56
    int size_char=36;
sl@0
    57
    retval[5] = Tptr8ToWcharp(myTptr,Wstr_fin,size_char);
sl@0
    58
    
sl@0
    59
    for(int i=1; i<=5; i++)
sl@0
    60
        {
sl@0
    61
        if (retval[i]!= 0)
sl@0
    62
                printf("Conversion failed for retval\n",retval[i]);
sl@0
    63
        }
sl@0
    64
sl@0
    65
    if(!wcscmp(myWchar,Wstr_fin))
sl@0
    66
    {
sl@0
    67
    printf("\n\nintegration_test_scenario24 case passed");
sl@0
    68
    }
sl@0
    69
    else
sl@0
    70
    {
sl@0
    71
    printf("\n\nintegration_test_scenario24 case failed");
sl@0
    72
    assert_failed = true;
sl@0
    73
    }
sl@0
    74
    rbuf.Close();
sl@0
    75
    delete[] myWchar;
sl@0
    76
    delete[] temp;
sl@0
    77
    delete[] myChar;
sl@0
    78
    delete[] Wstr_fin;	
sl@0
    79
    }
sl@0
    80
    __UHEAP_MARKEND;
sl@0
    81
    testResultXml("integration_test_scenario24");
sl@0
    82
    return 0;
sl@0
    83
}