utilitylibraries/libutils/tsrc/src/test_charptotptr16_content_check.cpp
changeset 31 ce057bb09d0b
child 34 5fae379060a7
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     int retval =ESuccess;
       
    27     char* mycharstring = "Hello Char String";
       
    28     int char_length= strlen(mycharstring);
       
    29     TBufC16<30> buf;
       
    30     TPtr16 myTptr = buf.Des();
       
    31     wchar_t* temp = new wchar_t[30];
       
    32     retval = CharpToTptr16(mycharstring,temp, myTptr);
       
    33 
       
    34     int buf_len = myTptr.Length();
       
    35     if (retval ==ESuccess &&\
       
    36     char_length == buf_len &&\
       
    37     wcsncmp(L"Hello Char String",(wchar_t*)myTptr.Ptr() , 17) ==0 )
       
    38     {
       
    39     printf("charptotptr16 content check Passed\n");
       
    40     }
       
    41     else
       
    42     {
       
    43     assert_failed = true;
       
    44     printf("charptotptr16 content check Failed\n");
       
    45     }      
       
    46     delete[] temp;
       
    47     __UHEAP_MARKEND;
       
    48     testResultXml("test_charptotptr16_content_check");
       
    49     return 0;
       
    50 }