Bug 19783 - Math tests that use namespace prefixes in the assertions
Math tests that use namespace prefixes in the assertions
Status: RESOLVED FIXED
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite
Working drafts
PC Linux
: P2 normal
: ---
Assigned To: O'Neil Delpratt
Mailing list for public feedback on specs from XSL and XML Query WGs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-30 16:06 UTC by Sorin Nasoi
Modified: 2012-11-14 12:18 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sorin Nasoi 2012-10-30 16:06:14 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>
Comment 1 Sorin Nasoi 2012-11-01 15:21:26 UTC
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.
Comment 2 O'Neil Delpratt 2012-11-08 12:44:23 UTC
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/>
Comment 3 Tim Mills 2012-11-08 13:34:45 UTC
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>
Comment 4 O'Neil Delpratt 2012-11-08 14:21:17 UTC
(In reply to comment #3) 
> <assert>abs($result + 3.141592653589793e0) lt 1e-14</assert>

Change done accordingly to comment #3
Comment 5 Michael Kay 2012-11-14 12:18:31 UTC
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) = −π.