[Mono-list] Odd behavior

Bob Doan bdoan@sicompos.com
Sat, 23 Feb 2002 21:37:08 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_000D_01C1BCB2.3EF37DF0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I started to work on System.Double test suite.. but I'm having a few =
problems..

Here is s small example that will demo it....

Could someone explain to me why my //TODO's don't work..

thanks!

- Bob




using NUnit.Framework;
using System;
using System.Globalization;

namespace MonoTests.System
{

public class DoubleTest : TestCase
{
 private const Double d_zero =3D 0.0;
 private const Double d_neg =3D -1234.5678;
 private const Double d_pos =3D 1234.9999;
 private const Double d_nan =3D Double.NaN;
 private const Double d_pinf =3D Double.PositiveInfinity;
 private const Double d_ninf =3D Double.NegativeInfinity;

 public DoubleTest (string name) : base (name) {}
=20

 protected override void SetUp ()
 {
 }

 public static ITest Suite {
  get {
   return new TestSuite (typeof (DoubleTest));
  }
 }

 public void TestPublicFields ()
 {             =20
//TODO: Why does this not work?
  AssertEquals("Nan Field has wrong value", (double)0.0 / (double)0.0, =
Double.NaN);
 }

 public void TestCompareTo () {
  int tmp;
  tmp =3D d_ninf.CompareTo(d_pinf);
  AssertEquals("TODO THIS TEST FAILS: CompareTo Infinity failed!!", =
d_ninf.CompareTo(d_pinf) < 0, true); =20
  AssertEquals("TODO BUT THIS ONE DOES NOT: CompareTo Infinity =
failed!!!!!!!!!", tmp < 0, true); =20
 }

}
}

------=_NextPart_000_000D_01C1BCB2.3EF37DF0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I started to work on System.Double test =
suite.. but=20
I'm having a few problems..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is s small example that will demo=20
it....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Could someone explain to me why my =
//TODO's don't=20
work..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>- Bob</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>using NUnit.Framework;<BR>using =
System;<BR>using=20
System.Globalization;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>namespace =
MonoTests.System<BR>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public class DoubleTest :=20
TestCase<BR>{<BR>&nbsp;private const Double d_zero =3D =
0.0;<BR>&nbsp;private const=20
Double d_neg =3D -1234.5678;<BR>&nbsp;private const Double d_pos =3D=20
1234.9999;<BR>&nbsp;private const Double d_nan =3D =
Double.NaN;<BR>&nbsp;private=20
const Double d_pinf =3D Double.PositiveInfinity;<BR>&nbsp;private const =
Double=20
d_ninf =3D Double.NegativeInfinity;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;public DoubleTest (string name) : =
base (name)=20
{}<BR>&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;protected override void SetUp=20
()<BR>&nbsp;{<BR>&nbsp;}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;public static ITest Suite=20
{<BR>&nbsp;&nbsp;get {<BR>&nbsp;&nbsp;&nbsp;return new TestSuite (typeof =

(DoubleTest));<BR>&nbsp;&nbsp;}<BR>&nbsp;}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;public void TestPublicFields=20
()<BR>&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;=20
<BR>//TODO: Why does this not work?<BR>&nbsp;&nbsp;AssertEquals("Nan =
Field has=20
wrong value", (double)0.0 / (double)0.0, =
Double.NaN);<BR>&nbsp;}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;public void TestCompareTo ()=20
{<BR>&nbsp;&nbsp;int tmp;<BR>&nbsp;&nbsp;tmp =3D=20
d_ninf.CompareTo(d_pinf);<BR>&nbsp;&nbsp;AssertEquals("TODO THIS TEST =
FAILS:=20
CompareTo Infinity failed!!", d_ninf.CompareTo(d_pinf) &lt; 0,=20
true);&nbsp;&nbsp;<BR>&nbsp;&nbsp;AssertEquals("TODO BUT THIS ONE DOES =
NOT:=20
CompareTo Infinity failed!!!!!!!!!", tmp &lt; 0,=20
true);&nbsp;&nbsp;<BR>&nbsp;}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>}<BR>}</FONT></DIV></BODY></HTML>

------=_NextPart_000_000D_01C1BCB2.3EF37DF0--