utilitylibraries/libutils/tsrc/src/test_rbuf16towstring_boundary2.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 <e32base.h>
       
    19 #include <stdio.h>
       
    20 #include<e32std.h>
       
    21 #include "libutils.h"
       
    22 #include"std_log_result.h"
       
    23 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    24 int main()
       
    25 {
       
    26     wstring des;
       
    27     __UHEAP_MARK;
       
    28     int retval =ESuccess;
       
    29     RBuf16  buf;
       
    30     buf.Create(10);
       
    31     buf.Copy((TUint16 *)"Hello", 5);
       
    32     buf.CleanupClosePushL();
       
    33    // int size =15;
       
    34     retval = Rbuf16ToWstring(buf, des);
       
    35 
       
    36     int rbuf_len = buf.Length();
       
    37     int string_len = des.length();
       
    38     #if __WINS__
       
    39     if (retval ==ESuccess && rbuf_len == string_len && rbuf_len == string_len==5)
       
    40     {
       
    41     printf("test rbuf16towstring boundary2 Passed\n");
       
    42     }
       
    43     else
       
    44     {
       
    45     assert_failed = true;
       
    46     printf("test rbuf16towstring boundary2 Failed\n");
       
    47     }
       
    48     #else
       
    49     if (retval ==ESuccess && (rbuf_len+1)/2 == string_len )
       
    50     {
       
    51     printf("test rbuf16towstring boundary2 Passed\n");
       
    52     }
       
    53     else
       
    54     {
       
    55     assert_failed = true;
       
    56     printf("test rbuf16towstring boundary2 Failed\n");
       
    57     }
       
    58     #endif            
       
    59     CleanupStack::PopAndDestroy(1);
       
    60     __UHEAP_MARKEND;	
       
    61     testResultXml("test_rbuf16towstring_boundary2");
       
    62 	return 0;
       
    63 }