Re: Asserting that a value is within an interval

"Charlie Poole" <[email protected]> Sat, 2 Aug 2008 10:19:20 -0700
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <005101c8f4c3$e85517f0$6401a8c0@ferrari>
Hi Chris, 

> > Didn't know that, but it's there for doubles and floats only.
> 
> What version of nunit are you using? I have the source for 
> 2.4.8, and it seems to support ints explicitly. There are 
> overloads for int, uint, ulong, long, double, and decimal, 
> each of which uses the tolerance, if there is one. And I just 
> tested with 2.4.7, which handled it as expected.

FWIW, here's the history.

Assert.AreEqual has always had an overload with a tolerance for 
doubles and floats.

With the 2.4 constraint syntax, Within was added. It could be
used syntactically on any equality assert but was ignored 
except for doubles and floats.

Beginning with 2.4.2, NUnit uses the tolerance for any of
the built-in numeric types if you specify it.

Charlie



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/