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 = 0.000001;

public static function assertEpsilon(msg:Object, assertion1:Object, 
assertion2:Object):Void {
                if(arguments.length == 2) {
                        assertion2 = assertion1;
                        assertion1 = msg;
                        msg = "";
                }
                addTestResult(String(msg), "assertEquals", typeof(assertion1) 
== 
typeof(assertion2) && 
Math.abs(Number(assertion1)-Number(assertion2))<=EPSILON);
        }
-------------------------------

I know, i can add it to the source. But maybe somebody else needs it too.

Cheers,
Ralf.

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to