utilitylibraries/libutils/tsrc/src/test_hbufc8tostring_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 	string myString;
       
    32 	while(!err)
       
    33 	{
       
    34 	int retval =ESuccess;
       
    35 	_LIT8(KTxt, "hellohello");
       
    36   HBufC8* buff = HBufC8::NewL(10);
       
    37   *buff = KTxt;
       
    38   CleanupStack::PushL(buff);
       
    39 
       
    40 	retval = Hbufc8ToString(buff,myString);
       
    41   
       
    42   if (retval ==EInsufficientSystemMemory)
       
    43     {
       
    44 
       
    45     	printf("hbufc8tostring_reliability Passed\n");
       
    46     	err = true;
       
    47     	//Logging to some file can be done here
       
    48     }
       
    49   else
       
    50     {
       
    51 			assert_failed = true;
       
    52     	printf("hbufc8tostring_reliability Failed\n");
       
    53     	//Logging to some file can be done here
       
    54     }      
       
    55 	}
       
    56 	CleanupStack::PopAndDestroy();
       
    57 	}
       
    58 	__UHEAP_MARKEND;
       
    59 	__UHEAP_RESET;
       
    60 
       
    61     testResultXml("test_hbufc8tostring_reliabilitysss");
       
    62 }