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