os/ossrv/utilitylibraries/libutils/tsrc/src/integration_test_scenario20.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200 (2012-06-15)
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
    wchar_t* mycharstring = L"hello";
sl@0
    29
    RBuf16 buf;
sl@0
    30
    buf.CreateL(30);
sl@0
    31
    retval[0]= WcharToRbuf16(mycharstring,buf);
sl@0
    32
sl@0
    33
    wstring str;
sl@0
    34
    retval[1]= Rbuf16ToWstring(buf,str);
sl@0
    35
sl@0
    36
    TPtr8 tptr8((unsigned char*)"",10,20);
sl@0
    37
    char* temp_c = new char[20];
sl@0
    38
    retval[2]= WstringToTptr8(str,temp_c,tptr8);
sl@0
    39
sl@0
    40
    char* mychar = new char[30];
sl@0
    41
    int size=30;
sl@0
    42
    retval[3]= Tptr8ToChar(tptr8,mychar,size);
sl@0
    43
sl@0
    44
    HBufC16 *hbufc = HBufC16::NewMaxL(20);
sl@0
    45
    retval[4]= CharToHbufc16(mychar,hbufc);
sl@0
    46
sl@0
    47
    string mystring;
sl@0
    48
    int size_hbufc=55;
sl@0
    49
    retval[5]= Hbufc16ToString(hbufc,mystring,size_hbufc);
sl@0
    50
sl@0
    51
    wchar_t* temp = new wchar_t[50];
sl@0
    52
    TPtrC16 tptrc;
sl@0
    53
    retval[6]= StringToTptrc16(mystring,temp,tptrc);
sl@0
    54
    
sl@0
    55
    for(int i=1; i<=6; i++)
sl@0
    56
        {
sl@0
    57
        if (retval[i]!= 0)
sl@0
    58
                printf("Conversion failed for retval\n",retval[i]);
sl@0
    59
        }
sl@0
    60
sl@0
    61
    wchar_t* myfinalstring = new wchar_t[50];
sl@0
    62
    int size_fin=55;
sl@0
    63
    retval[7]= Tptrc16ToWcharp(tptrc,myfinalstring,size_fin);
sl@0
    64
sl@0
    65
    if(!wcsncmp(mycharstring,myfinalstring,5))
sl@0
    66
    {
sl@0
    67
    printf("\nintegration_test_scenario20 case passed");
sl@0
    68
    }
sl@0
    69
    else
sl@0
    70
    {
sl@0
    71
    printf("\nintegration_test_scenario20 case failed");
sl@0
    72
    assert_failed = true;
sl@0
    73
    }
sl@0
    74
    buf.Close();
sl@0
    75
    delete[] temp_c;
sl@0
    76
    delete[] mychar;
sl@0
    77
    delete hbufc;
sl@0
    78
    delete[] temp;
sl@0
    79
    delete[] myfinalstring;
sl@0
    80
    }
sl@0
    81
    __UHEAP_MARKEND;
sl@0
    82
    testResultXml("integration_test_scenario20");
sl@0
    83
    return 0;
sl@0
    84
}