← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

 

Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
1. Floating-point overflow is now reported just the same as integer overflow.
2. Removed infinity0.xq test since it tests too many things in a single test.
3. Added several smaller infinity/overflow tests in its place.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/142823

1. Floating-point overflow is now reported just the same as integer overflow.
2. Removed infinity0.xq test since it tests too many things in a single test.
3. Added several smaller infinity/overflow tests in its place.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/142823
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/util/string_util.cpp'
--- src/util/string_util.cpp	2013-01-10 23:39:25 +0000
+++ src/util/string_util.cpp	2013-01-11 01:45:26 +0000
@@ -56,17 +56,14 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static void check_errno( char const *buf, char const *end ) {
+static void check_parse_number( char const *buf, char const *end,
+                                bool check_trailing_chars ) {
   if ( errno == ERANGE ) {
     zstring const s( buf, end );
     throw std::range_error(
       BUILD_STRING( '"', s, "\": number too big/small" )
     );
   }
-}
-
-static void check_parse_number( char const *buf, char const *end,
-                                bool check_trailing_chars ) {
   if ( end == buf )
     throw std::invalid_argument( BUILD_STRING( '"', buf, "\": no digits" ) );
   if ( check_trailing_chars )
@@ -107,7 +104,6 @@
 long long atoll( char const *buf, char const **end ) {
   ATON_PREAMBLE();
   long long const result = std::strtoll( buf, (char**)end, 10 );
-  check_errno( buf, *end );
   check_parse_number( buf, *end, check_trailing_chars );
   return result;
 }
@@ -121,7 +117,6 @@
   bool const minus = *buf == '-';
 
   unsigned long long const result = std::strtoull( buf, (char**)end, 10 );
-  check_errno( buf, *end );
   check_parse_number( buf, *end, check_trailing_chars );
 
   if ( minus && result ) {

=== added file 'test/rbkt/ExpQueryResults/zorba/numerics/INF-1.xml.res'
--- test/rbkt/ExpQueryResults/zorba/numerics/INF-1.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/numerics/INF-1.xml.res	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+-INF INF -INF INF

=== added file 'test/rbkt/ExpQueryResults/zorba/numerics/NaN.xml.res'
--- test/rbkt/ExpQueryResults/zorba/numerics/NaN.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/numerics/NaN.xml.res	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+NaN NaN

=== removed file 'test/rbkt/ExpQueryResults/zorba/numerics/infinity0.xml.res'
--- test/rbkt/ExpQueryResults/zorba/numerics/infinity0.xml.res	2012-09-19 21:16:15 +0000
+++ test/rbkt/ExpQueryResults/zorba/numerics/infinity0.xml.res	1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-INF -INF NaN -INF INF 1.0E200 INF -INF NaN INF -INF

=== added file 'test/rbkt/ExpQueryResults/zorba/numerics/overflow-1.xml.res'
--- test/rbkt/ExpQueryResults/zorba/numerics/overflow-1.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/numerics/overflow-1.xml.res	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+INF

=== added file 'test/rbkt/ExpQueryResults/zorba/numerics/overflow-2.xml.res'
--- test/rbkt/ExpQueryResults/zorba/numerics/overflow-2.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/numerics/overflow-2.xml.res	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+-INF

=== added file 'test/rbkt/ExpQueryResults/zorba/numerics/overflow-3.xml.res'
--- test/rbkt/ExpQueryResults/zorba/numerics/overflow-3.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/numerics/overflow-3.xml.res	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+INF

=== added file 'test/rbkt/ExpQueryResults/zorba/numerics/overflow-4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/numerics/overflow-4.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/numerics/overflow-4.xml.res	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+-INF

=== added file 'test/rbkt/Queries/zorba/numerics/INF-1.xq'
--- test/rbkt/Queries/zorba/numerics/INF-1.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/INF-1.xq	2013-01-11 01:45:26 +0000
@@ -0,0 +1,6 @@
+(
+  xs:float("-INF"),
+  xs:float("INF"),
+  xs:double("-INF"),
+  xs:double("INF")
+)

=== added file 'test/rbkt/Queries/zorba/numerics/NaN.xq'
--- test/rbkt/Queries/zorba/numerics/NaN.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/NaN.xq	2013-01-11 01:45:26 +0000
@@ -0,0 +1,4 @@
+(
+  xs:float("NaN"),
+  xs:double("NaN")
+)

=== modified file 'test/rbkt/Queries/zorba/numerics/format-number1.xq'
--- test/rbkt/Queries/zorba/numerics/format-number1.xq	2012-09-19 21:16:15 +0000
+++ test/rbkt/Queries/zorba/numerics/format-number1.xq	2013-01-11 01:45:26 +0000
@@ -1,3 +1,1 @@
 fn:format-number(1, ""), fn:format-number(12, "0")
-
-

=== modified file 'test/rbkt/Queries/zorba/numerics/format-number2.xq'
--- test/rbkt/Queries/zorba/numerics/format-number2.xq	2012-09-19 21:16:15 +0000
+++ test/rbkt/Queries/zorba/numerics/format-number2.xq	2013-01-11 01:45:26 +0000
@@ -1,3 +1,1 @@
 fn:format-number((), "0")
-
-

=== removed file 'test/rbkt/Queries/zorba/numerics/infinity0.xq'
--- test/rbkt/Queries/zorba/numerics/infinity0.xq	2012-09-19 21:16:15 +0000
+++ test/rbkt/Queries/zorba/numerics/infinity0.xq	1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-(
-  xs:float("1000000000000000000000000000000000000000000000000000000"),
-  xs:float("-100000000000000000000000000000000000000000000000000000"),
-  xs:float("NaN"),
-  xs:float("-INF"),
-  xs:float("INF"),
-  xs:double("1E200"),
-  xs:double("1E1000"),
-  xs:double("-1E1000"),
-  xs:double("NaN"),
-  xs:double("INF"),
-  xs:double("-INF")
-)

=== added file 'test/rbkt/Queries/zorba/numerics/overflow-1.spec'
--- test/rbkt/Queries/zorba/numerics/overflow-1.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/overflow-1.spec	2013-01-11 01:45:26 +0000
@@ -0,0 +1,2 @@
+Result: $RBKT_SRC_DIR/ExpQueryResults/zorba/numerics/overflow-1.xml.res
+Error: http://www.w3.org/2005/xqt-errors:FOAR0002

=== added file 'test/rbkt/Queries/zorba/numerics/overflow-1.xq'
--- test/rbkt/Queries/zorba/numerics/overflow-1.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/overflow-1.xq	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+xs:float("1000000000000000000000000000000000000000000000000000000")

=== added file 'test/rbkt/Queries/zorba/numerics/overflow-2.spec'
--- test/rbkt/Queries/zorba/numerics/overflow-2.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/overflow-2.spec	2013-01-11 01:45:26 +0000
@@ -0,0 +1,2 @@
+Result: $RBKT_SRC_DIR/ExpQueryResults/zorba/numerics/overflow-2.xml.res
+Error: http://www.w3.org/2005/xqt-errors:FOAR0002

=== added file 'test/rbkt/Queries/zorba/numerics/overflow-2.xq'
--- test/rbkt/Queries/zorba/numerics/overflow-2.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/overflow-2.xq	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+xs:float("-100000000000000000000000000000000000000000000000000000")

=== added file 'test/rbkt/Queries/zorba/numerics/overflow-3.spec'
--- test/rbkt/Queries/zorba/numerics/overflow-3.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/overflow-3.spec	2013-01-11 01:45:26 +0000
@@ -0,0 +1,2 @@
+Result: $RBKT_SRC_DIR/ExpQueryResults/zorba/numerics/overflow-3.xml.res
+Error: http://www.w3.org/2005/xqt-errors:FOAR0002

=== added file 'test/rbkt/Queries/zorba/numerics/overflow-3.xq'
--- test/rbkt/Queries/zorba/numerics/overflow-3.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/overflow-3.xq	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+xs:double("1E1000")

=== added file 'test/rbkt/Queries/zorba/numerics/overflow-4.spec'
--- test/rbkt/Queries/zorba/numerics/overflow-4.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/overflow-4.spec	2013-01-11 01:45:26 +0000
@@ -0,0 +1,2 @@
+Result: $RBKT_SRC_DIR/ExpQueryResults/zorba/numerics/overflow-4.xml.res
+Error: http://www.w3.org/2005/xqt-errors:FOAR0002

=== added file 'test/rbkt/Queries/zorba/numerics/overflow-4.xq'
--- test/rbkt/Queries/zorba/numerics/overflow-4.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/numerics/overflow-4.xq	2013-01-11 01:45:26 +0000
@@ -0,0 +1,1 @@
+xs:double("-1E1000")


Follow ups