|
From: Luke B. <lb...@gm...> - 2005-09-22 19:07:54
|
I have to admit - this is definitely a unique request! Does anyone else need this? Does JUnit or NUnit include this? Thanks, Luke Bayes www.asunit.org <http://www.asunit.org> On 9/22/05, Ralf Bokelberg <in...@bo...> wrote: > > It would be nice to have AssertEpsilon. AssertEpsilon compares two > floating point numbers by comparing their distance to some epsilon. > Epsilon should be a static, which can be set/retrieved by the user. > > ------------------------------- > public static var EPSILON:Number =3D 0.000001; > > public static function assertEpsilon(msg:Object, assertion1:Object, > assertion2:Object):Void { > if(arguments.length =3D=3D 2) { > assertion2 =3D assertion1; > assertion1 =3D msg; > msg =3D ""; > } > addTestResult(String(msg), "assertEquals", typeof(assertion1) =3D=3D > typeof(assertion2) && > Math.abs(Number(assertion1)-Number(assertion2))<=3DEPSILON); > } > ------------------------------- > > I know, i can add it to the source. But maybe somebody else needs it too. > > Cheers, > Ralf. > > _______________________________________________ > osflash mailing list > os...@os... > http://osflash.org/mailman/listinfo/osflash_osflash.org > |