1-- Selected test cases to reduce both the archive size and runtime. For the 2-- large test suite, download the separate mpdecimal-testdata distribution and 3-- replace the testdata_dist directory. 4 5rounding: half_even 6xfmt1 format .12345 '\xe6\xae\x8d<50.23' -> '0.12345\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d\xe6\xae\x8d' 7xfmt4 format -2815980E0 ',' -> '-2,815,980' 8 9-- alignment of specials 10xfmt12201 format sNaN '+10.10' -> ' +sNaN' 11xfmt12202 format Inf ' 10.10' -> ' Infinity' 12xfmt12203 format Inf ' 10.10' -> ' Infinity' 13 14-- zero padding of specials 15xfmt12204 format NaN '010' -> ' NaN' 16 17-- zero padding conflicts with alignment specifier 18xfmt12205 format 999 '<010' -> NULL Invalid_operation 19 20-- zero minimum width 21xfmt12206 format 999 '00.10' -> NULL Invalid_operation 22 23-- excessive minimum width 24xfmt12207 format 999 '18446744073709551616.10' -> NULL Invalid_operation 25 26-- invalid fraction digits 27xfmt12207 format 999 '100.-10' -> NULL Invalid_operation 28 29-- excessive number of fraction digits 30xfmt12207 format 999 '100.18446744073709551616' -> NULL Invalid_operation 31 32-- trailing garbage 33xfmt12208 format 999 '10x' -> NULL Invalid_operation 34 35-- excess precision after rescale 36xfmt12209 format 999999999e20 '.7e' -> 1.0000000e+29 37 38-- illegal UTF-8 sequences (see http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt) 39xfmt12211 format Inf '\xfe=10.10' -> NULL Invalid_operation 40xfmt12212 format Inf '\xff=10.10' -> NULL Invalid_operation 41xfmt12213 format Inf '\xfe\xfe\xff\xff=10.10' -> NULL Invalid_operation 42xfmt12214 format Inf '\xc0\xaf=10.10' -> NULL Invalid_operation 43xfmt12215 format Inf '\xe0\x80\xaf=10.10' -> NULL Invalid_operation 44xfmt12216 format Inf '\xf0\x80\x80\xaf<10.10' -> NULL Invalid_operation 45xfmt12217 format Inf '\xc1\xbf>10.10' -> NULL Invalid_operation 46xfmt12218 format Inf '\xe0\x9f\xbf^10.10' -> NULL Invalid_operation 47xfmt12219 format Inf '\xf0\x8f\xbf\xbf=10.10' -> NULL Invalid_operation 48xfmt12220 format Inf '\xed\xa0\x80=10.10' -> NULL Invalid_operation 49xfmt12221 format Inf '\xf4\x90\x80\x80=10.10' -> NULL Invalid_operation 50 51-- more illegal UTF-8 sequences 52xfmt12222 format Inf '\xf1\xf1\xf1\xf1=10.10' -> NULL Invalid_operation 53 54 55-- power of 10 boundaries 56xfmt12224 format 99999 'g' -> 99999 57xfmt12225 format 99999 '.6g' -> 99999 58xfmt12226 format 99999 '.5g' -> 99999 59xfmt12227 format 99999 '.4g' -> 1.000e+5 60xfmt12228 format 99999 '.3g' -> 1.00e+5 61xfmt12229 format 99999 '.2g' -> 1.0e+5 62xfmt12230 format 99999 '.1g' -> 1e+5 63xfmt12231 format 99999 '.0g' -> 1e+5 64 65xfmt12232 format 99999 'e' -> 9.9999e+4 66xfmt12233 format 99999 '.6e' -> 9.999900e+4 67xfmt12234 format 99999 '.5e' -> 9.99990e+4 68xfmt12235 format 99999 '.4e' -> 9.9999e+4 69xfmt12236 format 99999 '.3e' -> 1.000e+5 70xfmt12237 format 99999 '.2e' -> 1.00e+5 71xfmt12238 format 99999 '.1e' -> 1.0e+5 72xfmt12239 format 99999 '.0e' -> 1e+5 73 74xfmt12240 format 9.9999 'f' -> 9.9999 75xfmt12241 format 9.9999 '.6f' -> 9.999900 76xfmt12242 format 9.9999 '.5f' -> 9.99990 77xfmt12243 format 9.9999 '.4f' -> 9.9999 78xfmt12244 format 9.9999 '.3f' -> 10.000 79xfmt12245 format 9.9999 '.2f' -> 10.00 80xfmt12246 format 9.9999 '.1f' -> 10.0 81xfmt12247 format 9.9999 '.0f' -> 10 82 83xfmt12248 format 9.99e425000000 'g' -> 9.99e+425000000 84xfmt12249 format 9.99e425000000 '.3g' -> 9.99e+425000000 85xfmt12250 format 9.99e425000000 '.2g' -> 1.0e+425000001 86xfmt12251 format 9.99e425000000 '.1g' -> 1e+425000001 87xfmt12252 format 9.99e425000000 '.0g' -> 1e+425000001 88 89xfmt12253 format 9.99e425000000 'e' -> 9.99e+425000000 90xfmt12254 format 9.99e425000000 '.3e' -> 9.990e+425000000 91xfmt12255 format 9.99e425000000 '.2e' -> 9.99e+425000000 92xfmt12256 format 9.99e425000000 '.1e' -> 1.0e+425000001 93xfmt12257 format 9.99e425000000 '.0e' -> 1e+425000001 94 95 96-- target exponent less than min_etiny 97xfmt12258 format 1e-849999999 '.10e' -> 1.0000000000e-849999999 98 99 100-- '%' formatting: add trailing percent sign for special values. 101xfmt12259 format NaN123 '%' -> 'NaN123%' 102xfmt12260 format sNaN '+10.10%' -> ' +sNaN%' 103xfmt12261 format Inf ' 10.10%' -> ' Infinity%' 104 105-- 'z' formatting: coerce to positive zero 106xfmt12300 format '-.508e+412' 'D=-z,.44%' -> '-508,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000000000000000000000000000000%' 107 108xfmt12301 format '0.00000000000000000000E9227' 'Q>-z,.440%' -> '0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000%' 109 110xfmt12302 format '-0.00000000000000000000E9227' 'Q>-z,.440%' -> '0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000%' 111 112 113-- 64-bit only 114cov64x00001 format 9.99e999999999999999999 'g' -> 9.99e+999999999999999999 115cov64x00002 format 9.99e999999999999999999 '.3g' -> 9.99e+999999999999999999 116cov64x00003 format 9.99e999999999999999999 '.2g' -> 1.0e+1000000000000000000 117cov64x00004 format 9.99e999999999999999999 '.1g' -> 1e+1000000000000000000 118cov64x00005 format 9.99e999999999999999999 '.0g' -> 1e+1000000000000000000 119 120cov64x00006 format 9.99e999999999999999999 'e' -> 9.99e+999999999999999999 121cov64x00007 format 9.99e999999999999999999 '.3e' -> 9.990e+999999999999999999 122cov64x00008 format 9.99e999999999999999999 '.2e' -> 9.99e+999999999999999999 123cov64x00009 format 9.99e999999999999999999 '.1e' -> 1.0e+1000000000000000000 124cov64x00010 format 9.99e999999999999999999 '.0e' -> 1e+1000000000000000000 125 126-- target exponent less than min_etiny 127cov64x00011 format 1e-1999999999999999997 '.10e' -> 1.0000000000e-1999999999999999997 128 129 130-- 32-bit only: result has too many digits for 'f' specifier. 131-- This test can legitimately fail with MPD_Malloc_error, thus it can produce 132-- a false positive. 133-- cov32x00012 format 1e-849999999 ',f' -> NULL Invalid_operation 134