utilitylibraries/libutils/tsrc/src/test_hbufc16towstring_reliability.cpp
changeset 0 e4d67989cc36
child 22 ddc455616bd6
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 #include <stdio.h>
       
    18 #include<e32std.h>
       
    19 #include <e32base.h>
       
    20 #include "libutils.h"
       
    21 #include"std_log_result.h"
       
    22 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    23 
       
    24 void main()
       
    25 {
       
    26 	int count = 3;
       
    27 	bool err = false;
       
    28 	__UHEAP_MARK;
       
    29 	__UHEAP_FAILNEXT(count);
       
    30 	{
       
    31 	wstring myString;
       
    32 	while(!err)
       
    33 	{
       
    34 	int retval =ESuccess;
       
    35 	_LIT(KTxt, "hellohello");
       
    36   HBufC* buff = HBufC::NewL(10);
       
    37   *buff = KTxt;
       
    38   CleanupStack::PushL(buff);
       
    39 
       
    40 	retval = Hbufc16ToWstring(buff,myString);
       
    41   
       
    42   if (retval ==EInsufficientSystemMemory)
       
    43     {
       
    44     	printf("hbufc16towstring_reliability Passed\n");
       
    45     	err = true;
       
    46     	//Logging to some file can be done here
       
    47     }
       
    48   else
       
    49     {
       
    50 			assert_failed = true;
       
    51     	printf("hbufc16towstring_reliability Failed\n");
       
    52     	//Logging to some file can be done here
       
    53     }      
       
    54     CleanupStack::PopAndDestroy();
       
    55 	}
       
    56 }
       
    57 	__UHEAP_MARKEND;
       
    58 	__UHEAP_RESET;
       
    59 
       
    60     testResultXml("test_hbufc16towstring_reliability");
       
    61 }