os/ossrv/utilitylibraries/libutils/tsrc/src/integration_test_scenario23.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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
    TBufC8<30> buf;
sl@0
    29
    TPtrC8 myTptr8 = buf.Des();
sl@0
    30
    wchar_t* myWchar = L"no_worth_purpose";
sl@0
    31
    char* temp = new char[15];
sl@0
    32
    retval[0] = WcharpToTptrc8(myWchar,temp,myTptr8);
sl@0
    33
sl@0
    34
    wstring myWstring;
sl@0
    35
    retval[1] = Tptrc8ToWstring(myTptr8,myWstring);
sl@0
    36
sl@0
    37
    TBufC<30> tbuf;
sl@0
    38
    TPtrC16 myTptr16 = tbuf.Des();
sl@0
    39
    retval[2] = WstringToTptrc16(myWstring,myTptr16);
sl@0
    40
sl@0
    41
    char* myChar = new char[40];
sl@0
    42
    int size = 40;
sl@0
    43
    retval[3] = Tptrc16ToCharp(myTptr16,myChar,size);
sl@0
    44
sl@0
    45
    TBufC8<30> buf8;
sl@0
    46
    TPtr8 myTptr = buf8.Des();  
sl@0
    47
    retval[4] = CharpToTptr8(myChar,myTptr);
sl@0
    48
sl@0
    49
    wchar_t* Wstr_fin = new wchar_t[36];
sl@0
    50
    int size_char=36;
sl@0
    51
    retval[5] = Tptr8ToWcharp(myTptr,Wstr_fin,size_char);
sl@0
    52
    
sl@0
    53
    for(int i=1; i<=5; i++)
sl@0
    54
        {
sl@0
    55
    if (retval[i]!= 0)
sl@0
    56
                printf("Conversion failed for retval\n",retval[i]);
sl@0
    57
        }
sl@0
    58
sl@0
    59
    if(!wcscmp(myWchar,Wstr_fin))
sl@0
    60
    {
sl@0
    61
    printf("\n\nintegration_test_scenario23 case passed");
sl@0
    62
    }
sl@0
    63
    else
sl@0
    64
    {
sl@0
    65
    printf("\n\nintegration_test_scenario23 case failed");
sl@0
    66
    assert_failed = true;
sl@0
    67
    }
sl@0
    68
    delete[] temp;
sl@0
    69
    delete[] myChar;
sl@0
    70
    delete[] Wstr_fin;	
sl@0
    71
    }
sl@0
    72
    __UHEAP_MARKEND;
sl@0
    73
    testResultXml("integration_test_scenario23");
sl@0
    74
    return 0;
sl@0
    75
}