First public contribution.
1 // Copyright (c) 1995-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\mmu\t_dchunk.cpp
22 #include <e32def_private.h>
24 LOCAL_D RTest test(_L("T_DCHUNK"));
33 test.Start(_L("Test double-ended chunks"));
35 TMemoryInfoV1Buf meminfo1,meminfo2;
36 TInt r=UserHal::MemoryInfo(meminfo1);
38 test.Printf(_L("Free RAM %08X bytes\n"),meminfo1().iFreeRamInBytes);
41 r=chunk1.CreateDoubleEndedLocal(0x1000,0x3000,2*meminfo1().iFreeRamInBytes);
43 TInt size = chunk1.Size();
44 TInt bottom = chunk1.Bottom();
45 TInt top = chunk1.Top();
46 Mem::FillZ((TAny*)(chunk1.Base()+chunk1.Bottom()),chunk1.Size());
48 r=UserHal::MemoryInfo(meminfo1);
50 test.Printf(_L("Free RAM %08X bytes\n"),meminfo1().iFreeRamInBytes);
52 r=chunk1.AdjustDoubleEnded(0,2*meminfo1().iFreeRamInBytes);
53 test(r==KErrNoMemory);
54 test(size==chunk1.Size());
55 test(bottom==chunk1.Bottom());
56 test(top==chunk1.Top());
58 r=UserHal::MemoryInfo(meminfo2);
60 test.Printf(_L("Free RAM %08X bytes\n"),meminfo2().iFreeRamInBytes);
61 test(meminfo1().iFreeRamInBytes==meminfo2().iFreeRamInBytes);
63 r=chunk1.AdjustDoubleEnded(0,0x6000);
65 Mem::FillZ((TAny*)(chunk1.Base()+chunk1.Bottom()),chunk1.Size());