1 2# Note: Please make sure that this utf-8 file contains a BOM. 3# Copyright (c) 2011, International Business Machines Corporation and 4# others. All Rights Reserved. 5# 6 7# File: dcfmtest.txt 8# 9# Decimal formatter test cases. 10# File Encoding: UTF-8 11# 12# The syntax for this file is this: 13# One test case per line. No continuations. No multiple cases per line. 14# 15# Parsing Test case line: 16# parse "input text" type "expected_decimal_text" 17# 18# Format Test Case Line: 19# format pattern round-mode "decimal number" "expected formatted result" 20# 21# Fields are separated by spaces or tabs. Input text to be parsed, decimal numbers 22# and formatted output are "quoted". Other fields are not. 23# 24# "type" is a single letter, representing the type that the ICU formattable produces 25# for the input. 26# d double 27# i int32 28# l int64 29# 30# RoundingMode is one of 31# default 32# ceiling 33# floor 34# down 35# up 36# halfeven 37# halfdown 38# halfup 39# 40 41parse "123.45" d "123.45" 42 43format 0.0000E0 default "1234.01" "1.2340E3" 44 45format 00 default "1234" "1234" 46format 00 default ".01" "00" 47format 00 default "1" "01" 48format 00 default "1.9" "02" 49 50format #.# default "12.34" "12.3" 51 52format @@@ default "12.3456" "12.3" 53format @@@ default "123456" "123000" 54format @@@ default ".00123456" "0.00123" 55 56format @@### default "12345678" "12346000" 57format @@### default "12300001" "12300000" 58format @@### default ".0012345678" "0.0012346" 59format @@### default ".0012300000" "0.00123" 60 61format @@@@E0 default "1234567" "1.235E6" 62format 0.0##E0 default "1234567" "1.235E6" 63format 00.##E0 default "1234567" "12.35E5" 64format 00.##E0 default "1234567E111" "12.35E116" 65format 00.##E0 default "-1234567E111" "-12.35E116" 66 67 68# 69# Rounding Modes 70# 71format 0.00 default "32.045" "32.04" 72format 0.00 floor "32.045" "32.04" 73format 0.00 ceiling "32.045" "32.05" 74format 0.00 down "32.045" "32.04" 75format 0.00 up "32.045" "32.05" 76format 0.00 halfeven "32.045" "32.04" 77format 0.00 halfdown "32.045" "32.04" 78format 0.00 halfup "32.045" "32.05" 79 80format 0.00 default "-32.045" "-32.04" 81format 0.00 floor "-32.045" "-32.05" 82format 0.00 ceiling "-32.045" "-32.04" 83format 0.00 down "-32.045" "-32.04" 84format 0.00 up "-32.045" "-32.05" 85format 0.00 halfeven "-32.045" "-32.04" 86format 0.00 halfdown "-32.045" "-32.04" 87format 0.00 halfup "-32.045" "-32.05" 88 89format @@@ default "1235.00" "1240" 90format @@@ floor "1235.00" "1230" 91format @@@ ceiling "1235.00" "1240" 92format @@@ down "1235.00" "1230" 93format @@@ up "1235.00" "1240" 94format @@@ halfeven "1235.00" "1240" 95format @@@ halfdown "1235.00" "1230" 96format @@@ halfup "1235.00" "1240" 97 98format @@@ default "-1235.00" "-1240" 99format @@@ floor "-1235.00" "-1240" 100format @@@ ceiling "-1235.00" "-1230" 101format @@@ down "-1235.00" "-1230" 102format @@@ up "-1235.00" "-1240" 103format @@@ halfeven "-1235.00" "-1240" 104format @@@ halfdown "-1235.00" "-1230" 105format @@@ halfup "-1235.00" "-1240" 106 107format 0.000E0 default "12345" "1.234E4" 108format 0.000E0 floor "12345" "1.234E4" 109format 0.000E0 ceiling "12345" "1.235E4" 110format 0.000E0 down "12345" "1.234E4" 111format 0.000E0 up "12345" "1.235E4" 112format 0.000E0 halfeven "12345" "1.234E4" 113format 0.000E0 halfdown "12345" "1.234E4" 114format 0.000E0 halfup "12345" "1.235E4" 115 116 117format 0.0## default "1.00001" "1.0" 118format 0.0## up "1.00001" "1.001" 119format 0.0## up "1.0000000000000000000000000000000000000000000000000001" "1.001" 120format 0.0## up "1.0000000000000000000000000000000000000000000000000000" "1.0" 121 122format # default "10000000000000000000000000000000000000000000000000001" "10000000000000000000000000000000000000000000000000001" 123 124format 0.#E0 default "1234" "1.2E3" 125format 0.##E0 default "1234" "1.23E3" 126format .0E0 default "1234" ".1E4" 127format .0#E0 default "1234" ".12E4" 128format 0.##E0 default "1234" "1.23E3" 129 130# RoundUnnecessary. Fail if result would be inexact. 131format 0.00 unnecessary "-32.045" "Inexact" 132format 0.00 unnecessary "-32.040" "-32.04" 133format 0.##E0 unnecessary "1230" "1.23E3" 134format 0.##E0 unnecessary "1231" "Inexact" 135format @@@ unnecessary "1230" "1230" 136format @@@ unnecessary "1231" "Inexact" 137format @@@@@@@@@@@@@@@@@@@@@@@@@ unnecessary "1234567890123456789012345" "1234567890123456789012345" 138format @@@@@@@@@@@@@@@@@@@@@@@@@ unnecessary "12345678901234567890123456" "Inexact" 139