kerneltest/e32test/buffer/t_bma.cpp
changeset 247 d8d70de2bd36
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/buffer/t_bma.cpp	Tue Jul 06 15:50:07 2010 +0300
+++ b/kerneltest/e32test/buffer/t_bma.cpp	Wed Aug 18 11:08:29 2010 +0300
@@ -157,14 +157,31 @@
 		pBitMapAllocator->Free(i);
 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size());
 //
+	test.Next(_L("AllocFrom"));
+	i=0;
+	for (;i<available;i++)
+		{
+		TInt j=pBitMapAllocator->AllocFrom(i);
+		test(j==i);
+		}
+	test(pBitMapAllocator->Avail()==0);
+
+	test.Next(_L("Try AllocFrom for already allocated pos")); //should return KErrNoMemory
+	TInt j=pBitMapAllocator->AllocFrom(i-1);
+	test(j==KErrNoMemory);
+
+	test.Next(_L("Free (again)"));
+	for (i=0;i<available;i++)
+		{
+		pBitMapAllocator->Free(i);
+		}
+	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size());
+//
+
 	test.Next(_L("AllocAt"));
 	pBitMapAllocator->AllocAt(aSize-1);
 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size()-1);
-//
-//	test.Next(_L("AllocAt an already allocated cell"));	// this test should cause a Panic.
-//	pBitMapAllocator->AllocAt(aSize-1);
-//	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size()-1);
-//
+
 	test.Next(_L("Free (again)"));
 	pBitMapAllocator->Free(aSize-1);
 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size());