kerneltest/e32test/buffer/t_bma.cpp
changeset 247 d8d70de2bd36
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
201:43365a9b78a3 247:d8d70de2bd36
   155 	test.Next(_L("Free (again)"));
   155 	test.Next(_L("Free (again)"));
   156 	for (i=0;i<available;i++)
   156 	for (i=0;i<available;i++)
   157 		pBitMapAllocator->Free(i);
   157 		pBitMapAllocator->Free(i);
   158 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size());
   158 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size());
   159 //
   159 //
       
   160 	test.Next(_L("AllocFrom"));
       
   161 	i=0;
       
   162 	for (;i<available;i++)
       
   163 		{
       
   164 		TInt j=pBitMapAllocator->AllocFrom(i);
       
   165 		test(j==i);
       
   166 		}
       
   167 	test(pBitMapAllocator->Avail()==0);
       
   168 
       
   169 	test.Next(_L("Try AllocFrom for already allocated pos")); //should return KErrNoMemory
       
   170 	TInt j=pBitMapAllocator->AllocFrom(i-1);
       
   171 	test(j==KErrNoMemory);
       
   172 
       
   173 	test.Next(_L("Free (again)"));
       
   174 	for (i=0;i<available;i++)
       
   175 		{
       
   176 		pBitMapAllocator->Free(i);
       
   177 		}
       
   178 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size());
       
   179 //
       
   180 
   160 	test.Next(_L("AllocAt"));
   181 	test.Next(_L("AllocAt"));
   161 	pBitMapAllocator->AllocAt(aSize-1);
   182 	pBitMapAllocator->AllocAt(aSize-1);
   162 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size()-1);
   183 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size()-1);
   163 //
   184 
   164 //	test.Next(_L("AllocAt an already allocated cell"));	// this test should cause a Panic.
       
   165 //	pBitMapAllocator->AllocAt(aSize-1);
       
   166 //	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size()-1);
       
   167 //
       
   168 	test.Next(_L("Free (again)"));
   185 	test.Next(_L("Free (again)"));
   169 	pBitMapAllocator->Free(aSize-1);
   186 	pBitMapAllocator->Free(aSize-1);
   170 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size());
   187 	test(pBitMapAllocator->Avail()==pBitMapAllocator->Size());
   171 //
   188 //
   172 	test.Next(_L("AllocFromTopFrom"));
   189 	test.Next(_L("AllocFromTopFrom"));