[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> </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> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>thanks!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>- Bob</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>namespace =
MonoTests.System<BR>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>public class DoubleTest :=20
TestCase<BR>{<BR> private const Double d_zero =3D =
0.0;<BR> private const=20
Double d_neg =3D -1234.5678;<BR> private const Double d_pos =3D=20
1234.9999;<BR> private const Double d_nan =3D =
Double.NaN;<BR> private=20
const Double d_pinf =3D Double.PositiveInfinity;<BR> private const =
Double=20
d_ninf =3D Double.NegativeInfinity;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> public DoubleTest (string name) : =
base (name)=20
{}<BR> </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> protected override void SetUp=20
()<BR> {<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> public static ITest Suite=20
{<BR> get {<BR> return new TestSuite (typeof =
(DoubleTest));<BR> }<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> public void TestPublicFields=20
()<BR> { =
=20
<BR>//TODO: Why does this not work?<BR> AssertEquals("Nan =
Field has=20
wrong value", (double)0.0 / (double)0.0, =
Double.NaN);<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> public void TestCompareTo ()=20
{<BR> int tmp;<BR> tmp =3D=20
d_ninf.CompareTo(d_pinf);<BR> AssertEquals("TODO THIS TEST =
FAILS:=20
CompareTo Infinity failed!!", d_ninf.CompareTo(d_pinf) < 0,=20
true); <BR> AssertEquals("TODO BUT THIS ONE DOES =
NOT:=20
CompareTo Infinity failed!!!!!!!!!", tmp < 0,=20
true); <BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>}<BR>}</FONT></DIV></BODY></HTML>
------=_NextPart_000_000D_01C1BCB2.3EF37DF0--