Merge lp:~nbrinza/zorba/bugs2 into lp:zorba

Proposed by Nicolae Brinza on 2013-04-03
Status: Merged
Approved by: Chris Hillery on 2013-04-03
Approved revision: 11013
Merged at revision: 11336
Proposed branch: lp:~nbrinza/zorba/bugs2
Merge into: lp:zorba
Diff against target: 384 lines (+126/-41)
15 files modified
src/diagnostics/diagnostic_en.xml (+1/-1)
src/diagnostics/pregenerated/dict_en.cpp (+1/-1)
src/runtime/core/arithmetic_impl.cpp (+20/-4)
src/zorbatypes/datetime/duration.cpp (+49/-19)
test/fots/CMakeLists.txt (+0/-11)
test/rbkt/ExpQueryResults/zorba/HigherOrder/combinator-02.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-101.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-104.xml.res (+2/-0)
test/rbkt/Queries/zorba/HigherOrder/combinator-01.spec (+1/-0)
test/rbkt/Queries/zorba/HigherOrder/combinator-01.xq (+7/-0)
test/rbkt/Queries/zorba/HigherOrder/combinator-02.xq (+2/-5)
test/rbkt/Queries/zorba/HigherOrder/hof-101.xq (+27/-0)
test/rbkt/Queries/zorba/HigherOrder/hof-104.xq (+9/-0)
test/rbkt/Queries/zorba/HigherOrder/hof-105.spec (+1/-0)
test/rbkt/Queries/zorba/HigherOrder/hof-105.xq (+3/-0)
To merge this branch: bzr merge lp:~nbrinza/zorba/bugs2
Reviewer Review Type Date Requested Status
Chris Hillery 2013-04-03 Approve on 2013-04-03
Paul J. Lucas 2013-04-03 Approve on 2013-04-03
Nicolae Brinza Approve on 2013-04-03
Review via email: mp+156732@code.launchpad.net

This proposal supersedes a proposal from 2013-04-02.

Commit message

Fixed the duration arithemtic bug.
Added missing testcases for HoF bugs.

Description of the change

Fixed the duration arithemtic bug.
Added missing testcases for HoF bugs.

To post a comment you must log in.
Nicolae Brinza (nbrinza) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~nbrinza/zorba/bugs2 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bugs2-2012-09-28T08-24-10.715Z 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

Nicolae Brinza (nbrinza) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue job bugs2-2012-09-28T09-31-14.134Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve, 1 Pending.

Matthias Brantner (matthias-brantner) : Posted in a previous version of this proposal
review: Approve
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

Added Markos as a reviewer.

Markos Zaharioudakis (markos-za) wrote : Posted in a previous version of this proposal

I approve, but I think more memory leaks of the kind fixed around xquery_parser.y:2506 exist. For example, the Expr rule has 2 "error" productions. deletes were added in one of them, but not the other.

Nicolae, can you open a bug (to yourself) to go through all of the error procuctions in the parser and fix the memory leaks, if any?

Markos Zaharioudakis (markos-za) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue job bugs2-2012-09-29T04-24-59.058Z is finished. The final status was:

All tests succeeded!

Nicolae Brinza (nbrinza) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Paul J. Lucas (paul-lucas) wrote : Posted in a previous version of this proposal

How can the constant for seconds_per_year be correct? It can't be a constant since its correct value is: 60 * 60 * 24 * (365 + is_leap(year))

Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~nbrinza/zorba/bugs2 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 bugs2-2013-03-27T14-36-03.816Z is finished. The final
  status was:

  8 tests did not succeed - changes not commited.

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

Nicolae Brinza (nbrinza) wrote : Posted in a previous version of this proposal

It's a duration. It does not have a start/end date. So you cannot possibly know if you're in a leap year.

I've searched a bit, but I cannot find the spec where it says how to perform the duration normalization, but the code in Duration::normalize() assumes a year has 60 * 60 * 24 * 30 * 12 seconds.

Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Paul J. Lucas (paul-lucas) wrote : Posted in a previous version of this proposal

> It's a duration. It does not have a start/end date. So you cannot possibly
> know if you're in a leap year.

True, but the fact remains that having a constant for the number of seconds in a year is non-sensical for a duration.

> I've searched a bit, but I cannot find the spec where it says how to perform
> the duration normalization ...

Did you ask the W3C? Or file a bug against the spec?

> ... but the code in Duration::normalize() assumes a year has 60 * 60 * 24 * 30 * 12 seconds.

So? Where did that code come from? What makes you think that code is correct?

Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~nbrinza/zorba/bugs2 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 bugs2-2013-03-27T15-35-01.739Z 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

Nicolae Brinza (nbrinza) wrote : Posted in a previous version of this proposal

I've looked into it. It is not a spec issue, it's an implementation choice. The multiply/divide are only defined on the yearMonthDuration and dayTimeDuration data types. For both of these types, and for the purpose of multiplication/division, assuming a year has 60 * 60 * 24 * 30 * 12 seconds works perfectly.

Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue job bugs2-2013-03-27T16-25-10.723Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 3 Pending.

Nicolae Brinza (nbrinza) : Posted in a previous version of this proposal
review: Approve
Paul J. Lucas (paul-lucas) wrote : Posted in a previous version of this proposal

When you throw FODT0002, you don't include either the value that's responsible for the error nor the location.

review: Needs Fixing
Nicolae Brinza (nbrinza) wrote : Posted in a previous version of this proposal

I have added the location and the value.

Nicolae Brinza (nbrinza) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue job bugs2-2013-04-01T21-56-14.821Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 1 Approve, 2 Pending.

Chris Hillery (ceejatec) : Posted in a previous version of this proposal
review: Approve
Paul J. Lucas (paul-lucas) wrote : Posted in a previous version of this proposal

The TRY_XS_INT_CONVERT should probably be more like:

 #define TRY_XS_INT_CONVERT(target, value, xs_type) \
   { \
     XS_TYPE const res( value ); \
     try { \
       target = to_xs_int(res); \
     } catch (std::range_error const&) { \
       throw XQUERY_EXCEPTION(err::FODT0002, ERROR_PARAMS(res.toString())); \
     } \
   }

Nicolae Brinza (nbrinza) wrote : Posted in a previous version of this proposal

No, I believe the construction of "res" and the conversion will be useless in the most common case where the error does not happen. But I've copy pasted your suggestion anyway.

Nicolae Brinza (nbrinza) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in test/fots/CMakeLists.txt

Paul J. Lucas (paul-lucas) : Posted in a previous version of this proposal
review: Approve
Nicolae Brinza (nbrinza) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Paul J. Lucas (paul-lucas) wrote : Posted in a previous version of this proposal

BTW: You don't have to keep creating new merge proposals every time you want to merge even when there are errors or merge conflicts. This way, you don't need to seek our approval multiple times. A single merge proposal is all you need.

Paul J. Lucas (paul-lucas) : Posted in a previous version of this proposal
review: Approve
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~nbrinza/zorba/bugs2 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 bugs2-2013-04-02T21-42-03.655Z 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

Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

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

Validation queue job bugs2-2013-04-03T04-27-07.239Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 1 Approve, 2 Pending.

Paul J. Lucas (paul-lucas) :
review: Approve
Chris Hillery (ceejatec) :
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bugs2-2013-04-03T06-44-58.934Z 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/diagnostics/diagnostic_en.xml'
2--- src/diagnostics/diagnostic_en.xml 2013-04-01 02:22:49 +0000
3+++ src/diagnostics/diagnostic_en.xml 2013-04-03 03:40:32 +0000
4@@ -1355,7 +1355,7 @@
5 <comment>
6 Overflow/underflow in duration operation.
7 </comment>
8- <value>overflow/underflow in duration operation</value>
9+ <value>overflow/underflow in duration operation${: 1}</value>
10 </diagnostic>
11
12 <diagnostic code="FODT0003">
13
14=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
15--- src/diagnostics/pregenerated/dict_en.cpp 2013-04-01 02:22:49 +0000
16+++ src/diagnostics/pregenerated/dict_en.cpp 2013-04-03 03:40:32 +0000
17@@ -50,7 +50,7 @@
18 { "FODF1280", "\"$1\": invalid decimal format name for fn:format-number()" },
19 { "FODF1310", "\"$1\": invalid picture string for decimal/integer${: 2}" },
20 { "FODT0001", "overflow/underflow in date/time operation" },
21- { "FODT0002", "overflow/underflow in duration operation" },
22+ { "FODT0002", "overflow/underflow in duration operation${: 1}" },
23 { "FODT0003", "\"$1\": invalid timezone value (in seconds)" },
24 { "FOER0000", "unidentifier error" },
25 { "FOFD1340", "\"$1\": invalid picture string for date/time${: 2}" },
26
27=== modified file 'src/runtime/core/arithmetic_impl.cpp'
28--- src/runtime/core/arithmetic_impl.cpp 2013-03-20 19:12:54 +0000
29+++ src/runtime/core/arithmetic_impl.cpp 2013-04-03 03:40:32 +0000
30@@ -596,8 +596,12 @@
31 throw XQUERY_EXCEPTION( err::FODT0002, ERROR_LOC( loc ) );
32 else if (i1->getDoubleValue().isNaN())
33 throw XQUERY_EXCEPTION( err::FOCA0005, ERROR_LOC( loc ) );
34- else
35+ else try {
36 d.reset(i0->getYearMonthDurationValue() * (i1->getDoubleValue()));
37+ } catch (XQueryException& e) {
38+ set_source(e, *loc);
39+ throw;
40+ }
41
42 return GENV_ITEMFACTORY->createYearMonthDuration(result, d.get());
43 }
44@@ -618,8 +622,12 @@
45 throw XQUERY_EXCEPTION( err::FODT0002, ERROR_LOC( loc ) );
46 else if (i1->getDoubleValue().isNaN())
47 throw XQUERY_EXCEPTION( err::FOCA0005, ERROR_LOC( loc ) );
48- else
49+ else try {
50 d.reset(i0->getDayTimeDurationValue() * (i1->getDoubleValue()));
51+ } catch (XQueryException& e) {
52+ set_source(e, *loc);
53+ throw;
54+ }
55
56 return GENV_ITEMFACTORY->createDayTimeDuration(result, d.get());
57 }
58@@ -674,8 +682,12 @@
59 throw XQUERY_EXCEPTION( err::FODT0002, ERROR_LOC( loc ) );
60 else if ( i1->getDoubleValue().isNaN() )
61 throw XQUERY_EXCEPTION( err::FOCA0005, ERROR_LOC( loc ) );
62- else
63+ else try {
64 d = std::auto_ptr<Duration>(i0->getYearMonthDurationValue() / i1->getDoubleValue());
65+ } catch (XQueryException& e) {
66+ set_source(e, *loc);
67+ throw;
68+ }
69
70 return GENV_ITEMFACTORY->createYearMonthDuration(result, d.get());
71 }
72@@ -700,8 +712,12 @@
73 throw XQUERY_EXCEPTION( err::FODT0002, ERROR_LOC( loc ) );
74 else if ( i1->getDoubleValue().isNaN() )
75 throw XQUERY_EXCEPTION( err::FOCA0005, ERROR_LOC( loc ) );
76- else
77+ else try {
78 d.reset(i0->getDayTimeDurationValue() / i1->getDoubleValue());
79+ } catch (XQueryException& e) {
80+ set_source(e, *loc);
81+ throw;
82+ }
83
84 return GENV_ITEMFACTORY->createDayTimeDuration(result, d.get());
85 }
86
87=== modified file 'src/zorbatypes/datetime/duration.cpp'
88--- src/zorbatypes/datetime/duration.cpp 2013-03-11 15:00:50 +0000
89+++ src/zorbatypes/datetime/duration.cpp 2013-04-03 03:40:32 +0000
90@@ -41,6 +41,7 @@
91 0, 12, 30, 24, 60, 60, Duration::FRAC_SECONDS_UPPER_LIMIT
92 };
93
94+static const long seconds_per_year = 60 * 60 * 24 * 30 * 12;
95
96 /******************************************************************************
97 Parse a 'nS' string, with fractional seconds, returns 0 on success and a
98@@ -725,12 +726,24 @@
99 }
100
101
102+#define TRY_XS_INT_CONVERT(target, value, xs_type) \
103+ { \
104+ xs_type const res(value); \
105+ try { \
106+ target = to_xs_int(res); \
107+ } catch (std::range_error const&) { \
108+ throw XQUERY_EXCEPTION(err::FODT0002, ERROR_PARAMS(res.toString())); \
109+ } \
110+ }
111+
112 Duration* Duration::operator*(const xs_double& value) const
113 {
114 xs_double result;
115- xs_double dSeconds;
116+ xs_integer totalSeconds;
117+ int32_t years;
118 int32_t seconds;
119 int32_t frac_seconds;
120+ bool negative = false;
121
122 if (facet == DURATION_FACET)
123 {
124@@ -738,19 +751,26 @@
125 return NULL;
126 }
127
128- Integer significants = Integer(FRAC_SECONDS_UPPER_LIMIT);
129-
130 try {
131 result = getTotalSeconds() * value;
132- result = result.round(significants);
133- seconds = to_xs_int(result.floor());
134- result = (result - result.floor()) * FRAC_SECONDS_UPPER_LIMIT;
135- frac_seconds = to_xs_int(result.round());
136- } catch ( std::range_error const& ) {
137+ } catch (std::range_error const&) {
138 throw XQUERY_EXCEPTION(err::FODT0002);
139 }
140
141- Duration* d = new Duration(facet, seconds<0, 0, 0, 0, 0, 0, seconds, frac_seconds);
142+ if (result < 0)
143+ {
144+ negative = true;
145+ result = -result;
146+ }
147+ result = result.round(Integer(FRAC_SECONDS_UPPER_LIMIT));
148+ totalSeconds = result.floor();
149+ result = (result - result.floor()) * FRAC_SECONDS_UPPER_LIMIT;
150+
151+ TRY_XS_INT_CONVERT(years, totalSeconds / seconds_per_year, xs_integer);
152+ TRY_XS_INT_CONVERT(seconds, totalSeconds % seconds_per_year, xs_integer);
153+ TRY_XS_INT_CONVERT(frac_seconds, result.round(), xs_double);
154+
155+ Duration* d = new Duration(facet, negative, years, 0, 0, 0, 0, seconds, frac_seconds);
156 return d;
157 }
158
159@@ -758,9 +778,11 @@
160 Duration* Duration::operator/(const xs_double& value) const
161 {
162 xs_double result;
163- xs_double dSeconds;
164+ xs_integer totalSeconds;
165+ int32_t years;
166 int32_t seconds;
167 int32_t frac_seconds;
168+ bool negative = false;
169
170 if (facet == DURATION_FACET)
171 {
172@@ -768,23 +790,31 @@
173 return NULL;
174 }
175
176- Integer significants = Integer(FRAC_SECONDS_UPPER_LIMIT);
177-
178 try {
179 result = getTotalSeconds() / value;
180- result = result.round(significants);
181- dSeconds = result.round();
182- seconds = to_xs_int(dSeconds.floor());
183- result = (result - dSeconds) * FRAC_SECONDS_UPPER_LIMIT;
184- frac_seconds = to_xs_int(result.round());
185- } catch ( std::range_error const& ) {
186+ } catch (std::range_error const&) {
187 throw XQUERY_EXCEPTION(err::FODT0002);
188 }
189
190- Duration* d = new Duration(facet, seconds<0, 0, 0, 0, 0, 0, seconds, frac_seconds);
191+ if (result < 0)
192+ {
193+ negative = true;
194+ result = -result;
195+ }
196+ result = result.round(Integer(FRAC_SECONDS_UPPER_LIMIT));
197+ totalSeconds = result.floor();
198+ result = (result - result.floor()) * FRAC_SECONDS_UPPER_LIMIT;
199+
200+ TRY_XS_INT_CONVERT(years, totalSeconds / seconds_per_year, xs_integer);
201+ TRY_XS_INT_CONVERT(seconds, totalSeconds % seconds_per_year, xs_integer);
202+ TRY_XS_INT_CONVERT(frac_seconds, result.round(), xs_double);
203+
204+ Duration* d = new Duration(facet, negative, years, 0, 0, 0, 0, seconds, frac_seconds);
205 return d;
206 }
207
208+#undef TRY_XS_INT_CONVERT
209+
210
211 Decimal Duration::operator/(const Duration& d) const
212 {
213
214=== modified file 'test/fots/CMakeLists.txt'
215--- test/fots/CMakeLists.txt 2013-04-02 18:29:15 +0000
216+++ test/fots/CMakeLists.txt 2013-04-03 03:40:32 +0000
217@@ -133,8 +133,6 @@
218 EXPECTED_FOTS_FAILURE (fn-adjust-dateTime-to-timezone cbcl-adjust-dateTime-to-timezone-002 0)
219 EXPECTED_FOTS_FAILURE (fn-adjust-dateTime-to-timezone cbcl-adjust-dateTime-to-timezone-003 0)
220 EXPECTED_FOTS_FAILURE (fn-available-environment-variables fn-available-environment-variables-011 0)
221-EXPECTED_FOTS_FAILURE (fn-avg cbcl-avg-002 0)
222-EXPECTED_FOTS_FAILURE (fn-avg cbcl-avg-003 0)
223 EXPECTED_FOTS_FAILURE (fn-deep-equal K2-SeqDeepEqualFunc-36 0)
224 EXPECTED_FOTS_FAILURE (fn-deep-equal K2-SeqDeepEqualFunc-37 0)
225 EXPECTED_FOTS_FAILURE (fn-deep-equal K2-SeqDeepEqualFunc-38 0)
226@@ -144,15 +142,12 @@
227 EXPECTED_FOTS_FAILURE (fn-environment-variable environment-variable-005 0)
228 EXPECTED_FOTS_FAILURE (fn-environment-variable environment-variable-006 0)
229 EXPECTED_FOTS_FAILURE (fn-environment-variable environment-variable-007 0)
230-EXPECTED_FOTS_FAILURE (fn-format-date format-date-005 0)
231-EXPECTED_FOTS_FAILURE (fn-format-date format-date-006 0)
232 EXPECTED_FOTS_FAILURE (fn-format-date format-date-en126 0)
233 EXPECTED_FOTS_FAILURE (fn-format-date format-date-en127 0)
234 EXPECTED_FOTS_FAILURE (fn-format-date format-date-en128 0)
235 EXPECTED_FOTS_FAILURE (fn-format-date format-date-en132 0)
236 EXPECTED_FOTS_FAILURE (fn-format-date format-date-en133 0)
237 EXPECTED_FOTS_FAILURE (fn-format-date format-date-en134 0)
238-EXPECTED_FOTS_FAILURE (fn-format-dateTime format-dateTime-005 0)
239 EXPECTED_FOTS_FAILURE (fn-format-dateTime format-dateTime-006 0)
240 EXPECTED_FOTS_FAILURE (fn-format-dateTime format-dateTime-011 0)
241 EXPECTED_FOTS_FAILURE (fn-format-integer format-integer-044 1162631)
242@@ -286,12 +281,8 @@
243 EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0001-8 0)
244 EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0001-9 0)
245 EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0002-1 0)
246-EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0002-2 0)
247-EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0002-3 0)
248 EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0002-4 0)
249 EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0002-6 0)
250-EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0002-7 0)
251-EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0002-8 0)
252 EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes FODT0002-9 0)
253 EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes XQST0046_13 0)
254 EXPECTED_FOTS_FAILURE (misc-CombinedErrorCodes XQST0046_14 0)
255@@ -321,11 +312,9 @@
256 EXPECTED_FOTS_FAILURE (op-date-greater-than cbcl-date-le-001 0)
257 EXPECTED_FOTS_FAILURE (op-date-less-than cbcl-date-ge-001 0)
258 EXPECTED_FOTS_FAILURE (op-date-less-than cbcl-date-lt-001 0)
259-EXPECTED_FOTS_FAILURE (op-divide-dayTimeDuration cbcl-divide-dayTimeDuration-003 0)
260 EXPECTED_FOTS_FAILURE (op-divide-dayTimeDuration-by-dayTimeDuration cbcl-divide-dayTimeDuration-by-dayTimeDuration-001 0)
261 EXPECTED_FOTS_FAILURE (op-divide-dayTimeDuration-by-dayTimeDuration cbcl-divide-dayTimeDuration-by-dayTimeDuration-002 0)
262 EXPECTED_FOTS_FAILURE (op-divide-dayTimeDuration-by-dayTimeDuration cbcl-divide-dayTimeDuration-by-dayTimeDuration-003 0)
263-EXPECTED_FOTS_FAILURE (op-divide-yearMonthDuration cbcl-divide-yearMonthDuration-003 0)
264 EXPECTED_FOTS_FAILURE (op-divide-yearMonthDuration-by-yearMonthDuration cbcl-divide-yearMonthDuration-by-yearMonthDuration-001 0)
265 EXPECTED_FOTS_FAILURE (op-subtract-dateTimes cbcl-subtract-dateTimes-001 0)
266 EXPECTED_FOTS_FAILURE (op-subtract-dateTimes cbcl-subtract-dateTimes-002 0)
267
268=== renamed file 'test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-101.res' => 'test/rbkt/ExpQueryResults/zorba/HigherOrder/combinator-02.xml.res'
269--- test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-101.res 2013-02-07 17:24:36 +0000
270+++ test/rbkt/ExpQueryResults/zorba/HigherOrder/combinator-02.xml.res 2013-04-03 03:40:32 +0000
271@@ -1,1 +1,2 @@
272 <?xml version="1.0" encoding="UTF-8"?>
273+1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 -1
274
275=== added file 'test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-101.xml.res'
276--- test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-101.xml.res 1970-01-01 00:00:00 +0000
277+++ test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-101.xml.res 2013-04-03 03:40:32 +0000
278@@ -0,0 +1,2 @@
279+<?xml version="1.0" encoding="UTF-8"?>
280+Message: This is a test.
281
282=== added file 'test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-104.xml.res'
283--- test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-104.xml.res 1970-01-01 00:00:00 +0000
284+++ test/rbkt/ExpQueryResults/zorba/HigherOrder/hof-104.xml.res 2013-04-03 03:40:32 +0000
285@@ -0,0 +1,2 @@
286+<?xml version="1.0" encoding="UTF-8"?>
287+wbua
288
289=== added file 'test/rbkt/Queries/zorba/HigherOrder/combinator-01.spec'
290--- test/rbkt/Queries/zorba/HigherOrder/combinator-01.spec 1970-01-01 00:00:00 +0000
291+++ test/rbkt/Queries/zorba/HigherOrder/combinator-01.spec 2013-04-03 03:40:32 +0000
292@@ -0,0 +1,1 @@
293+Error: http://www.zorba-xquery.com/errors:ZXQP0003
294\ No newline at end of file
295
296=== added file 'test/rbkt/Queries/zorba/HigherOrder/combinator-01.xq'
297--- test/rbkt/Queries/zorba/HigherOrder/combinator-01.xq 1970-01-01 00:00:00 +0000
298+++ test/rbkt/Queries/zorba/HigherOrder/combinator-01.xq 2013-04-03 03:40:32 +0000
299@@ -0,0 +1,7 @@
300+(: Infinite Y combinator test -- should cause a stack overflow :)
301+
302+declare function local:Y($f) {
303+ function($a) { $f(local:Y($f), $a) }
304+};
305+
306+local:Y(function($f, $a) { $a, $f($a + 1) })(1)
307
308=== renamed file 'test/rbkt/Queries/zorba/HigherOrder/hof-101.xq' => 'test/rbkt/Queries/zorba/HigherOrder/combinator-02.xq'
309--- test/rbkt/Queries/zorba/HigherOrder/hof-101.xq 2013-02-07 17:24:36 +0000
310+++ test/rbkt/Queries/zorba/HigherOrder/combinator-02.xq 2013-04-03 03:40:32 +0000
311@@ -1,10 +1,7 @@
312-xquery version "3.0";
313-
314-declare namespace o = "http://www.zorba-xquery.com/options/features";
315-declare option o:enable "hof";
316+(: Y combinator test :)
317
318 declare function local:Y($f) {
319 function($a) { $f(local:Y($f), $a) }
320 };
321
322-local:Y(function($f, $a) { $a, $f($a + 1) })(1)
323+local:Y(function($f, $a) { $a, if ($a < 500) then $f($a + 1) else -1 })(1)
324
325=== added file 'test/rbkt/Queries/zorba/HigherOrder/hof-101.xq'
326--- test/rbkt/Queries/zorba/HigherOrder/hof-101.xq 1970-01-01 00:00:00 +0000
327+++ test/rbkt/Queries/zorba/HigherOrder/hof-101.xq 2013-04-03 03:40:32 +0000
328@@ -0,0 +1,27 @@
329+declare namespace an = "http://www.zorba-xquery.com/annotations";
330+
331+declare %private variable $handlers := ();
332+
333+declare %an:sequential function local:add($handler)
334+{
335+ $handlers := ($handlers, $handler);
336+};
337+
338+declare function local:emit($message)
339+{
340+ for $h in $handlers
341+ return $h($message)
342+};
343+
344+declare function local:handle($message)
345+{
346+ ("Message:", $message)
347+};
348+
349+declare %an:sequential function local:test($message)
350+{
351+ local:add(local:handle#1);
352+ local:emit($message)
353+};
354+
355+local:test("This is a test.")
356
357=== added file 'test/rbkt/Queries/zorba/HigherOrder/hof-104.xq'
358--- test/rbkt/Queries/zorba/HigherOrder/hof-104.xq 1970-01-01 00:00:00 +0000
359+++ test/rbkt/Queries/zorba/HigherOrder/hof-104.xq 2013-04-03 03:40:32 +0000
360@@ -0,0 +1,9 @@
361+(: Higher order function as a prolog variable :)
362+
363+declare variable $func := function($x){translate($x, "abcdefghijklmnopqrstuvwxyz", "nopqrstuvwxyzabcdefghijklm")};
364+
365+declare function local:scramble($x as function(xs:string) as xs:string, $y as xs:string) as xs:string {
366+ $x($y)
367+};
368+
369+local:scramble($func, "john")
370
371=== added file 'test/rbkt/Queries/zorba/HigherOrder/hof-105.spec'
372--- test/rbkt/Queries/zorba/HigherOrder/hof-105.spec 1970-01-01 00:00:00 +0000
373+++ test/rbkt/Queries/zorba/HigherOrder/hof-105.spec 2013-04-03 03:40:32 +0000
374@@ -0,0 +1,1 @@
375+Error: http://www.w3.org/2005/xqt-errors:SENR0001
376\ No newline at end of file
377
378=== added file 'test/rbkt/Queries/zorba/HigherOrder/hof-105.xq'
379--- test/rbkt/Queries/zorba/HigherOrder/hof-105.xq 1970-01-01 00:00:00 +0000
380+++ test/rbkt/Queries/zorba/HigherOrder/hof-105.xq 2013-04-03 03:40:32 +0000
381@@ -0,0 +1,3 @@
382+function($a,$b){
383+ function($a1,$b1){ $a1($b1) }
384+}(function($a2){$a2}, "test")

Subscribers

People subscribed via source and target branches