90701: Function test for xfi:format-number

Documentation

Tests of function xfi: format-number($value as numeric?, $picture as xs:string) as xs:string The test cases below assume 'en' globalization settings, e.g., '.' for decimals point, ',' for thousands separator.

Owners

Name Affiliation Email Start End
Herm Fischer UBMatrix / Mark V Systems fischer@markv.com 13-12-2009 at 00:00:00

References

http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670666

http://www.w3.org/TR/xslt20/#format-number

Test Case Variations


V-01 Zero-absent integer case, nonzero

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V01)
  • Function Call: xfi:format-number(123456, "#")

    (against file V01)

Outputs

  • Result test: $result eq '123456'

V-02 Zero-absent integer case, zero

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V02)
  • Function Call: xfi:format-number(0, "#")

    (against file V02)

Outputs

  • Result test: $result eq '0'

V-03 Zero-present integer case

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V03)
  • Function Call: xfi:format-number(0, "0")

    (against file V03)

Outputs

  • Result test: $result eq '0'

V-04 Decimals case

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V04)
  • Function Call: xfi:format-number(123456, "#.00")

    (against file V04)

Outputs

  • Result test: $result eq '123456.00'

V-05 Thousands separator case

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V05)
  • Function Call: xfi:format-number(123456, "###,###.00")

    (against file V05)

Outputs

  • Result test: $result eq '123,456.00'

V-06 Percent case

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V06)
  • Function Call: xfi:format-number(.1234, "#.00%")

    (against file V06)

Outputs

  • Result test: $result eq '12.34%'

V-07 Empty sequence input case

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V07)
  • Function Call: xfi:format-number((), "0")

    (against file V07)

Outputs

  • Result test: $result eq 'NaN'

V-08 Non-numeric input case

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V08)
  • Function Call: xfi:format-number("hello world", "0")

    (against file V08)

Outputs

  • Error code: xqt-err:XPTY0004

V-09 Picture syntax error case

Documentation

Inputs

  • schema: default.xsd (DTS Discovery starting point) (ID=V09)
  • Function Call: xfi:format-number(123456,"hello world")

    (against file V09)

Outputs

  • Error code: xfie:invalidPictureSyntax

Revisions

Name On Details
Herm Fischer 13-12-2009 at 00:00:00 Created the test case.
Herm Fischer 27-10-2010 at 12:00:00 Fixed issues raised by Okumura-san.