kerneltest/e32test/misc/t_cmpres.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32test\misc\t_cmpres.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32test.h>
       
    19 
       
    20 /**
       
    21 Overview:
       
    22 	Test heap compression with all offsets.
       
    23 
       
    24 API Information:
       
    25 	RHeap.
       
    26 
       
    27 Details:
       
    28 	- Allocate some cells with specified sizes from the current thread's 
       
    29 	  heap, free a few of them, compress all the chunks containing heaps 
       
    30 	  and check the validity of the current thread's heap.
       
    31 
       
    32 Platforms/Drives/Compatibility:
       
    33 	All 
       
    34 
       
    35 Assumptions/Requirement/Pre-requisites:
       
    36 	
       
    37 Failures and causes:
       
    38 	
       
    39 Base Port information:
       
    40 */
       
    41 
       
    42 LOCAL_D RTest test(_L("T_CMPRES"));
       
    43 
       
    44 GLDEF_C TInt E32Main()
       
    45 	{
       
    46 
       
    47 	test.Title();
       
    48 	test.Start(_L("Testing heap compression with all offsets"));
       
    49 
       
    50 	TInt n;
       
    51 	for (n=0x4000; n<=0x5000; n+=4)
       
    52 		{
       
    53 		TAny* p1=User::Alloc(0x10000);
       
    54 		test(p1!=NULL);
       
    55 		User::Free(p1);
       
    56 		TAny* p2=User::Alloc(n);
       
    57 		test(p2!=NULL);
       
    58 		TAny* p3=User::Alloc(0x4000);
       
    59 		test(p3!=NULL);
       
    60 		User::Free(p3);
       
    61 		User::CompressAllHeaps();
       
    62 		User::Allocator().Check();
       
    63 		User::Free(p2);
       
    64 		}
       
    65 
       
    66 	test.End();
       
    67 	return 0;
       
    68 	}