1 # Test for the strtonum module
3 ## Testing str_to_uns(.) (It is supoposed that uns is 4 bytes integer)
6 Run: ../obj/ucw/strtonum-test '0o+-_' '0o100_000xc' | grep '^i'
10 Run: ../obj/ucw/strtonum-test '0XoB+-_' '4_294_967_295xcyv' | grep '^i'
14 Run: ../obj/ucw/strtonum-test '0XoB+-_' '4_294_967_296xc' | grep '^e'
15 Out: e[Numeric overflow]
18 Run: ../obj/ucw/strtonum-test '0XoBt+-_' '4_294_967_296xc' | grep '^h'
22 Run: ../obj/ucw/strtonum-test '0XoBt+-_' '4_294_967_296xc' | grep '^b'
26 Run: ../obj/ucw/strtonum-test '0XoBt+-_' '0x__4_' | grep '^i'
30 Run: ../obj/ucw/strtonum-test '0XoBt+-_' '0x__4_' | grep '^b'
34 Run: ../obj/ucw/strtonum-test '0XoBt+-_' '0xXW' | grep '^e'
35 Out: e[Number contains no digits]
38 Run: ../obj/ucw/strtonum-test '0XoBt+-_' '0xXW' | grep '^b'
42 Run: ../obj/ucw/strtonum-test '0oBt+-_' '0xXW' | grep '^i'
46 Run: ../obj/ucw/strtonum-test '0oBt+-_' '0xXW' | grep '^b'
50 Run: ../obj/ucw/strtonum-test '0oBt+-_Z' '0xXW' | grep '^e'
51 Out: e[Invalid character]
54 Run: ../obj/ucw/strtonum-test '0oBt+-_Z' '0xXW' | grep '^b'
58 Run: ../obj/ucw/strtonum-test '0Bs+-_' '2_147_483_647xxx' | grep '^i'
62 Run: ../obj/ucw/strtonum-test '0Bs+-_' '2_147_483_647xxx' | grep '^i'
66 Run: ../obj/ucw/strtonum-test '0Bs+-_' '2_147_483_648xxx' | grep '^e'
67 Out: e[Numeric overflow]
70 Run: ../obj/ucw/strtonum-test '0Bs+-_' '-2_147_483_648xxx' | grep '^i'
74 Run: ../obj/ucw/strtonum-test '0Bs+-_' '-2_147_483_649xxx' | grep '^e'
75 Out: e[Numeric overflow]
78 Run: ../obj/ucw/strtonum-test '0Bts+-_' '2_147_483_648xxx' | grep '^i'
82 Run: ../obj/ucw/strtonum-test '0Bts+-_' '-2_147_483_649xxx' | grep '^i'
86 Run: ../obj/ucw/strtonum-test '0Bts+-_' '-2_147_483_649xxx' | grep '^i'
90 Run: ../obj/ucw/strtonum-test '0X+-' '0xABCDEFxxx' | grep '^h'
94 Run: ../obj/ucw/strtonum-test '0X+-_' '0x00_AB_CD_EFxxx' | grep '^h'
98 Run: ../obj/ucw/strtonum-test '0Xs+-_' '-0x00AB_CDEFxxx' | grep '^h'
102 Run: ../obj/ucw/strtonum-test '0XBs+-_' '-0x00AB_CDEFxxx' | grep '^h'
106 Run: ../obj/ucw/strtonum-test '0B+-_' '0B1111_0000_1000_0101_1010xxx' | grep '^h'
110 Run: ../obj/ucw/strtonum-test '0+-_' '0B1111_0000_1000_0101_1010xxx' | grep '^b'
114 Run: ../obj/ucw/strtonum-test '0o+-_' '0o70105xxx' | grep '^i'
118 Run: ../obj/ucw/strtonum-test '0os+-_' '-0o70105xxx' | grep '^i'
122 Run: ../obj/ucw/strtonum-test '0os+-_' '-0o___________xxx' | grep '^e'
123 Out: e[Number contains no digits]
126 Run: ../obj/ucw/strtonum-test '2+-_' '10578ABCG' | grep '^i'
130 Run: ../obj/ucw/strtonum-test '2s+-_' '-10578ABCG' | grep '^i'
134 Run: ../obj/ucw/strtonum-test '8+-_' '10578ABCG' | grep '^i'
138 Run: ../obj/ucw/strtonum-test '8s+-_' '-10578ABCG' | grep '^i'
142 Run: ../obj/ucw/strtonum-test '0+-_' '10578ABCG' | grep '^i'
146 Run: ../obj/ucw/strtonum-test '0s+-_' '-10578ABCG' | grep '^i'
150 Run: ../obj/ucw/strtonum-test 'h+-_' '10578ABCG' | grep '^i'
154 Run: ../obj/ucw/strtonum-test 'hs+-_' '-10578ABCG' | grep '^i'
157 ## Testing str_to_uintmax(.) (It is supoposed that uintmax_t is 8 bytes integer)
159 Run: ../obj/ucw/strtonum-test 'h+-_' 'FFFF_FFFF_ffff_ffFF' | grep '^H'
160 Out: Hffffffffffffffff
163 Run: ../obj/ucw/strtonum-test 'h+-_' 'FFFF_FFFF_ffff_ffFF' | grep '^I'
164 Out: I18446744073709551615
167 Run: ../obj/ucw/strtonum-test '0t+-_' '1844674407370000009551616' | grep '^I'
168 Out: I18446744073709551615
171 Run: ../obj/ucw/strtonum-test '0+-_' '18446744073709551616' | grep '^E'
172 Out: E[Numeric overflow]
175 Run: ../obj/ucw/strtonum-test '0+-_' '18446744073709551614' | grep '^H'
176 Out: Hfffffffffffffffe
179 Run: ../obj/ucw/strtonum-test '0s+-_' '9223372036854775807L' | grep '^I'
180 Out: I9223372036854775807
183 Run: ../obj/ucw/strtonum-test '0s+-_' '9223372036854775806L' | grep '^I'
184 Out: I9223372036854775806
187 Run: ../obj/ucw/strtonum-test '0st+-_' '92233720368547758000000L' | grep '^I'
188 Out: I9223372036854775807
191 Run: ../obj/ucw/strtonum-test '0s+-_' '9223372036854775808L' | grep '^E'
192 Out: E[Numeric overflow]
195 Run: ../obj/ucw/strtonum-test '0s+-_' '-9223372036854775808L' | grep '^I'
196 Out: I-9223372036854775808
199 Run: ../obj/ucw/strtonum-test '0s+-_' '-9223372036854775807L' | grep '^I'
200 Out: I-9223372036854775807
203 Run: ../obj/ucw/strtonum-test '0st+-_' '-9223372036854775800000L' | grep '^I'
204 Out: I-9223372036854775808
207 Run: ../obj/ucw/strtonum-test '0s+-_' '-9223372036854775809L' | grep '^E'
208 Out: E[Numeric overflow]