[Mono-list] Re: A NUnit test with System.IO.BinaryReader

Eduardo Garcia kiwnix@yahoo.es
19 Aug 2002 22:03:36 +0200


--=-+7PF5ORmKq1w3t53x+gr
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

El s=C3=A1b, 17-08-2002 a las 21:37, Dick Porter escribi=C3=B3:
> Now try testing a few interleaved r.BaseStream.Seek() :)  Serge noted
> some problems with character encodings too.
>=20
I don't know if you mean that with "interleaved r.BaseStream.Seek()" but
i have write 2 more tests.

> I will commit a new BinaryReader soon, with (I hope) all the issues
> fixed.
>=20
> - Dick

A test fail, Related to:29131

--=20
Eduardo Garcia <kiwnix@yahoo.es>

--=-+7PF5ORmKq1w3t53x+gr
Content-Disposition: attachment; filename=1.diff
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=1.diff; charset=UTF-8

Index: BinaryReaderTest.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/mcs/class/corlib/Test/System.IO/BinaryReaderTest.cs,v
retrieving revision 1.1
diff -r1.1 BinaryReaderTest.cs
242c242
< 				AssertEquals ("#13 the stream pointer have been altered in peek", cha=
r1, char2);
---
> 				AssertEquals ("#20 the stream pointer have been altered in peek", cha=
r1, char2);
244c244
< 				Fail ("#14 Unexpected exception thrown: " + e.ToString ());
---
> 				Fail ("#21 Unexpected exception thrown: " + e.ToString ());
246a247,298
> 	=09
> 		public void TestBaseSeek1 ()
> 		{
> 			char char1, char2;
> 			char [] b =3D {'A','B','C','D','E','F'};
> 			byte [] arr_b =3D new byte[6];
> 			int i =3D 0;
> 			foreach (char b1 in b) {
> 				arr_b [i] =3D Convert.ToByte (b1);
> 				i++;
> 			}
>=20
> 			MemoryStream m =3D new MemoryStream (arr_b);
> 			BinaryReader r =3D new BinaryReader (m);
> 			try {
> 				char1 =3D (char) r.PeekChar ();
> 				r.BaseStream.Seek (0,SeekOrigin.Current);
> 				char2 =3D (char) r.PeekChar ();
> 				AssertEquals ("#22 the stream Has been altered in Seek", char1, char2=
);
> 			} catch (Exception e) {
> 				Fail ("#23 Unexpected exception thrown: " + e.ToString ());
> 			}
> 		}
>=20
> 		public void TestBaseSeek2 ()
> 		{
> 			char char1, char2;
> 			char [] b =3D {'A','B','C','D','E','F'};
> 			byte [] arr_b =3D new byte[6];
> 			int i =3D 0;
> 			foreach (char b1 in b) {
> 				arr_b [i] =3D Convert.ToByte (b1);
> 				i++;
> 			}
> 		=09
> 			MemoryStream m =3D new MemoryStream (arr_b);
> 			BinaryReader r =3D new BinaryReader (m);
> 			try {
> 				char1 =3D (char) r.PeekChar ();
> 				r.BaseStream.Seek (3,SeekOrigin.Current);
> 				r.BaseStream.Seek (-3,SeekOrigin.Current);
> 				char2 =3D (char) r.PeekChar ();
> 				AssertEquals ("#24 the stream Has been altered in Seek", char1, char2=
);
> 			} catch (Exception e) {
> 				Fail ("#25 Unexpected exception thrown: " + e.ToString ());
> 			}
> 		}
>=20
>=20
>=20
> 		=09
> 		=09

--=-+7PF5ORmKq1w3t53x+gr--