This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2404 - Calculation of effective boolean value (var. tests)
Summary: Calculation of effective boolean value (var. tests)
Status: CLOSED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.7.0
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Carmelo Montanez
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-21 14:45 UTC by Martin Probst
Modified: 2006-06-22 12:56 UTC (History)
0 users

See Also:


Attachments

Description Martin Probst 2005-10-21 14:45:32 UTC
If I'm not mistaken, several tests are wrong due to an erroneous calculation of
the effective boolean value (iirc. the specification has changed in that aspect).

http://www.w3.org/TR/xpath-functions/#func-boolean (and the copy at
http://www.w3.org/TR/xquery/#id-ebv) states the following:
* If $arg is the empty sequence, fn:boolean returns false.
* If $arg is a sequence whose first item is a node, fn:boolean returns true.
* If $arg is a singleton value of type xs:boolean or a derived from xs:boolean,
  fn:boolean returns $arg.
* If $arg is a singleton value of type xs:string or a type derived from 
  xs:string or xdt:untypedAtomic, fn:boolean returns false if the operand 
  value has zero length; otherwise it returns true.
* If $arg is a singleton value of any numeric type or a type derived from a 
  numeric type, fn:boolean returns false if the operand value is NaN or is 
  numerically equal to zero; otherwise it returns true.
* In all other cases, fn:boolean raises a type error [err:FORG0006].

I believe the following tests should raise a type error (err:FORG0006):

AdjDateTimeToTimezoneFunc fn-adjust-dateTime-to-timezone-12
AdjDateTimeToTimezoneFunc fn-adjust-dateTime-to-timezone-13
AdjDateTimeToTimezoneFunc fn-adjust-dateTime-to-timezone-14
AdjDateTimeToTimezoneFunc fn-adjust-dateTime-to-timezone-15
AdjDateTimeToTimezoneFunc fn-adjust-dateTime-to-timezone-16
AdjDateTimeToTimezoneFunc fn-adjust-dateTime-to-timezone-17
AdjDateToTimezoneFunc fn-adjust-date-to-timezone-12
AdjDateToTimezoneFunc fn-adjust-date-to-timezone-13
AdjDateToTimezoneFunc fn-adjust-date-to-timezone-14
AdjDateToTimezoneFunc fn-adjust-date-to-timezone-15
AdjDateToTimezoneFunc fn-adjust-date-to-timezone-16
AdjDateToTimezoneFunc fn-adjust-date-to-timezone-17
AdjTimeToTimezoneFunc fn-adjust-time-to-timezone-12
AdjTimeToTimezoneFunc fn-adjust-time-to-timezone-13
AdjTimeToTimezoneFunc fn-adjust-time-to-timezone-14
AdjTimeToTimezoneFunc fn-adjust-time-to-timezone-15
AdjTimeToTimezoneFunc fn-adjust-time-to-timezone-16
AdjTimeToTimezoneFunc fn-adjust-time-to-timezone-17
DateAddDTD op-add-dayTimeDuration-to-datealt-2
DateAddDTD op-add-dayTimeDuration-to-date-3
DateAddDTD op-add-dayTimeDuration-to-date-4
DateAddDTD op-add-dayTimeDuration-to-date-5
DateAddDTD op-add-dayTimeDuration-to-date-9
DateAddDTD op-add-dayTimeDuration-to-date-10
DateAddDTD op-add-dayTimeDuration-to-date-12
DateAddYMD op-add-yearMonthDuration-to-date-2
DateAddYMD op-add-yearMonthDuration-to-date-3
DateAddYMD op-add-yearMonthDuration-to-date-4
DateAddYMD op-add-yearMonthDuration-to-date-5
DateAddYMD op-add-yearMonthDuration-to-date-9
DateAddYMD op-add-yearMonthDuration-to-date-10
DateAddYMD op-add-yearMonthDuration-to-date-12
DateSubtractDTD op-subtract-dayTimeDuration-from-date-2
DateSubtractDTD op-subtract-dayTimeDuration-from-date-3
DateSubtractDTD op-subtract-dayTimeDuration-from-date-4
DateSubtractDTD op-subtract-dayTimeDuration-from-date-5
DateSubtractDTD op-subtract-dayTimeDuration-from-date-9
DateSubtractDTD op-subtract-dayTimeDuration-from-date-10
DateSubtractDTD op-subtract-dayTimeDuration-from-date-12
DateSubtractYMD op-subtract-yearMonthDuration-from-date-4
DateSubtractYMD op-subtract-yearMonthDuration-from-date-5
DateSubtractYMD op-subtract-yearMonthDuration-from-date-9
DateSubtractYMD op-subtract-yearMonthDuration-from-date-10
DateSubtractYMD op-subtract-yearMonthDuration-from-date-12
DateSubtractYMD op-subtract-yearMonthDuration-from-date-17
DateSubtractYMD op-subtract-yearMonthDuration-from-date-18
DateTimeAddDTD op-add-dayTimeDuration-to-dateTime-2
DateTimeAddDTD op-add-dayTimeDuration-to-dateTime-3
DateTimeAddDTD op-add-dayTimeDuration-to-dateTime-4
DateTimeAddDTD op-add-dayTimeDuration-to-dateTime-5
DateTimeAddDTD op-add-dayTimeDuration-to-dateTime-9
DateTimeAddDTD op-add-dayTimeDuration-to-dateTime-10
DateTimeAddDTD op-add-dayTimeDuration-to-dateTime-12
DateTimeSubtractDTD op-subtract-dayTimeDuration-from-dateTime-2
DateTimeSubtractDTD op-subtract-dayTimeDuration-from-dateTime-3
DateTimeSubtractDTD op-subtract-dayTimeDuration-from-dateTime-4
DateTimeSubtractDTD op-subtract-dayTimeDuration-from-dateTime-5
DateTimeSubtractDTD op-subtract-dayTimeDuration-from-dateTime-9
DateTimeSubtractDTD op-subtract-dayTimeDuration-from-dateTime-10
DateTimeSubtractDTD op-subtract-dayTimeDuration-from-dateTime-12
DateTimeSubtractYMD op-subtract-yearMonthDuration-from-dateTime-2
DateTimeSubtractYMD op-subtract-yearMonthDuration-from-dateTime-3
DateTimeSubtractYMD op-subtract-yearMonthDuration-from-dateTime-4
DateTimeSubtractYMD op-subtract-yearMonthDuration-from-dateTime-5
DateTimeSubtractYMD op-subtract-yearMonthDuration-from-dateTime-9
DateTimeSubtractYMD op-subtract-yearMonthDuration-from-dateTime-10
DateTimeSubtractYMD op-subtract-yearMonthDuration-from-dateTime-12
DatesSubtract op-subtract-dates-yielding-DTD-4
DayTimeDurationDivide op-divide-dayTimeDuration-2
DayTimeDurationMultiply op-multiply-dayTimeDuration-2
DayTimeDurationMultiply op-multiply-dayTimeDuration-12
DayTimeDurationSubtract op-subtract-dayTimeDurations-2
TimeSubtractDTD op-subtract-dayTimeDuration-from-time-3
TimeSubtractDTD op-subtract-dayTimeDuration-from-time-4
TimeSubtractDTD op-subtract-dayTimeDuration-from-time-5
TimeSubtractDTD op-subtract-dayTimeDuration-from-time-9
TimeSubtractDTD op-subtract-dayTimeDuration-from-time-10
TimeSubtractDTD op-subtract-dayTimeDuration-from-time-12
TimeSubtractDTD op-subtract-dayTimeDuration-from-time-17
YearMonthDurationAddDT op-add-yearMonthDuration-to-dateTime-2
YearMonthDurationAddDT op-add-yearMonthDuration-to-dateTime-3
YearMonthDurationAddDT op-add-yearMonthDuration-to-dateTime-4
YearMonthDurationAddDT op-add-yearMonthDuration-to-dateTimealt-5
YearMonthDurationAddDT op-add-yearMonthDuration-to-dateTime-9
YearMonthDurationAddDT op-add-yearMonthDuration-to-dateTime-10
YearMonthDurationAddDT op-add-yearMonthDuration-to-dateTime-12
dateTimesSubtract op-subtract-dateTimes-yielding-DTD-9

They all perform some sort of calculation of the effective boolean value on
date/duration values, either by explicitly calling fn:boolean or by using the
value in and "and" or "or" expression.

These values are not nodes, not derived from numeric, not strings or
untypedAtomics so the last case kicks in.
Comment 1 Martin Probst 2005-10-21 16:51:29 UTC
Sorry, I only searched for "effective boolean value" and not for "EBV", which is
the keyword Michael Kay used in bug #2352.

This is however not a complete dup, there are 17 more cases in this bug. I will
try to sort them out on Monday.
Comment 2 Carmelo Montanez 2005-10-26 15:09:16 UTC
Martin:

I will doublce check the tests.  Al lot of this was reported by Michael Kay,
so it is possible that a lot of this already been fixed.

Carmelo
Comment 3 Carmelo Montanez 2005-10-26 15:09:36 UTC
Martin:

I will doublce check the tests.  Al lot of this was reported by Michael Kay,
so it is possible that a lot of this already been fixed.

Carmelo
Comment 4 Carmelo Montanez 2005-10-27 18:45:41 UTC
Martin:

Tests were changed to use the string value of the type.  Changed tests and
results were submitted.  Please close the bug if you agree with the
resolution.

Thanks,
Carmelo