kerneltest/e32test/buffer/t_circ.cpp
changeset 247 d8d70de2bd36
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/buffer/t_circ.cpp	Tue Jul 06 15:50:07 2010 +0300
+++ b/kerneltest/e32test/buffer/t_circ.cpp	Wed Aug 18 11:08:29 2010 +0300
@@ -232,6 +232,34 @@
 			test(Mem::Compare(buf,arraySize,theCharArray,arraySize)==KErrNone);
 			}
 		}
+	
+	// Test Reset, Put and Get
+	TInt count = cbInt->Count();
+	test(count>0);
+	cbInt->Reset();
+	count = cbInt->Count();
+	test(count==0);
+	TUint index = 0;
+	
+	// Put 100 integers to the circular buffer.
+	TUint numberOfObjects= 100;
+	for(index=1;index<=numberOfObjects; index++)
+	    {
+	    TInt result= cbInt->Put(index);
+	    User::LeaveIfError(result);
+	    }
+	count = cbInt->Count();
+	test(count==100);
+	
+	// Get 50 integers from the circular buffer.
+	for(index=1;index<=(numberOfObjects/2); index++)
+	    {
+	    TUint cb = cbInt->Get();
+	    test(cb==index);
+	    }
+	count = cbInt->Count();
+	test(count==50);
+		
 	delete [] buf;
 	delete cbInt;
 	}