Bugzilla – Bug 19783

Math tests that use namespace prefixes in the assertions

Last modified: 2012-11-14 12:18:31 UTC

There are several test cases in the 'math' folder where there are prefixes used in the assertions. AFAIK the assertions are to be checked using an 'empty'/'default' environment, not in the same environment where the actual test is run. Something like: <result> <assert-eq>math:pi()</assert-eq> </result> is wrong because the 'math' namespace binding is not defined 'by default'. Below please find a test case example from 'math-atan2' test set: <test-case name="math-atan2-003"> <description>Evaluate the function math:atan2() with the arguments +0.0e0 and -0.0e0</description> <created by="O'Neil Delpratt, Saxonica" on="2010-12-10"/> <environment ref="math"/> <test>math:atan2(+0.0e0, -0.0e0)</test> <result> <assert-eq>math:pi()</assert-eq> </result> </test-case>

As discussed, here is a list of test cases that I propose for investigation: - "math-atan2" test set, "math-atan2-003","math-atan2-004","math-atan2-005","math-atan2-006","math-atan2-007","math-atan2-008" - "math-pi" test set,"math-pi-002" - "prod-CastExpr.schema" test set, "user-defined-1","user-defined-6","user-defined-8" the result is sizeType(1) but the sizeType is part of a schema that is not in the "assert-eq" environment - "prod-ModuleImport" test set, "errata6-003" - the result, 8, is of type hatsize defined in the schema from the test environment. Assert-eq does not have access to that schema.

Bug fixes done and committed to cvs. (In reply to comment #1) > As discussed, here is a list of test cases that I propose for investigation: > > - "math-atan2" test set, > "math-atan2-003","math-atan2-004","math-atan2-005","math-atan2-006","math- > atan2-007","math-atan2-008" > - "math-pi" test set,"math-pi-002" Made the change as suggested by Mike Kay, i.e.: <assert>abs($result - 7.38905609893065e0) lt 1e-14</assert> > - "prod-CastExpr.schema" test set, > "user-defined-1","user-defined-6","user-defined-8" the result is > sizeType(1) but the sizeType is part of a schema that is not in the > "assert-eq" environment > - "prod-ModuleImport" test set, "errata6-003" - the result, 8, is of type > hatsize defined in the schema from the test environment. Assert-eq does not > have access to that schema. Moved the assertion within the test cases using an eq operator. Expected result for these tests is now <assert-true/>

There is an error in math-atan2-004. In <test>math:atan2(-0.0e0, -0.0e0)</test> <result> <assert>abs($result - 3.141592653589793e0) lt 1e-14</assert> </result> According to Wikipedia, atan2(−0, −0) = −π So the assertion should be <assert>abs($result + 3.141592653589793e0) lt 1e-14</assert>

(In reply to comment #3) > <assert>abs($result + 3.141592653589793e0) lt 1e-14</assert> Change done accordingly to comment #3

Please note that we take our specifications of trigonometrical functions from IEEE 754-2008, not from Wikipedia. In edge cases and at singularities, there are differences between different specifications of these functions. However, I have checked this one and IEEE also has atan2(-0, -0) = −π.