Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4436 from evolvedbinary/5.x.x/hotfix/numeric-oper…
…ations
- Loading branch information
Showing
16 changed files
with
924 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
exist-core/src/test/java/xquery/numericOp/NumericOpTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* eXist-db Open Source Native XML Database | ||
* Copyright (C) 2001 The eXist-db Authors | ||
* | ||
* info@exist-db.org | ||
* http://www.exist-db.org | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
package xquery.numericOp; | ||
|
||
import org.exist.test.runner.XSuite; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(XSuite.class) | ||
@XSuite.XSuiteFiles({ | ||
"src/test/xquery/numericOp" | ||
}) | ||
public class NumericOpTests { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
(: | ||
: eXist-db Open Source Native XML Database | ||
: Copyright (C) 2001 The eXist-db Authors | ||
: | ||
: info@exist-db.org | ||
: http://www.exist-db.org | ||
: | ||
: This library is free software; you can redistribute it and/or | ||
: modify it under the terms of the GNU Lesser General Public | ||
: License as published by the Free Software Foundation; either | ||
: version 2.1 of the License, or (at your option) any later version. | ||
: | ||
: This library is distributed in the hope that it will be useful, | ||
: but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
: Lesser General Public License for more details. | ||
: | ||
: You should have received a copy of the GNU Lesser General Public | ||
: License along with this library; if not, write to the Free Software | ||
: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
:) | ||
xquery version "3.1"; | ||
|
||
(:~ | ||
: Tests for the op:numeric-add operator. | ||
:) | ||
module namespace ona = "http://exist-db.org/test/op-numeric-add"; | ||
|
||
declare namespace test = "http://exist-db.org/xquery/xqsuite"; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("2.2599999952316283") | ||
function ona:numeric-add-float-double($f as xs:float, $d as xs:double) { | ||
$f + $d | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("2.2599999952316283") | ||
function ona:numeric-add-double-float($d as xs:double, $f as xs:float) { | ||
$d + $f | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("2.26") | ||
function ona:numeric-add-double-decimal($d as xs:double, $dec as xs:decimal) { | ||
$d + $dec | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("2.26") | ||
function ona:numeric-add-decimal-double($dec as xs:decimal, $d as xs:double) { | ||
$dec + $d | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("2.26") | ||
function ona:numeric-add-decimal-float($dec as xs:decimal, $f as xs:float) { | ||
$dec + $f | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("2.26") | ||
function ona:numeric-add-float-decimal($f as xs:float, $dec as xs:decimal) { | ||
$f + $dec | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
(: | ||
: eXist-db Open Source Native XML Database | ||
: Copyright (C) 2001 The eXist-db Authors | ||
: | ||
: info@exist-db.org | ||
: http://www.exist-db.org | ||
: | ||
: This library is free software; you can redistribute it and/or | ||
: modify it under the terms of the GNU Lesser General Public | ||
: License as published by the Free Software Foundation; either | ||
: version 2.1 of the License, or (at your option) any later version. | ||
: | ||
: This library is distributed in the hope that it will be useful, | ||
: but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
: Lesser General Public License for more details. | ||
: | ||
: You should have received a copy of the GNU Lesser General Public | ||
: License along with this library; if not, write to the Free Software | ||
: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
:) | ||
xquery version "3.1"; | ||
|
||
(:~ | ||
: Tests for the op:numeric-divide operator. | ||
:) | ||
module namespace ond = "http://exist-db.org/test/op-numeric-divide"; | ||
|
||
declare namespace test = "http://exist-db.org/xquery/xqsuite"; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("0.9999999957802023") | ||
function ond:numeric-divide-float-double($f as xs:float, $d as xs:double) { | ||
$f div $d | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("1.0000000042197978") | ||
function ond:numeric-divide-double-float($d as xs:double, $f as xs:float) { | ||
$d div $f | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("1") | ||
function ond:numeric-divide-double-decimal($d as xs:double, $dec as xs:decimal) { | ||
$d div $dec | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("1") | ||
function ond:numeric-divide-decimal-double($dec as xs:decimal, $d as xs:double) { | ||
$dec div $d | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("1") | ||
function ond:numeric-divide-decimal-float($dec as xs:decimal, $f as xs:float) { | ||
$dec div $f | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertEquals("1") | ||
function ond:numeric-divide-float-decimal($f as xs:float, $dec as xs:decimal) { | ||
$f div $dec | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
(: | ||
: eXist-db Open Source Native XML Database | ||
: Copyright (C) 2001 The eXist-db Authors | ||
: | ||
: info@exist-db.org | ||
: http://www.exist-db.org | ||
: | ||
: This library is free software; you can redistribute it and/or | ||
: modify it under the terms of the GNU Lesser General Public | ||
: License as published by the Free Software Foundation; either | ||
: version 2.1 of the License, or (at your option) any later version. | ||
: | ||
: This library is distributed in the hope that it will be useful, | ||
: but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
: Lesser General Public License for more details. | ||
: | ||
: You should have received a copy of the GNU Lesser General Public | ||
: License along with this library; if not, write to the Free Software | ||
: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
:) | ||
xquery version "3.1"; | ||
|
||
(:~ | ||
: Tests for the op:numeric-equal operator. | ||
:) | ||
module namespace one = "http://exist-db.org/test/op-numeric-equal"; | ||
|
||
declare namespace test = "http://exist-db.org/xquery/xqsuite"; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertFalse | ||
function one:numeric-equal-float-double($f as xs:float, $d as xs:double) { | ||
$f eq $d | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertFalse | ||
function one:numeric-equal-double-float($d as xs:double, $f as xs:float) { | ||
$d eq $f | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertTrue | ||
function one:numeric-equal-double-decimal($d as xs:double, $dec as xs:decimal) { | ||
$d eq $dec | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertTrue | ||
function one:numeric-equal-decimal-double($dec as xs:decimal, $d as xs:double) { | ||
$dec eq $d | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertTrue | ||
function one:numeric-equal-decimal-float($dec as xs:decimal, $f as xs:float) { | ||
$dec eq $f | ||
}; | ||
|
||
declare | ||
%test:args("1.13", "1.13") | ||
%test:assertTrue | ||
function one:numeric-equal-float-decimal($f as xs:float, $dec as xs:decimal) { | ||
$f eq $dec | ||
}; |
Oops, something went wrong.