[Mono-list] Re: [Gtk-sharp-list] ThreadNotify (A bug in Queue.Dequeue method)

Pablo Baena pbaena@uol.com.ar
14 Oct 2002 19:40:49 +0000


--=-nXHfOB+UgDYkn3f/IbKr
Content-Type: multipart/alternative; boundary="=-y7cJWFf6CBbb7HpSenjr"


--=-y7cJWFf6CBbb7HpSenjr
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Sure!!! I hope this is enough. I will make more as I found more errors.
I don't know the guidelines to make these tests so please inform me of
any mistakes.

Cheers!
Pablo




On Mon, 2002-10-14 at 20:22, Miguel de Icaza wrote:

    Hello!
    
    > The last problem I showed here is not ThreadNotify's fault. Seems to be
    > a bug in Queue.Dequeue. 
    > If you look at the output of the test, you will notice it isn't accurate
    > to the data in the queue when you use Dequeue, but the commented part
    > with foreach works fine. 
    
    This sounds like a case for someone to write some regression tests for
    Queue.  Pablo, would you be interested in that?
    
    Miguel.



--=-y7cJWFf6CBbb7HpSenjr
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/1.0.4">
</HEAD>
<BODY>
Sure!!! I hope this is enough. I will make more as I found more errors. I don't know the guidelines to make these tests so please inform me of any mistakes.
<BR>

<BR>
Cheers!
<BR>
Pablo
<BR>

<BR>

<BR>

<BR>

<BR>
On Mon, 2002-10-14 at 20:22, Miguel de Icaza wrote:
    <BLOCKQUOTE>
<PRE><FONT COLOR="#737373"><FONT SIZE="3"><I>Hello!</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; The last problem I showed here is not ThreadNotify's fault. Seems to be</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; a bug in Queue.Dequeue. </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; If you look at the output of the test, you will notice it isn't accurate</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; to the data in the queue when you use Dequeue, but the commented part</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>&gt; with foreach works fine. </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>This sounds like a case for someone to write some regression tests for</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>Queue.  Pablo, would you be interested in that?</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>Miguel.</FONT></FONT></I></PRE>
    </BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE></PRE>
</TD>
</TR>
</TABLE>

</BODY>
</HTML>

--=-y7cJWFf6CBbb7HpSenjr--

--=-nXHfOB+UgDYkn3f/IbKr
Content-Disposition: attachment; filename=testqueue.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=testqueue.cs; charset=ISO-8859-1

// System.Collections.Queue regression test
// Author: Pablo Baena

namespace queue_test
{
	using System;
	using System.Collections;

	class test
	{
		public static int Main()
		{
			Queue queue =3D new Queue();

			for (int i=3D0;i<100;i++) {
				queue.Enqueue("Data #"+i);
			}
		=09
			if (test_iteration(queue)=3D=3D1) {
				Console.WriteLine("iteration in queue object failed");
				return 1;
			}
							=09
			if (test_enum(queue)=3D=3D1) {
				Console.WriteLine("enumeration in queue object failed");
				return 1;
			}

			Queue queue2 =3D new Queue(queue);
			if (test_peek(queue2)=3D=3D1) {
				Console.WriteLine("peek failed");
				return 1;
			}
						=09
			if (test_dequeue(queue)=3D=3D1) {
				Console.WriteLine("dequeue failed");
				return 1;
			}
		=09
			return 0;
		}

		static int test_iteration(Queue myqueue)
		{
			string tmp, tmp2;
			int i =3D 0;
			foreach (Object item in myqueue) {
				tmp =3D "Data #"+i;
				tmp2 =3D (string) item;

				if (tmp!=3Dtmp2)
					return 1;=09
				i++;
			}
			return 0;
		}
	=09
		static int test_enum(Queue myqueue)
		{
			string tmp, tmp2;
			int i =3D 0;
			IEnumerator qenum =3D myqueue.GetEnumerator();
			while (qenum.MoveNext()) {
				tmp =3D "Data #"+i;
				tmp2 =3D (string) qenum.Current;
			=09
				if (tmp!=3Dtmp2)
					return 1;
				i++;
			}
			return 0;
		}

		static int test_dequeue(Queue myqueue)
		{	=09
			string tmp, tmp2;
			for (int i=3D0;i<100;i++) {
				tmp =3D "Data #"+i;
				tmp2 =3D (string) myqueue.Dequeue();
			=09
				if (tmp!=3Dtmp2)
					return 1;
			}
			return 0;
		}
	=09
		static int test_peek(Queue myqueue)
		{			=09
			string tmp, tmp2;
			for (int i=3D0;i<100;i++) {
				tmp =3D "Data #"+i;
				tmp2 =3D (string) myqueue.Peek();

				if (tmp!=3Dtmp2)
					return 1;
				myqueue.Dequeue();
			}
			return 0;		=09
		}
	}
}
--=-nXHfOB+UgDYkn3f/IbKr--