[Mono-bugs] [Bug 33500][Maj] New - Dequeue showing corrupted data

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
8 Nov 2002 18:15:45 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by pbaena@uol.com.ar.

http://bugzilla.ximian.com/show_bug.cgi?id=33500

--- shadow/33500	Fri Nov  8 13:15:45 2002
+++ shadow/33500.tmp.17956	Fri Nov  8 13:15:45 2002
@@ -0,0 +1,132 @@
+Bug#: 33500
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: pbaena@uol.com.ar               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Dequeue showing corrupted data
+
+Description of Problem:
+
+When using the Dequeue method on a Queue object, when it has more than 20
+or so objects, the data dequeued is not accurate.
+
+Steps to reproduce the problem: compile and run this test. Only the Dequeue
+test fails.
+
+// System.Collections.Queue regression test
+// Author: Pablo Baena
+
+namespace queue_test
+{
+	using System;
+	using System.Collections;
+
+	class test
+	{
+		public static int Main()
+		{
+			Queue queue = new Queue(50, 1.5f);
+
+			for (int i=0;i<100;i++) {
+				queue.Enqueue("Data #"+i);
+			}
+			
+			if (test_iteration(queue)==1) {
+				Console.WriteLine("iteration in queue object failed");
+				return 1;
+			}
+								
+			if (test_enum(queue)==1) {
+				Console.WriteLine("enumeration in queue object failed");
+				return 1;
+			}
+
+			Queue queue2 = new Queue(queue);
+			if (test_peek(queue2)==1) {
+				Console.WriteLine("peek failed");
+				return 1;
+			}
+							
+			if (test_dequeue(queue)==1) {
+				Console.WriteLine("dequeue failed");
+				return 1;
+			}
+			
+			return 0;
+		}
+
+		static int test_iteration(Queue myqueue)
+		{
+			string tmp, tmp2;
+			int i = 0;
+			foreach (Object item in myqueue) {
+				tmp = "Data #"+i;
+				tmp2 = (string) item;
+
+				if (tmp!=tmp2)
+					return 1;	
+				i++;
+			}
+			return 0;
+		}
+		
+		static int test_enum(Queue myqueue)
+		{
+			string tmp, tmp2;
+			int i = 0;
+			IEnumerator qenum = myqueue.GetEnumerator();
+			while (qenum.MoveNext()) {
+				tmp = "Data #"+i;
+				tmp2 = (string) qenum.Current;
+				
+				if (tmp!=tmp2)
+					return 1;
+				i++;
+			}
+			return 0;
+		}
+
+		static int test_dequeue(Queue myqueue)
+		{		
+			string tmp, tmp2;
+			for (int i=0;i<100;i++) {
+				tmp = "Data #"+i;
+				tmp2 = (string) myqueue.Dequeue();
+				
+				if (tmp!=tmp2)
+					return 1;
+			}
+			return 0;
+		}
+		
+		static int test_peek(Queue myqueue)
+		{				
+			string tmp, tmp2;
+			for (int i=0;i<100;i++) {
+				tmp = "Data #"+i;
+				tmp2 = (string) myqueue.Peek();
+
+				if (tmp!=tmp2)
+					return 1;
+				myqueue.Dequeue();
+			}
+			return 0;			
+		}
+	}
+}
+
+
+How often does this happen? 
+
+Always