Merge lp:~zorba-coders/zorba/bug1156249-minusZero into lp:zorba

Proposed by Cezar Andrei on 2013-03-26
Status: Merged
Approved by: Cezar Andrei on 2013-04-10
Approved revision: 11327
Merged at revision: 11364
Proposed branch: lp:~zorba-coders/zorba/bug1156249-minusZero
Merge into: lp:zorba
Diff against target: 182 lines (+31/-24)
7 files modified
src/types/casting.cpp (+5/-18)
src/zorbatypes/decimal.cpp (+15/-2)
src/zorbatypes/decimal.h (+3/-0)
src/zorbatypes/floatimpl.cpp (+1/-1)
src/zorbatypes/m_apm.h (+4/-0)
src/zorbautils/locale.cpp (+1/-1)
test/fots/CMakeLists.txt (+2/-2)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug1156249-minusZero
Reviewer Review Type Date Requested Status
Cezar Andrei 2013-04-10 Approve on 2013-04-10
Sorin Marian Nasoi 2013-03-26 Approve on 2013-04-10
Review via email: mp+155599@code.launchpad.net

Commit message

Fix for bug1156249: FOTS: XSD 1.1: 0 vs -0 . Enables -0 as a valid xs:decimal.

Description of the change

Fix for bug1156249: FOTS: XSD 1.1: 0 vs -0 . Enables -0 as a valid xs:decimal.

To post a comment you must log in.
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1156249-minusZero into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1156249-minusZero-2013-03-26T20-44-39.759Z is
  finished. The final status was:

  3654 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1156249-minusZero into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1156249-minusZero-2013-03-27T02-00-48.455Z is
  finished. The final status was:

  3654 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

For some reason the 'eq' operator is broken after these changes.

In the following query you see that $x is xs:integer(0). But $x eq xs:integer(0) returns false...

QUERY:

import module namespace schema = "http://www.zorba-xquery.com/modules/schema";
declare variable $x:=fn:abs(xs:unsignedShort("0"));

(trace($x,"x"),
schema:schema-type($x),
$x eq xs:integer(0)
)

review: Needs Fixing
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1156249-minusZero into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1156249-minusZero-2013-04-02T22-56-38.875Z is
  finished. The final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1156249-minusZero into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1156249-minusZero-2013-04-02T23-51-42.258Z is
  finished. The final status was:

  5 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Cezar Andrei (cezar-andrei) wrote :

Added EXPECTED failures to test cases failing because of decimal -0.
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21619

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1156249-minusZero into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1156249-minusZero-2013-04-10T05-48-56.592Z is
  finished. The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

11326. By Cezar Andrei <email address hidden> on 2013-04-10

Adding back the expected failures for orderBy20 and 21 until the disputed w3c bug is fixed.

11327. By Cezar Andrei <email address hidden> on 2013-04-10

Merge Sorin's Sorin's change.

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug1156249-minusZero-2013-04-10T16-36-02.09Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/types/casting.cpp'
2--- src/types/casting.cpp 2013-04-05 22:28:04 +0000
3+++ src/types/casting.cpp 2013-04-10 16:31:23 +0000
4@@ -49,13 +49,6 @@
5 namespace zorba
6 {
7
8-void castToUserDefinedAtomicType(
9- store::Item_t& result,
10- const store::Item_t& aItem,
11- const XQType* aSourceType,
12- const XQType* aTargetType,
13- const QueryLoc& loc);
14-
15
16 #define ATOMIC_TYPE(type) \
17 GENV_TYPESYSTEM.create_atomic_type(store::XS_##type, TypeConstants::QUANT_ONE)
18@@ -2277,10 +2270,8 @@
19 return true;
20 }
21 }
22- else
23+ else if (targetType->type_kind() == XQType::USER_DEFINED_KIND)
24 {
25- ZORBA_ASSERT(targetType->type_kind() == XQType::USER_DEFINED_KIND);
26-
27 #ifndef ZORBA_NO_XMLSCHEMA
28 tm->initializeSchema();
29
30@@ -2304,7 +2295,7 @@
31 RAISE_ERROR(err::XPTY0004, loc,
32 ERROR_PARAMS(*sourceType, ZED(NoCastTo_34o), *targetType));
33 }
34-
35+ // to do: must validate before returning
36 return schema->parseUserListTypes(textValue, targetType, resultList, loc);
37 }
38 else
39@@ -2322,13 +2313,7 @@
40
41 if (success)
42 {
43- /*
44- zstring textValue = item->getStringValue();
45- store::Item_t tmp;
46-
47- resultList.clear();
48- if (schema->parseUserUnionTypes(textValue, targetType, resultList, loc))
49- */
50+ // to do: must validate before returning
51 return true;
52 }
53 }
54@@ -2347,6 +2332,8 @@
55 } // union
56 #endif // ZORBA_NO_XMLSCHEMA
57 } // list or union
58+ else
59+ ZORBA_ASSERT(false); // simple types should be only atomic or user defined
60 }
61
62
63
64=== modified file 'src/zorbatypes/decimal.cpp'
65--- src/zorbatypes/decimal.cpp 2013-03-11 15:00:50 +0000
66+++ src/zorbatypes/decimal.cpp 2013-04-10 16:31:23 +0000
67@@ -47,6 +47,7 @@
68
69 s = ascii::trim_start_whitespace( s );
70 char const *const first_non_ws = s;
71+
72 if ( *s == '+' || *s == '-' )
73 ++s;
74 while ( ascii::is_digit( *s ) )
75@@ -77,6 +78,7 @@
76 delete[] copy;
77 } else
78 *result = first_non_ws;
79+
80 }
81
82 /**
83@@ -222,7 +224,8 @@
84 }
85
86 TEMPLATE_DECL(I)
87-Decimal::Decimal( INTEGER_IMPL(I) const &i ) : value_( i.itod() ) {
88+Decimal::Decimal( INTEGER_IMPL(I) const &i ) :
89+ value_( i.itod() ) {
90 }
91 #ifndef ZORBA_WITH_BIG_INTEGER
92 template Decimal::Decimal( INTEGER_IMPL_LL const& );
93@@ -417,8 +420,18 @@
94 }
95
96 zstring Decimal::toString( value_type const &value, int precision ) {
97+ return toString(value, false, precision);
98+}
99+
100+zstring Decimal::toString( value_type const &value, bool minusZero, int precision ) {
101 char buf[ 1024 ];
102- value.toFixPtString( buf, precision );
103+
104+ if ( minusZero )
105+ {
106+ buf[0] = '-';
107+ }
108+
109+ value.toFixPtString( buf + minusZero, precision );
110
111 //
112 // Note that in the canonical representation, the decimal point is required
113
114=== modified file 'src/zorbatypes/decimal.h'
115--- src/zorbatypes/decimal.h 2013-02-26 04:12:43 +0000
116+++ src/zorbatypes/decimal.h 2013-04-10 16:31:23 +0000
117@@ -256,6 +256,9 @@
118 static zstring toString( value_type const&,
119 int precision = ZORBA_FLOAT_POINT_PRECISION );
120
121+ static zstring toString( value_type const&, bool,
122+ int precision = ZORBA_FLOAT_POINT_PRECISION );
123+
124 TEMPLATE_DECL(I) friend class IntegerImpl;
125 template<typename F> friend class FloatImpl;
126
127
128=== modified file 'src/zorbatypes/floatimpl.cpp'
129--- src/zorbatypes/floatimpl.cpp 2013-03-12 17:03:31 +0000
130+++ src/zorbatypes/floatimpl.cpp 2013-04-10 16:31:23 +0000
131@@ -400,7 +400,7 @@
132 // the spec in http://www.w3.org/TR/xpath-functions/#casting
133 MAPM decimal_mapm( value_ );
134 decimal_mapm = decimal_mapm.round( precision_ );
135- return Decimal::toString(decimal_mapm, max_precision());
136+ return Decimal::toString(decimal_mapm, isNegZero(), max_precision());
137 #else
138 std::stringstream stream;
139 stream.precision(7);
140
141=== modified file 'src/zorbatypes/m_apm.h'
142--- src/zorbatypes/m_apm.h 2013-02-07 17:24:36 +0000
143+++ src/zorbatypes/m_apm.h 2013-04-10 16:31:23 +0000
144@@ -579,6 +579,10 @@
145
146 int is_odd(void) const {return m_apm_is_odd(cval());}
147
148+ int is_zero(void) const {return (m_apm_compare(cval(), MM_Zero) == 0);}
149+
150+ int is_one(void) const {return (m_apm_compare(cval(), MM_One) == 0);}
151+
152 /* Functions: */
153 MAPM abs(void) const
154 {MAPM ret;m_apm_absolute_value(ret.val(),cval());return ret;}
155
156=== modified file 'src/zorbautils/locale.cpp'
157--- src/zorbautils/locale.cpp 2013-03-28 00:13:55 +0000
158+++ src/zorbautils/locale.cpp 2013-04-10 16:31:23 +0000
159@@ -1414,7 +1414,7 @@
160 if ( name.empty() && lang == iso639_1::en ) {
161 static char const *const name_str[] = {
162 "January", "February", "March", "April", "May", "June",
163- "July", "August", "Sepember", "October", "November", "December"
164+ "July", "August", "September", "October", "November", "December"
165 };
166 name = name_str[ month_index ];
167 }
168
169=== modified file 'test/fots/CMakeLists.txt'
170--- test/fots/CMakeLists.txt 2013-04-10 16:12:38 +0000
171+++ test/fots/CMakeLists.txt 2013-04-10 16:31:23 +0000
172@@ -400,8 +400,8 @@
173 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-030 0)
174 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-031 0)
175 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-032 0)
176-EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy20 1156249)
177-EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy21 1156249)
178+EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy20 21619)
179+EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy21 21619)
180 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy40 0)
181 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy41 0)
182 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy49 0)

Subscribers

People subscribed via source and target branches