| 1 |
// Copyright (C) 2016 and later: Unicode, Inc. and others. |
| 2 |
// License & terms of use: http://www.unicode.org/copyright.html |
| 3 |
//***************************************************************************** |
| 4 |
// |
| 5 |
// Copyright (C) 2004-2006, International Business Machines |
| 6 |
// Corporation and others. All Rights Reserved. |
| 7 |
// |
| 8 |
// file name: icuio.txt |
| 9 |
// encoding: US-ASCII |
| 10 |
// tab size: 4 (not used) |
| 11 |
// indentation:4 |
| 12 |
// |
| 13 |
// created on: 2004Apr06 |
| 14 |
// created by: George Rhoten |
| 15 |
// |
| 16 |
// ICU resource bundle source file with test data for data-driven ICU I/O tests. |
| 17 |
// |
| 18 |
//***************************************************************************** |
| 19 |
|
| 20 |
icuio:table(nofallback) { |
| 21 |
Info { |
| 22 |
Description { "Test data for ICU I/O" } |
| 23 |
LongDescription { |
| 24 |
"Test data for data-driven conversion tests in icu/source/test/iotest/iotest.cpp\n" |
| 25 |
"Run iotest printf\n" |
| 26 |
|
| 27 |
"argumentType:\n" |
| 28 |
"\td: double\n" |
| 29 |
"\tf: float\n" |
| 30 |
"\t1: int8_t (hexadecimal)\n" |
| 31 |
"\t2: int16_t (hexadecimal)\n" |
| 32 |
"\t4: int32_t (hexadecimal)\n" |
| 33 |
"\t8: int64_t (hexadecimal)\n" |
| 34 |
"\ts: char * string\n" |
| 35 |
"\tS: UChar * string\n" |
| 36 |
} |
| 37 |
} |
| 38 |
TestData { |
| 39 |
printf { |
| 40 |
Headers { "format", "result", "argumentType", "argument" } |
| 41 |
Cases { |
| 42 |
{ "%5.3S", " abc", "S", "abcde" } |
| 43 |
{ "%-5.3S", "abc ", "S", "abcde" } |
| 44 |
{ "%5.3S", " abc", "S", "abcdef" } |
| 45 |
{ "%-5.3S", "abc ", "S", "abcdef" } |
| 46 |
{ "%5.3S", " a", "S", "a" } |
| 47 |
{ "%-5.3S", "a ", "S", "a" } |
| 48 |
{ "%5.3s", " abc", "s", "abcde" } |
| 49 |
{ "%-5.3s", "abc ", "s", "abcde" } |
| 50 |
{ "%5.3s", " abc", "s", "abcdef" } |
| 51 |
{ "%-5.3s", "abc ", "s", "abcdef" } |
| 52 |
{ "%5.3s", " a", "s", "a" } |
| 53 |
{ "%-5.3s", "a ", "s", "a" } |
| 54 |
{ "%5.3C", " a", "2", "61" } |
| 55 |
{ "%-5.3C", "a ", "2", "61" } |
| 56 |
{ "%-5.0C", "a ", "2", "61" } // Make sure that the precision is ignored. |
| 57 |
{ "%.3P", "120.000%", "d", "1.2" } |
| 58 |
{ "%.0P", "120%", "d", "1.2" } |
| 59 |
{ "%.3P", "1.200%", "d", "0.012" } |
| 60 |
{ "%.0P", "1%", "d", "0.012" } |
| 61 |
{ "%04.0P", "001%", "d", "0.012" } |
| 62 |
{ "%+4.0P", " +1%", "d", "0.012" } |
| 63 |
{ "%e", "1.200000e+000", "d", "1.2" } |
| 64 |
{ "%e", "1.234568e+006", "d", "1234567.89" } |
| 65 |
{ "%E", "1.234568E+006", "d", "1234567.89" } |
| 66 |
{ "%10e", "1.234568e+000", "d", "1.23456789" } |
| 67 |
{ "%10.4e", "1.2346e+000", "d", "1.23456789" } |
| 68 |
{ "%-10e", "1.234568e+000", "d", "1.23456789" } |
| 69 |
{ "%10e", "1.234568e+002", "d", "123.456789" } |
| 70 |
{ "%-10e", "1.234568e+002", "d", "123.456789" } |
| 71 |
{ "%-+12.1e", "+1.2e+000 ", "d", "1.234" } |
| 72 |
{ "%-+12.1e", "-1.2e+000 ", "d", "-1.234" } |
| 73 |
{ "%- 12.10e", " 1.2340000000e+000", "d", "1.234" } |
| 74 |
{ "%- 12.1e", "-1.2e+000 ", "d", "-1.234" } |
| 75 |
{ "%+12.1e", " +1.2e+000", "d", "1.234" } |
| 76 |
{ "%+12.1e", " -1.2e+000", "d", "-1.234" } |
| 77 |
{ "% 12.1e", " 1.2e+000", "d", "1.234" } |
| 78 |
{ "% 12.1e", " -1.2e+000", "d", "-1.234" } |
| 79 |
{ "%12.1e", " 1.2e+000", "d", "1.234" } |
| 80 |
{ "%12.1e", " -1.2e+000", "d", "-1.234" } |
| 81 |
{ "%.2e", "1.23e+000", "d", "1.234" } |
| 82 |
{ "%.2e", "-1.23e+000", "d", "-1.234" } |
| 83 |
{ "%3e", "1.234000e+000", "d", "1.234" } |
| 84 |
{ "%3e", "-1.234000e+000", "d", "-1.234" } |
| 85 |
{ "%g", "12345.7", "d", "12345.6789" } |
| 86 |
{ "%g", "123457", "d", "123456.789" } |
| 87 |
{ "%g", "1.23457e+006", "d", "1234567.89" } |
| 88 |
{ "%G", "12345.7", "d", "12345.6789" } |
| 89 |
{ "%G", "123457", "d", "123456.789" } |
| 90 |
{ "%G", "1.23457E+006", "d", "1234567.89" } |
| 91 |
{ "%.14G", "1.7E+064", "d", "1.7E+64" } |
| 92 |
{ "%.0f", "-12", "d", "-12.34" } |
| 93 |
{ "%.0e", "-1e+001", "d", "-12.34" } |
| 94 |
{ "%.0g", "-1e+001", "d", "-12.34" } |
| 95 |
{ "%hd", "-30002", "2", "8ace" } |
| 96 |
{ "%hu", "35534", "2", "8ace" } |
| 97 |
{ "%ho", "105316", "2", "8ace" } |
| 98 |
{ "%hx", "8ace", "2", "8ace" } |
| 99 |
{ "%lx", "8ace1234", "4", "8ace1234" } |
| 100 |
{ "%llx", "123456789abcdef0", "8", "123456789abcdef0" } |
| 101 |
{ "%lu", "2328760884", "4", "8ace1234" } |
| 102 |
// %llu doesn't work yet. |
| 103 |
{ "%ld", "-1966206412", "4", "8ace1234" } |
| 104 |
{ "%lld", "1311768467463790320", "8", "123456789abcdef0" } |
| 105 |
{ "%+u", "2328760884", "4", "8ace1234" } // Ignore the + sign argument |
| 106 |
} |
| 107 |
} |
| 108 |
printfPrecision { |
| 109 |
Headers { "format", "result", "argumentType", "argument", "precision" } |
| 110 |
Cases { |
| 111 |
{ "%+1.*e", "+1.2346e+000", "d", "1.2345678", :int{4} } |
| 112 |
{ "%+2.*e", "+1.234568e+000", "d", "1.2345678", :int{6} } |
| 113 |
{ "%*d", "12345678", "4", "BC614E", :int{7} } |
| 114 |
{ "%*d", "12345678", "4", "BC614E", :int{8} } |
| 115 |
{ "%*d", " 12345678", "4", "BC614E", :int{9} } |
| 116 |
{ "%*d", "12345678 ", "4", "BC614E", :int{-9} } |
| 117 |
{ "%*d", "1", "4", "1", :int{-1} } |
| 118 |
{ "%*d", "1 ", "4", "1", :int{-2} } |
| 119 |
} |
| 120 |
} |
| 121 |
scanf { |
| 122 |
Headers { "format", "argument", "argumentType", "result" } |
| 123 |
Cases { |
| 124 |
{ "%e", "1.200000e+000", "f", "1.2" } |
| 125 |
{ "%*e%e", "1.200000e+000 4.825000e+000", "f", "4.825" } |
| 126 |
{ "%C", "1234", "2", "31" } |
| 127 |
{ "%*C%C", "1234", "2", "32" } |
| 128 |
{ "%S", "1234 5678", "S", "1234" } |
| 129 |
{ "%*S%S", "1234 5678", "S", "5678" } |
| 130 |
{ "%hd", "1234 5678", "2", "4D2" } |
| 131 |
{ "%*hd%hd", "1234 5678", "2", "162E" } |
| 132 |
{ "%d", "1234 5678", "4", "4D2" } |
| 133 |
{ "%ld", "1234 5678", "4", "4D2" } |
| 134 |
{ "%lld", "1311768467463790320", "8", "123456789abcdef0" } |
| 135 |
{ "%3d", "1234 5678", "4", "7B" } |
| 136 |
{ "%4d", "123", "4", "7B" } |
| 137 |
{ "%2d", "123", "4", "C" } |
| 138 |
{ "%40d", "123", "4", "7B" } |
| 139 |
{ "%2e", "1.25", "f", "1" } |
| 140 |
{ "%2f", "1.25", "f", "1" } |
| 141 |
{ "%2g", "1.25", "f", "1" } |
| 142 |
{ "%2le", "1.25", "d", "1" } |
| 143 |
{ "%2lf", "1.25", "d", "1" } |
| 144 |
{ "%2lg", "1.25", "d", "1" } |
| 145 |
{ "%*2e%2e", "1.25", "f", "25" } |
| 146 |
{ "%*2f%2f", "1.25", "f", "25" } |
| 147 |
{ "%*2g%2g", "1.25", "f", "25" } |
| 148 |
{ "%*d%d", "1234 5678", "4", "162E" } |
| 149 |
{ "%x", "abcd ef01", "4", "abcd" } |
| 150 |
{ "%3x", "abcd ef01", "4", "abc" } |
| 151 |
{ "%*hx%hx", "abcd ef01", "2", "ef01" } |
| 152 |
{ "%ho", "1046539", "2", "89AB" } // Extra 9 on the end |
| 153 |
{ "%3ho", "7700", "2", "1F8" } // Don't read the 0 at the end |
| 154 |
{ "%llo", "1777777777777777777777", "8", "FFFFFFFFFFFFFFFF" } |
| 155 |
{ "%lx", "abcdef01", "4", "abcdef01" } |
| 156 |
{ "%x", "0x7abcdef0", "4", "7abcdef0" } |
| 157 |
{ "%llx", "123456789abcdef0", "8", "123456789abcdef0" } |
| 158 |
{ "%S", "a\U00010000b", "S", "a\U00010000b" } |
| 159 |
{ "%[abce]", "abcd ef01", "S", "abc" } |
| 160 |
{ "%*[abce]%[de\\ ]", "abcd ef01", "S", "d e" } |
| 161 |
{ "%[a\U00010000]", "a\U00010000\U00010001b", "S", "a\U00010000" } |
| 162 |
{ "%[a-f]", "abccdefg", "S", "abccdef" } |
| 163 |
{ "%[a-c]", "abccdefg", "S", "abcc" } |
| 164 |
{ "%[^e-f]", "abccdefg", "S", "abccd" } |
| 165 |
{ "%3[^e-f]", "abccdefg", "S", "abc" } |
| 166 |
{ "%*3[abc]%[cde]", "abccdefg", "S", "cde" } |
| 167 |
{ "%*3S%S", "a bc efg", "S", "bc" } |
| 168 |
{ "%*3S%S", "abcd efg", "S", "d" } |
| 169 |
{ "%*3s%s", "abcd efg", "s", "d" } |
| 170 |
{ "%*3d%d", "1234", "4", "4" } |
| 171 |
{ "%d", " 1234", "4", "4D2" } |
| 172 |
{ "%e", " 1234", "f", "1234" } |
| 173 |
{ "%f", " 1234", "f", "1234" } |
| 174 |
{ "%d", "+1234", "4", "4D2" } |
| 175 |
{ "%e", "+1234", "f", "1234" } |
| 176 |
{ "%f", "+1234", "f", "1234" } |
| 177 |
} |
| 178 |
} |
| 179 |
} |
| 180 |
} |