[25] | 1 | # This file is a Tcl script to test the code in the file tclUtil.c. |
---|
| 2 | # This file is organized in the standard fashion for Tcl tests. |
---|
| 3 | # |
---|
| 4 | # Copyright (c) 1995-1998 Sun Microsystems, Inc. |
---|
| 5 | # Copyright (c) 1998-1999 by Scriptics Corporation. |
---|
| 6 | # |
---|
| 7 | # See the file "license.terms" for information on usage and redistribution |
---|
| 8 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 9 | # |
---|
| 10 | # RCS: @(#) $Id: util.test,v 1.18 2006/03/21 11:12:29 dkf Exp $ |
---|
| 11 | |
---|
| 12 | if {[lsearch [namespace children] ::tcltest] == -1} { |
---|
| 13 | package require tcltest |
---|
| 14 | namespace import -force ::tcltest::* |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | testConstraint testdstring [llength [info commands testdstring]] |
---|
| 18 | |
---|
| 19 | # Big test for correct ordering of data in [expr] |
---|
| 20 | |
---|
| 21 | proc testIEEE {} { |
---|
| 22 | variable ieeeValues |
---|
| 23 | binary scan [binary format dd -1.0 1.0] c* c |
---|
| 24 | switch -exact -- $c { |
---|
| 25 | {0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} { |
---|
| 26 | # little endian |
---|
| 27 | binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \ |
---|
| 28 | ieeeValues(-Infinity) |
---|
| 29 | binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \ |
---|
| 30 | ieeeValues(-Normal) |
---|
| 31 | binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \ |
---|
| 32 | ieeeValues(-Subnormal) |
---|
| 33 | binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \ |
---|
| 34 | ieeeValues(-0) |
---|
| 35 | binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \ |
---|
| 36 | ieeeValues(+0) |
---|
| 37 | binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \ |
---|
| 38 | ieeeValues(+Subnormal) |
---|
| 39 | binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \ |
---|
| 40 | ieeeValues(+Normal) |
---|
| 41 | binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \ |
---|
| 42 | ieeeValues(+Infinity) |
---|
| 43 | binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \ |
---|
| 44 | ieeeValues(NaN) |
---|
| 45 | set ieeeValues(littleEndian) 1 |
---|
| 46 | return 1 |
---|
| 47 | } |
---|
| 48 | {-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} { |
---|
| 49 | binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \ |
---|
| 50 | ieeeValues(-Infinity) |
---|
| 51 | binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \ |
---|
| 52 | ieeeValues(-Normal) |
---|
| 53 | binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \ |
---|
| 54 | ieeeValues(-Subnormal) |
---|
| 55 | binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \ |
---|
| 56 | ieeeValues(-0) |
---|
| 57 | binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \ |
---|
| 58 | ieeeValues(+0) |
---|
| 59 | binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \ |
---|
| 60 | ieeeValues(+Subnormal) |
---|
| 61 | binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \ |
---|
| 62 | ieeeValues(+Normal) |
---|
| 63 | binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \ |
---|
| 64 | ieeeValues(+Infinity) |
---|
| 65 | binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \ |
---|
| 66 | ieeeValues(NaN) |
---|
| 67 | set ieeeValues(littleEndian) 0 |
---|
| 68 | return 1 |
---|
| 69 | } |
---|
| 70 | default { |
---|
| 71 | return 0 |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | } |
---|
| 75 | testConstraint ieeeFloatingPoint [testIEEE] |
---|
| 76 | |
---|
| 77 | proc convertDouble { x } { |
---|
| 78 | variable ieeeValues |
---|
| 79 | if { $ieeeValues(littleEndian) } { |
---|
| 80 | binary scan [binary format w $x] d result |
---|
| 81 | } else { |
---|
| 82 | binary scan [binary format W $x] d result |
---|
| 83 | } |
---|
| 84 | return $result |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | test util-1.1 {TclFindElement procedure - binary element in middle of list} { |
---|
| 89 | lindex {0 foo\x00help 1} 1 |
---|
| 90 | } "foo\x00help" |
---|
| 91 | test util-1.2 {TclFindElement procedure - binary element at end of list} { |
---|
| 92 | lindex {0 foo\x00help} 1 |
---|
| 93 | } "foo\x00help" |
---|
| 94 | |
---|
| 95 | test util-2.1 {TclCopyAndCollapse procedure - normal string} { |
---|
| 96 | lindex {0 foo} 1 |
---|
| 97 | } {foo} |
---|
| 98 | test util-2.2 {TclCopyAndCollapse procedure - string with backslashes} { |
---|
| 99 | lindex {0 foo\n\x00help 1} 1 |
---|
| 100 | } "foo\n\x00help" |
---|
| 101 | |
---|
| 102 | test util-3.1 {Tcl_ScanCountedElement procedure - don't leave unmatched braces} { |
---|
| 103 | # This test checks for a very tricky feature. Any list element |
---|
| 104 | # generated with Tcl_ScanCountedElement and Tcl_ConvertElement must |
---|
| 105 | # have the property that it can be enclosing in curly braces to make |
---|
| 106 | # an embedded sub-list. If this property doesn't hold, then |
---|
| 107 | # Tcl_DStringStartSublist doesn't work. |
---|
| 108 | set x {} |
---|
| 109 | lappend x "# \\\{ \\" |
---|
| 110 | concat $x [llength "{$x}"] |
---|
| 111 | } {\#\ \\\{\ \\ 1} |
---|
| 112 | test util-3.2 {Tcl_ConverCountedElement procedure - quote leading '#'} { |
---|
| 113 | list # # a |
---|
| 114 | } {{#} # a} |
---|
| 115 | test util-3.3 {Tcl_ConverCountedElement procedure - quote leading '#'} { |
---|
| 116 | list #\{ # a |
---|
| 117 | } {\#\{ # a} |
---|
| 118 | test util-3.4 {Tcl_ConverCountedElement procedure - quote leading '#'} { |
---|
| 119 | proc # {} {return #} |
---|
| 120 | set result [eval [list #]] |
---|
| 121 | rename # {} |
---|
| 122 | set result |
---|
| 123 | } {#} |
---|
| 124 | test util-3.4.1 {Tcl_ConverCountedElement procedure - quote leading '#'} { |
---|
| 125 | proc # {} {return #} |
---|
| 126 | set cmd [list #] |
---|
| 127 | append cmd "" ;# force string rep generation |
---|
| 128 | set result [eval $cmd] |
---|
| 129 | rename # {} |
---|
| 130 | set result |
---|
| 131 | } {#} |
---|
| 132 | test util-3.5 {Tcl_ConverCountedElement procedure - quote leading '#'} { |
---|
| 133 | proc #\{ {} {return #} |
---|
| 134 | set result [eval [list #\{]] |
---|
| 135 | rename #\{ {} |
---|
| 136 | set result |
---|
| 137 | } {#} |
---|
| 138 | test util-3.5.1 {Tcl_ConverCountedElement procedure - quote leading '#'} { |
---|
| 139 | proc #\{ {} {return #} |
---|
| 140 | set cmd [list #\{] |
---|
| 141 | append cmd "" ;# force string rep generation |
---|
| 142 | set result [eval $cmd] |
---|
| 143 | rename #\{ {} |
---|
| 144 | set result |
---|
| 145 | } {#} |
---|
| 146 | |
---|
| 147 | test util-4.1 {Tcl_ConcatObj - backslash-space at end of argument} { |
---|
| 148 | concat a {b\ } c |
---|
| 149 | } {a b\ c} |
---|
| 150 | test util-4.2 {Tcl_ConcatObj - backslash-space at end of argument} { |
---|
| 151 | concat a {b\ } c |
---|
| 152 | } {a b\ c} |
---|
| 153 | test util-4.3 {Tcl_ConcatObj - backslash-space at end of argument} { |
---|
| 154 | concat a {b\\ } c |
---|
| 155 | } {a b\\ c} |
---|
| 156 | test util-4.4 {Tcl_ConcatObj - backslash-space at end of argument} { |
---|
| 157 | concat a {b } c |
---|
| 158 | } {a b c} |
---|
| 159 | test util-4.5 {Tcl_ConcatObj - backslash-space at end of argument} { |
---|
| 160 | concat a { } c |
---|
| 161 | } {a c} |
---|
| 162 | test util-4.6 {Tcl_ConcatObj - utf-8 sequence with "whitespace" char} { |
---|
| 163 | # Check for Bug #227512. If this violates C isspace, then it returns \xc3. |
---|
| 164 | concat \xe0 |
---|
| 165 | } \xe0 |
---|
| 166 | |
---|
| 167 | proc Wrapper_Tcl_StringMatch {pattern string} { |
---|
| 168 | # Forces use of Tcl_StringMatch, not Tcl_UniCharCaseMatch |
---|
| 169 | switch -glob -- $string $pattern {return 1} default {return 0} |
---|
| 170 | } |
---|
| 171 | test util-5.1 {Tcl_StringMatch} { |
---|
| 172 | Wrapper_Tcl_StringMatch ab*c abc |
---|
| 173 | } 1 |
---|
| 174 | test util-5.2 {Tcl_StringMatch} { |
---|
| 175 | Wrapper_Tcl_StringMatch ab**c abc |
---|
| 176 | } 1 |
---|
| 177 | test util-5.3 {Tcl_StringMatch} { |
---|
| 178 | Wrapper_Tcl_StringMatch ab* abcdef |
---|
| 179 | } 1 |
---|
| 180 | test util-5.4 {Tcl_StringMatch} { |
---|
| 181 | Wrapper_Tcl_StringMatch *c abc |
---|
| 182 | } 1 |
---|
| 183 | test util-5.5 {Tcl_StringMatch} { |
---|
| 184 | Wrapper_Tcl_StringMatch *3*6*9 0123456789 |
---|
| 185 | } 1 |
---|
| 186 | test util-5.6 {Tcl_StringMatch} { |
---|
| 187 | Wrapper_Tcl_StringMatch *3*6*9 01234567890 |
---|
| 188 | } 0 |
---|
| 189 | test util-5.7 {Tcl_StringMatch: UTF-8} { |
---|
| 190 | Wrapper_Tcl_StringMatch *u \u4e4fu |
---|
| 191 | } 1 |
---|
| 192 | test util-5.8 {Tcl_StringMatch} { |
---|
| 193 | Wrapper_Tcl_StringMatch a?c abc |
---|
| 194 | } 1 |
---|
| 195 | test util-5.9 {Tcl_StringMatch: UTF-8} { |
---|
| 196 | # skip one character in string |
---|
| 197 | Wrapper_Tcl_StringMatch a?c a\u4e4fc |
---|
| 198 | } 1 |
---|
| 199 | test util-5.10 {Tcl_StringMatch} { |
---|
| 200 | Wrapper_Tcl_StringMatch a??c abc |
---|
| 201 | } 0 |
---|
| 202 | test util-5.11 {Tcl_StringMatch} { |
---|
| 203 | Wrapper_Tcl_StringMatch ?1??4???8? 0123456789 |
---|
| 204 | } 1 |
---|
| 205 | test util-5.12 {Tcl_StringMatch} { |
---|
| 206 | Wrapper_Tcl_StringMatch {[abc]bc} abc |
---|
| 207 | } 1 |
---|
| 208 | test util-5.13 {Tcl_StringMatch: UTF-8} { |
---|
| 209 | # string += Tcl_UtfToUniChar(string, &ch); |
---|
| 210 | Wrapper_Tcl_StringMatch "\[\u4e4fxy\]bc" "\u4e4fbc" |
---|
| 211 | } 1 |
---|
| 212 | test util-5.14 {Tcl_StringMatch} { |
---|
| 213 | # if ((*pattern == ']') || (*pattern == '\0')) |
---|
| 214 | # badly formed pattern |
---|
| 215 | Wrapper_Tcl_StringMatch {[]} {[]} |
---|
| 216 | } 0 |
---|
| 217 | test util-5.15 {Tcl_StringMatch} { |
---|
| 218 | # if ((*pattern == ']') || (*pattern == '\0')) |
---|
| 219 | # badly formed pattern |
---|
| 220 | Wrapper_Tcl_StringMatch {[} {[} |
---|
| 221 | } 0 |
---|
| 222 | test util-5.16 {Tcl_StringMatch} { |
---|
| 223 | Wrapper_Tcl_StringMatch {a[abc]c} abc |
---|
| 224 | } 1 |
---|
| 225 | test util-5.17 {Tcl_StringMatch: UTF-8} { |
---|
| 226 | # pattern += Tcl_UtfToUniChar(pattern, &endChar); |
---|
| 227 | # get 1 UTF-8 character |
---|
| 228 | Wrapper_Tcl_StringMatch "a\[a\u4e4fc]c" "a\u4e4fc" |
---|
| 229 | } 1 |
---|
| 230 | test util-5.18 {Tcl_StringMatch: UTF-8} { |
---|
| 231 | # pattern += Tcl_UtfToUniChar(pattern, &endChar); |
---|
| 232 | # proper advance: wrong answer would match on UTF trail byte of \u4e4f |
---|
| 233 | Wrapper_Tcl_StringMatch {a[a\u4e4fc]c} [bytestring a\u008fc] |
---|
| 234 | } 0 |
---|
| 235 | test util-5.19 {Tcl_StringMatch: UTF-8} { |
---|
| 236 | # pattern += Tcl_UtfToUniChar(pattern, &endChar); |
---|
| 237 | # proper advance. |
---|
| 238 | Wrapper_Tcl_StringMatch {a[a\u4e4fc]c} "acc" |
---|
| 239 | } 1 |
---|
| 240 | test util-5.20 {Tcl_StringMatch} { |
---|
| 241 | Wrapper_Tcl_StringMatch {a[xyz]c} abc |
---|
| 242 | } 0 |
---|
| 243 | test util-5.21 {Tcl_StringMatch} { |
---|
| 244 | Wrapper_Tcl_StringMatch {12[2-7]45} 12345 |
---|
| 245 | } 1 |
---|
| 246 | test util-5.22 {Tcl_StringMatch: UTF-8 range} { |
---|
| 247 | Wrapper_Tcl_StringMatch "\[\u4e00-\u4e4f]" "0" |
---|
| 248 | } 0 |
---|
| 249 | test util-5.23 {Tcl_StringMatch: UTF-8 range} { |
---|
| 250 | Wrapper_Tcl_StringMatch "\[\u4e00-\u4e4f]" "\u4e33" |
---|
| 251 | } 1 |
---|
| 252 | test util-5.24 {Tcl_StringMatch: UTF-8 range} { |
---|
| 253 | Wrapper_Tcl_StringMatch "\[\u4e00-\u4e4f]" "\uff08" |
---|
| 254 | } 0 |
---|
| 255 | test util-5.25 {Tcl_StringMatch} { |
---|
| 256 | Wrapper_Tcl_StringMatch {12[ab2-4cd]45} 12345 |
---|
| 257 | } 1 |
---|
| 258 | test util-5.26 {Tcl_StringMatch} { |
---|
| 259 | Wrapper_Tcl_StringMatch {12[ab2-4cd]45} 12b45 |
---|
| 260 | } 1 |
---|
| 261 | test util-5.27 {Tcl_StringMatch} { |
---|
| 262 | Wrapper_Tcl_StringMatch {12[ab2-4cd]45} 12d45 |
---|
| 263 | } 1 |
---|
| 264 | test util-5.28 {Tcl_StringMatch} { |
---|
| 265 | Wrapper_Tcl_StringMatch {12[ab2-4cd]45} 12145 |
---|
| 266 | } 0 |
---|
| 267 | test util-5.29 {Tcl_StringMatch} { |
---|
| 268 | Wrapper_Tcl_StringMatch {12[ab2-4cd]45} 12545 |
---|
| 269 | } 0 |
---|
| 270 | test util-5.30 {Tcl_StringMatch: forwards range} { |
---|
| 271 | Wrapper_Tcl_StringMatch {[k-w]} "z" |
---|
| 272 | } 0 |
---|
| 273 | test util-5.31 {Tcl_StringMatch: forwards range} { |
---|
| 274 | Wrapper_Tcl_StringMatch {[k-w]} "w" |
---|
| 275 | } 1 |
---|
| 276 | test util-5.32 {Tcl_StringMatch: forwards range} { |
---|
| 277 | Wrapper_Tcl_StringMatch {[k-w]} "r" |
---|
| 278 | } 1 |
---|
| 279 | test util-5.33 {Tcl_StringMatch: forwards range} { |
---|
| 280 | Wrapper_Tcl_StringMatch {[k-w]} "k" |
---|
| 281 | } 1 |
---|
| 282 | test util-5.34 {Tcl_StringMatch: forwards range} { |
---|
| 283 | Wrapper_Tcl_StringMatch {[k-w]} "a" |
---|
| 284 | } 0 |
---|
| 285 | test util-5.35 {Tcl_StringMatch: reverse range} { |
---|
| 286 | Wrapper_Tcl_StringMatch {[w-k]} "z" |
---|
| 287 | } 0 |
---|
| 288 | test util-5.36 {Tcl_StringMatch: reverse range} { |
---|
| 289 | Wrapper_Tcl_StringMatch {[w-k]} "w" |
---|
| 290 | } 1 |
---|
| 291 | test util-5.37 {Tcl_StringMatch: reverse range} { |
---|
| 292 | Wrapper_Tcl_StringMatch {[w-k]} "r" |
---|
| 293 | } 1 |
---|
| 294 | test util-5.38 {Tcl_StringMatch: reverse range} { |
---|
| 295 | Wrapper_Tcl_StringMatch {[w-k]} "k" |
---|
| 296 | } 1 |
---|
| 297 | test util-5.39 {Tcl_StringMatch: reverse range} { |
---|
| 298 | Wrapper_Tcl_StringMatch {[w-k]} "a" |
---|
| 299 | } 0 |
---|
| 300 | test util-5.40 {Tcl_StringMatch: skip correct number of ']'} { |
---|
| 301 | Wrapper_Tcl_StringMatch {[A-]x} Ax |
---|
| 302 | } 0 |
---|
| 303 | test util-5.41 {Tcl_StringMatch: skip correct number of ']'} { |
---|
| 304 | Wrapper_Tcl_StringMatch {[A-]]x} Ax |
---|
| 305 | } 1 |
---|
| 306 | test util-5.42 {Tcl_StringMatch: skip correct number of ']'} { |
---|
| 307 | Wrapper_Tcl_StringMatch {[A-]]x} \ue1x |
---|
| 308 | } 0 |
---|
| 309 | test util-5.43 {Tcl_StringMatch: skip correct number of ']'} { |
---|
| 310 | Wrapper_Tcl_StringMatch \[A-]\ue1]x \ue1x |
---|
| 311 | } 1 |
---|
| 312 | test util-5.44 {Tcl_StringMatch: skip correct number of ']'} { |
---|
| 313 | Wrapper_Tcl_StringMatch {[A-]h]x} hx |
---|
| 314 | } 1 |
---|
| 315 | test util-5.45 {Tcl_StringMatch} { |
---|
| 316 | # if (*pattern == '\0') |
---|
| 317 | # badly formed pattern, still treats as a set |
---|
| 318 | Wrapper_Tcl_StringMatch {[a} a |
---|
| 319 | } 1 |
---|
| 320 | test util-5.46 {Tcl_StringMatch} { |
---|
| 321 | Wrapper_Tcl_StringMatch {a\*b} a*b |
---|
| 322 | } 1 |
---|
| 323 | test util-5.47 {Tcl_StringMatch} { |
---|
| 324 | Wrapper_Tcl_StringMatch {a\*b} ab |
---|
| 325 | } 0 |
---|
| 326 | test util-5.48 {Tcl_StringMatch} { |
---|
| 327 | Wrapper_Tcl_StringMatch {a\*\?\[\]\\\x} "a*?\[\]\\x" |
---|
| 328 | } 1 |
---|
| 329 | test util-5.49 {Tcl_StringMatch} { |
---|
| 330 | Wrapper_Tcl_StringMatch ** "" |
---|
| 331 | } 1 |
---|
| 332 | test util-5.50 {Tcl_StringMatch} { |
---|
| 333 | Wrapper_Tcl_StringMatch *. "" |
---|
| 334 | } 0 |
---|
| 335 | test util-5.51 {Tcl_StringMatch} { |
---|
| 336 | Wrapper_Tcl_StringMatch "" "" |
---|
| 337 | } 1 |
---|
| 338 | |
---|
| 339 | test util-6.1 {Tcl_PrintDouble - using tcl_precision} -setup { |
---|
| 340 | set old_precision $::tcl_precision |
---|
| 341 | set ::tcl_precision 12 |
---|
| 342 | } -body { |
---|
| 343 | concat x[expr 1.4] |
---|
| 344 | } -cleanup { |
---|
| 345 | set ::tcl_precision $old_precision |
---|
| 346 | } -result {x1.4} |
---|
| 347 | test util-6.2 {Tcl_PrintDouble - using tcl_precision} -setup { |
---|
| 348 | set old_precision $::tcl_precision |
---|
| 349 | set ::tcl_precision 12 |
---|
| 350 | } -body { |
---|
| 351 | concat x[expr 1.39999999999] |
---|
| 352 | } -cleanup { |
---|
| 353 | set ::tcl_precision $old_precision |
---|
| 354 | } -result {x1.39999999999} |
---|
| 355 | test util-6.3 {Tcl_PrintDouble - using tcl_precision} -setup { |
---|
| 356 | set old_precision $::tcl_precision |
---|
| 357 | set ::tcl_precision 12 |
---|
| 358 | } -body { |
---|
| 359 | concat x[expr 1.399999999999] |
---|
| 360 | } -cleanup { |
---|
| 361 | set ::tcl_precision $old_precision |
---|
| 362 | } -result {x1.4} |
---|
| 363 | test util-6.4 {Tcl_PrintDouble - using tcl_precision} -setup { |
---|
| 364 | set old_precision $::tcl_precision |
---|
| 365 | set ::tcl_precision 5 |
---|
| 366 | } -body { |
---|
| 367 | concat x[expr 1.123412341234] |
---|
| 368 | } -cleanup { |
---|
| 369 | set tcl_precision $old_precision |
---|
| 370 | } -result {x1.1234} |
---|
| 371 | test util-6.5 {Tcl_PrintDouble - make sure there's a decimal point} { |
---|
| 372 | concat x[expr 2.0] |
---|
| 373 | } {x2.0} |
---|
| 374 | test util-6.6 {Tcl_PrintDouble - make sure there's a decimal point} { |
---|
| 375 | concat x[expr 3.0e98] |
---|
| 376 | } {x3e+98} |
---|
| 377 | |
---|
| 378 | test util-7.1 {TclPrecTraceProc - unset callbacks} -setup { |
---|
| 379 | set old_precision $::tcl_precision |
---|
| 380 | } -body { |
---|
| 381 | set tcl_precision 7 |
---|
| 382 | set x $tcl_precision |
---|
| 383 | unset tcl_precision |
---|
| 384 | list $x $tcl_precision |
---|
| 385 | } -cleanup { |
---|
| 386 | set ::tcl_precision $old_precision |
---|
| 387 | } -result {7 7} |
---|
| 388 | test util-7.2 {TclPrecTraceProc - read traces, sharing among interpreters} -setup { |
---|
| 389 | set old_precision $::tcl_precision |
---|
| 390 | } -body { |
---|
| 391 | set tcl_precision 12 |
---|
| 392 | interp create child |
---|
| 393 | set x [child eval set tcl_precision] |
---|
| 394 | child eval {set tcl_precision 6} |
---|
| 395 | interp delete child |
---|
| 396 | list $x $tcl_precision |
---|
| 397 | } -cleanup { |
---|
| 398 | set ::tcl_precision $old_precision |
---|
| 399 | } -result {12 6} |
---|
| 400 | test util-7.3 {TclPrecTraceProc - write traces, safe interpreters} -setup { |
---|
| 401 | set old_precision $::tcl_precision |
---|
| 402 | } -body { |
---|
| 403 | set tcl_precision 12 |
---|
| 404 | interp create -safe child |
---|
| 405 | set x [child eval { |
---|
| 406 | list [catch {set tcl_precision 8} msg] $msg |
---|
| 407 | }] |
---|
| 408 | interp delete child |
---|
| 409 | list $x $tcl_precision |
---|
| 410 | } -cleanup { |
---|
| 411 | set ::tcl_precision $old_precision |
---|
| 412 | } -result {{1 {can't set "tcl_precision": can't modify precision from a safe interpreter}} 12} |
---|
| 413 | test util-7.4 {TclPrecTraceProc - write traces, bogus values} -setup { |
---|
| 414 | set old_precision $::tcl_precision |
---|
| 415 | } -body { |
---|
| 416 | set tcl_precision 12 |
---|
| 417 | list [catch {set tcl_precision abc} msg] $msg $tcl_precision |
---|
| 418 | } -cleanup { |
---|
| 419 | set ::tcl_precision $old_precision |
---|
| 420 | } -result {1 {can't set "tcl_precision": improper value for precision} 12} |
---|
| 421 | |
---|
| 422 | # This test always succeeded in the C locale anyway... |
---|
| 423 | test util-8.1 {TclNeedSpace - correct UTF8 handling} { |
---|
| 424 | # Bug 411825 |
---|
| 425 | # Note that this test relies on the fact that |
---|
| 426 | # [interp target] calls on Tcl_AppendElement() |
---|
| 427 | # which calls on TclNeedSpace(). If [interp target] |
---|
| 428 | # is ever updated, this test will no longer test |
---|
| 429 | # TclNeedSpace. |
---|
| 430 | interp create \u5420 |
---|
| 431 | interp create [list \u5420 foo] |
---|
| 432 | interp alias {} fooset [list \u5420 foo] set |
---|
| 433 | set result [interp target {} fooset] |
---|
| 434 | interp delete \u5420 |
---|
| 435 | set result |
---|
| 436 | } "\u5420 foo" |
---|
| 437 | test util-8.2 {TclNeedSpace - correct UTF8 handling} testdstring { |
---|
| 438 | # Bug 411825 |
---|
| 439 | # This tests the same bug as the previous test, but |
---|
| 440 | # should be more future-proof, as the DString |
---|
| 441 | # operations will likely continue to call TclNeedSpace |
---|
| 442 | testdstring free |
---|
| 443 | testdstring append \u5420 -1 |
---|
| 444 | testdstring element foo |
---|
| 445 | llength [testdstring get] |
---|
| 446 | } 2 |
---|
| 447 | test util-8.3 {TclNeedSpace - correct UTF8 handling} testdstring { |
---|
| 448 | # Bug 411825 - new variant reported by Dossy Shiobara |
---|
| 449 | testdstring free |
---|
| 450 | testdstring append \u00A0 -1 |
---|
| 451 | testdstring element foo |
---|
| 452 | llength [testdstring get] |
---|
| 453 | } 2 |
---|
| 454 | test util-8.4 {TclNeedSpace - correct UTF8 handling} testdstring { |
---|
| 455 | # Another bug uncovered while fixing 411825 |
---|
| 456 | testdstring free |
---|
| 457 | testdstring append {\ } -1 |
---|
| 458 | testdstring append \{ -1 |
---|
| 459 | testdstring element foo |
---|
| 460 | llength [testdstring get] |
---|
| 461 | } 2 |
---|
| 462 | test util-8.5 {TclNeedSpace - correct UTF8 handling} testdstring { |
---|
| 463 | # Note that in this test TclNeedSpace actually gets it wrong, |
---|
| 464 | # claiming we need a space when we really do not. Extra space |
---|
| 465 | # between list elements is harmless though, and better to have |
---|
| 466 | # extra space in really weird string reps of lists, than to |
---|
| 467 | # invest the effort required to make TclNeedSpace foolproof. |
---|
| 468 | testdstring free |
---|
| 469 | testdstring append {\\ } -1 |
---|
| 470 | testdstring element foo |
---|
| 471 | list [llength [testdstring get]] [string length [testdstring get]] |
---|
| 472 | } {2 7} |
---|
| 473 | test util-8.6 {TclNeedSpace - correct UTF8 handling} testdstring { |
---|
| 474 | # Another example of TclNeedSpace harmlessly getting it wrong. |
---|
| 475 | testdstring free |
---|
| 476 | testdstring append {\\ } -1 |
---|
| 477 | testdstring append \{ -1 |
---|
| 478 | testdstring element foo |
---|
| 479 | testdstring append \} -1 |
---|
| 480 | list [llength [testdstring get]] [string length [testdstring get]] |
---|
| 481 | } {2 9} |
---|
| 482 | |
---|
| 483 | test util-9.0.0 {TclGetIntForIndex} { |
---|
| 484 | string index abcd 0 |
---|
| 485 | } a |
---|
| 486 | test util-9.0.1 {TclGetIntForIndex} { |
---|
| 487 | string index abcd 0x0 |
---|
| 488 | } a |
---|
| 489 | test util-9.0.2 {TclGetIntForIndex} { |
---|
| 490 | string index abcd -0x0 |
---|
| 491 | } a |
---|
| 492 | test util-9.0.3 {TclGetIntForIndex} { |
---|
| 493 | string index abcd { 0 } |
---|
| 494 | } a |
---|
| 495 | test util-9.0.4 {TclGetIntForIndex} { |
---|
| 496 | string index abcd { 0x0 } |
---|
| 497 | } a |
---|
| 498 | test util-9.0.5 {TclGetIntForIndex} { |
---|
| 499 | string index abcd { -0x0 } |
---|
| 500 | } a |
---|
| 501 | test util-9.0.6 {TclGetIntForIndex} { |
---|
| 502 | string index abcd 01 |
---|
| 503 | } b |
---|
| 504 | test util-9.0.7 {TclGetIntForIndex} { |
---|
| 505 | string index abcd { 01 } |
---|
| 506 | } b |
---|
| 507 | test util-9.1.0 {TclGetIntForIndex} { |
---|
| 508 | string index abcd 3 |
---|
| 509 | } d |
---|
| 510 | test util-9.1.1 {TclGetIntForIndex} { |
---|
| 511 | string index abcd { 3 } |
---|
| 512 | } d |
---|
| 513 | test util-9.1.2 {TclGetIntForIndex} { |
---|
| 514 | string index abcdefghijk 0xa |
---|
| 515 | } k |
---|
| 516 | test util-9.1.3 {TclGetIntForIndex} { |
---|
| 517 | string index abcdefghijk { 0xa } |
---|
| 518 | } k |
---|
| 519 | test util-9.2.0 {TclGetIntForIndex} { |
---|
| 520 | string index abcd end |
---|
| 521 | } d |
---|
| 522 | test util-9.2.1 {TclGetIntForIndex} -body { |
---|
| 523 | string index abcd { end} |
---|
| 524 | } -returnCodes error -match glob -result * |
---|
| 525 | test util-9.2.2 {TclGetIntForIndex} -body { |
---|
| 526 | string index abcd {end } |
---|
| 527 | } -returnCodes error -match glob -result * |
---|
| 528 | test util-9.3 {TclGetIntForIndex} { |
---|
| 529 | # Deprecated |
---|
| 530 | string index abcd en |
---|
| 531 | } d |
---|
| 532 | test util-9.4 {TclGetIntForIndex} { |
---|
| 533 | # Deprecated |
---|
| 534 | string index abcd e |
---|
| 535 | } d |
---|
| 536 | test util-9.5.0 {TclGetIntForIndex} { |
---|
| 537 | string index abcd end-1 |
---|
| 538 | } c |
---|
| 539 | test util-9.5.1 {TclGetIntForIndex} { |
---|
| 540 | string index abcd {end-1 } |
---|
| 541 | } c |
---|
| 542 | test util-9.5.2 {TclGetIntForIndex} -body { |
---|
| 543 | string index abcd { end-1} |
---|
| 544 | } -returnCodes error -match glob -result * |
---|
| 545 | test util-9.6 {TclGetIntForIndex} { |
---|
| 546 | string index abcd end+-1 |
---|
| 547 | } c |
---|
| 548 | test util-9.7 {TclGetIntForIndex} { |
---|
| 549 | string index abcd end+1 |
---|
| 550 | } {} |
---|
| 551 | test util-9.8 {TclGetIntForIndex} { |
---|
| 552 | string index abcd end--1 |
---|
| 553 | } {} |
---|
| 554 | test util-9.9.0 {TclGetIntForIndex} { |
---|
| 555 | string index abcd 0+0 |
---|
| 556 | } a |
---|
| 557 | test util-9.9.1 {TclGetIntForIndex} { |
---|
| 558 | string index abcd { 0+0 } |
---|
| 559 | } a |
---|
| 560 | test util-9.10 {TclGetIntForIndex} { |
---|
| 561 | string index abcd 0-0 |
---|
| 562 | } a |
---|
| 563 | test util-9.11 {TclGetIntForIndex} { |
---|
| 564 | string index abcd 1+0 |
---|
| 565 | } b |
---|
| 566 | test util-9.12 {TclGetIntForIndex} { |
---|
| 567 | string index abcd 1-0 |
---|
| 568 | } b |
---|
| 569 | test util-9.13 {TclGetIntForIndex} { |
---|
| 570 | string index abcd 1+1 |
---|
| 571 | } c |
---|
| 572 | test util-9.14 {TclGetIntForIndex} { |
---|
| 573 | string index abcd 1-1 |
---|
| 574 | } a |
---|
| 575 | test util-9.15 {TclGetIntForIndex} { |
---|
| 576 | string index abcd -1+2 |
---|
| 577 | } b |
---|
| 578 | test util-9.16 {TclGetIntForIndex} { |
---|
| 579 | string index abcd -1--2 |
---|
| 580 | } b |
---|
| 581 | test util-9.17 {TclGetIntForIndex} { |
---|
| 582 | string index abcd { -1+2 } |
---|
| 583 | } b |
---|
| 584 | test util-9.18 {TclGetIntForIndex} { |
---|
| 585 | string index abcd { -1--2 } |
---|
| 586 | } b |
---|
| 587 | test util-9.19 {TclGetIntForIndex} -body { |
---|
| 588 | string index a {} |
---|
| 589 | } -returnCodes error -match glob -result * |
---|
| 590 | test util-9.20 {TclGetIntForIndex} -body { |
---|
| 591 | string index a { } |
---|
| 592 | } -returnCodes error -match glob -result * |
---|
| 593 | test util-9.21 {TclGetIntForIndex} -body { |
---|
| 594 | string index a " \r\t\n" |
---|
| 595 | } -returnCodes error -match glob -result * |
---|
| 596 | test util-9.22 {TclGetIntForIndex} -body { |
---|
| 597 | string index a + |
---|
| 598 | } -returnCodes error -match glob -result * |
---|
| 599 | test util-9.23 {TclGetIntForIndex} -body { |
---|
| 600 | string index a - |
---|
| 601 | } -returnCodes error -match glob -result * |
---|
| 602 | test util-9.24 {TclGetIntForIndex} -body { |
---|
| 603 | string index a x |
---|
| 604 | } -returnCodes error -match glob -result * |
---|
| 605 | test util-9.25 {TclGetIntForIndex} -body { |
---|
| 606 | string index a +x |
---|
| 607 | } -returnCodes error -match glob -result * |
---|
| 608 | test util-9.26 {TclGetIntForIndex} -body { |
---|
| 609 | string index a -x |
---|
| 610 | } -returnCodes error -match glob -result * |
---|
| 611 | test util-9.27 {TclGetIntForIndex} -body { |
---|
| 612 | string index a 0y |
---|
| 613 | } -returnCodes error -match glob -result * |
---|
| 614 | test util-9.28 {TclGetIntForIndex} -body { |
---|
| 615 | string index a 1* |
---|
| 616 | } -returnCodes error -match glob -result * |
---|
| 617 | test util-9.29 {TclGetIntForIndex} -body { |
---|
| 618 | string index a 0+ |
---|
| 619 | } -returnCodes error -match glob -result * |
---|
| 620 | test util-9.30 {TclGetIntForIndex} -body { |
---|
| 621 | string index a {0+ } |
---|
| 622 | } -returnCodes error -match glob -result * |
---|
| 623 | test util-9.31 {TclGetIntForIndex} -body { |
---|
| 624 | string index a 0x |
---|
| 625 | } -returnCodes error -match glob -result * |
---|
| 626 | test util-9.32 {TclGetIntForIndex} -body { |
---|
| 627 | string index a 0x1FFFFFFFF+0 |
---|
| 628 | } -returnCodes error -match glob -result * |
---|
| 629 | test util-9.33 {TclGetIntForIndex} -body { |
---|
| 630 | string index a 100000000000+0 |
---|
| 631 | } -returnCodes error -match glob -result * |
---|
| 632 | test util-9.34 {TclGetIntForIndex} -body { |
---|
| 633 | string index a 1.0 |
---|
| 634 | } -returnCodes error -match glob -result * |
---|
| 635 | test util-9.35 {TclGetIntForIndex} -body { |
---|
| 636 | string index a 1e23 |
---|
| 637 | } -returnCodes error -match glob -result * |
---|
| 638 | test util-9.36 {TclGetIntForIndex} -body { |
---|
| 639 | string index a 1.5e2 |
---|
| 640 | } -returnCodes error -match glob -result * |
---|
| 641 | test util-9.37 {TclGetIntForIndex} -body { |
---|
| 642 | string index a 0+x |
---|
| 643 | } -returnCodes error -match glob -result * |
---|
| 644 | test util-9.38 {TclGetIntForIndex} -body { |
---|
| 645 | string index a 0+0x |
---|
| 646 | } -returnCodes error -match glob -result * |
---|
| 647 | test util-9.39 {TclGetIntForIndex} -body { |
---|
| 648 | string index a 0+0xg |
---|
| 649 | } -returnCodes error -match glob -result * |
---|
| 650 | test util-9.40 {TclGetIntForIndex} -body { |
---|
| 651 | string index a 0+0xg |
---|
| 652 | } -returnCodes error -match glob -result * |
---|
| 653 | test util-9.41 {TclGetIntForIndex} -body { |
---|
| 654 | string index a 0+1.0 |
---|
| 655 | } -returnCodes error -match glob -result * |
---|
| 656 | test util-9.42 {TclGetIntForIndex} -body { |
---|
| 657 | string index a 0+1e2 |
---|
| 658 | } -returnCodes error -match glob -result * |
---|
| 659 | test util-9.43 {TclGetIntForIndex} -body { |
---|
| 660 | string index a 0+1.5e1 |
---|
| 661 | } -returnCodes error -match glob -result * |
---|
| 662 | test util-9.44 {TclGetIntForIndex} -body { |
---|
| 663 | string index a 0+1000000000000 |
---|
| 664 | } -returnCodes error -match glob -result * |
---|
| 665 | |
---|
| 666 | test util-10.1 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 667 | convertDouble 0x0000000000000000 |
---|
| 668 | } {0.0} |
---|
| 669 | test util-10.2 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 670 | convertDouble 0x8000000000000000 |
---|
| 671 | } {-0.0} |
---|
| 672 | test util-10.3 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 673 | convertDouble 0x7ef754e31cd072da |
---|
| 674 | } {4e+303} |
---|
| 675 | test util-10.4 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 676 | convertDouble 0xd08afcef51f0fb5f |
---|
| 677 | } {-1e+80} |
---|
| 678 | test util-10.5 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 679 | convertDouble 0x7ed754e31cd072da |
---|
| 680 | } {1e+303} |
---|
| 681 | test util-10.6 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 682 | convertDouble 0xfee754e31cd072da |
---|
| 683 | } {-2e+303} |
---|
| 684 | test util-10.7 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 685 | convertDouble 0x0afe07b27dd78b14 |
---|
| 686 | } {1e-255} |
---|
| 687 | test util-10.8 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 688 | convertDouble 0x93ae29e9c56687fe |
---|
| 689 | } {-7e-214} |
---|
| 690 | test util-10.9 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 691 | convertDouble 0x376be03d0bf225c7 |
---|
| 692 | } {1e-41} |
---|
| 693 | test util-10.10 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 694 | convertDouble 0xa0ca2fe76a3f9475 |
---|
| 695 | } {-1e-150} |
---|
| 696 | test util-10.11 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 697 | convertDouble 0x7fa9a2028368022e |
---|
| 698 | } {9e+306} |
---|
| 699 | test util-10.12 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 700 | convertDouble 0xdfc317e5ef3ab327 |
---|
| 701 | } {-2e+153} |
---|
| 702 | test util-10.13 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 703 | convertDouble 0x5fd317e5ef3ab327 |
---|
| 704 | } {4e+153} |
---|
| 705 | test util-10.14 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 706 | convertDouble 0xdfe317e5ef3ab327 |
---|
| 707 | } {-8e+153} |
---|
| 708 | test util-10.15 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 709 | convertDouble 0x00feb8e84fa0b278 |
---|
| 710 | } {7e-304} |
---|
| 711 | test util-10.16 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 712 | convertDouble 0x8133339131c46f8b |
---|
| 713 | } {-7e-303} |
---|
| 714 | test util-10.17 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 715 | convertDouble 0x35dc0f92a6276c9d |
---|
| 716 | } {3e-49} |
---|
| 717 | test util-10.18 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 718 | convertDouble 0xa445ce1f143d7ad2 |
---|
| 719 | } {-6e-134} |
---|
| 720 | test util-10.19 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 721 | convertDouble 0x2d2c0794d9d40e96 |
---|
| 722 | } {4.3e-91} |
---|
| 723 | test util-10.20 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 724 | convertDouble 0xad3c0794d9d40e96 |
---|
| 725 | } {-8.6e-91} |
---|
| 726 | test util-10.21 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 727 | convertDouble 0x30ecd5bee57763e6 |
---|
| 728 | } {5.1e-73} |
---|
| 729 | test util-10.22 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 730 | convertDouble 0x68ad1c26db7d0dae |
---|
| 731 | } {1.7e+196} |
---|
| 732 | test util-10.23 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 733 | convertDouble 0xbfa3f7ced916872b |
---|
| 734 | } {-0.039} |
---|
| 735 | test util-10.24 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 736 | convertDouble 0x64b7d93193f78fc6 |
---|
| 737 | } {1.51e+177} |
---|
| 738 | test util-10.25 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 739 | convertDouble 0x98ea82a1631eeb30 |
---|
| 740 | } {-1.19e-188} |
---|
| 741 | test util-10.26 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 742 | convertDouble 0xd216c309024bab4b |
---|
| 743 | } {-2.83e+87} |
---|
| 744 | test util-10.27 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 745 | convertDouble 0x0dfdbbac6f83a821 |
---|
| 746 | } {2.7869147e-241} |
---|
| 747 | test util-10.28 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 748 | convertDouble 0xdadc569e968e0944 |
---|
| 749 | } {-4.91080654e+129} |
---|
| 750 | test util-10.29 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 751 | convertDouble 0x5acc569e968e0944 |
---|
| 752 | } {2.45540327e+129} |
---|
| 753 | test util-10.30 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 754 | convertDouble 0xab5fc575867314ee |
---|
| 755 | } {-9.078555839e-100} |
---|
| 756 | test util-10.31 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 757 | convertDouble 0xdabc569e968e0944 |
---|
| 758 | } {-1.227701635e+129} |
---|
| 759 | test util-10.32 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 760 | convertDouble 0x2b6fc575867314ee |
---|
| 761 | } {1.8157111678e-99} |
---|
| 762 | test util-10.33 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 763 | convertDouble 0xb3b8bf7e7fa6f02a |
---|
| 764 | } {-1.5400733123779e-59} |
---|
| 765 | test util-10.34 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 766 | convertDouble 0xcd83de005bd620df |
---|
| 767 | } {-2.6153245263757307e+65} |
---|
| 768 | test util-10.35 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 769 | convertDouble 0x6cdf92bacb3cb40c |
---|
| 770 | } {2.7210404151224248e+216} |
---|
| 771 | test util-10.36 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 772 | convertDouble 0xecef92bacb3cb40c |
---|
| 773 | } {-5.4420808302448496e+216} |
---|
| 774 | test util-10.37 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 775 | convertDouble 0x49342dbf25096cf5 |
---|
| 776 | } {4.5e+44} |
---|
| 777 | test util-10.38 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 778 | convertDouble 0xd06afcef51f0fb5f |
---|
| 779 | } {-2.5e+79} |
---|
| 780 | test util-10.39 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 781 | convertDouble 0x49002498ea6df0c4 |
---|
| 782 | } {4.5e+43} |
---|
| 783 | test util-10.40 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 784 | convertDouble 0xfeb754e31cd072da |
---|
| 785 | } {-2.5e+302} |
---|
| 786 | test util-10.41 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 787 | convertDouble 0x1d22deac01e2b4f7 |
---|
| 788 | } {2.5e-168} |
---|
| 789 | test util-10.42 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 790 | convertDouble 0xaccb1df536c13eee |
---|
| 791 | } {-6.5e-93} |
---|
| 792 | test util-10.43 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 793 | convertDouble 0x3650711fed5b19a4 |
---|
| 794 | } {4.5e-47} |
---|
| 795 | test util-10.44 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 796 | convertDouble 0xb6848d67e8b1e00d |
---|
| 797 | } {-4.5e-46} |
---|
| 798 | test util-10.45 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 799 | convertDouble 0x4bac8c574c0c6be7 |
---|
| 800 | } {3.5e+56} |
---|
| 801 | test util-10.46 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 802 | convertDouble 0xccd756183c147514 |
---|
| 803 | } {-1.5e+62} |
---|
| 804 | test util-10.47 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 805 | convertDouble 0x4ca2ab469676c410 |
---|
| 806 | } {1.5e+61} |
---|
| 807 | test util-10.48 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 808 | convertDouble 0xcf5539684e774b48 |
---|
| 809 | } {-1.5e+74} |
---|
| 810 | test util-10.49 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 811 | convertDouble 0x2e12e5f5dfa4fe9d |
---|
| 812 | } {9.5e-87} |
---|
| 813 | test util-10.50 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 814 | convertDouble 0x8b9bdc2417bf7787 |
---|
| 815 | } {-9.5e-253} |
---|
| 816 | test util-10.51 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 817 | convertDouble 0x00eeb8e84fa0b278 |
---|
| 818 | } {3.5e-304} |
---|
| 819 | test util-10.52 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 820 | convertDouble 0xadde3cbc9907fdc8 |
---|
| 821 | } {-9.5e-88} |
---|
| 822 | test util-10.53 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 823 | convertDouble 0x2bb0ad836f269a17 |
---|
| 824 | } {3.05e-98} |
---|
| 825 | test util-10.54 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 826 | convertDouble 0x950b39ae1909c31b |
---|
| 827 | } {-2.65e-207} |
---|
| 828 | test util-10.55 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 829 | convertDouble 0x1bfb2ab18615fcc6 |
---|
| 830 | } {6.865e-174} |
---|
| 831 | test util-10.56 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 832 | convertDouble 0x98f3e1f90a573064 |
---|
| 833 | } {-1.785e-188} |
---|
| 834 | test util-10.57 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 835 | convertDouble 0x5206c309024bab4b |
---|
| 836 | } {1.415e+87} |
---|
| 837 | test util-10.58 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 838 | convertDouble 0xcc059bd3ad46e346 |
---|
| 839 | } {-1.6955e+58} |
---|
| 840 | test util-10.59 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 841 | convertDouble 0x47bdf4170f0fdecc |
---|
| 842 | } {3.9815e+37} |
---|
| 843 | test util-10.60 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 844 | convertDouble 0x59e7e1e0f1c7a4ac |
---|
| 845 | } {1.263005e+125} |
---|
| 846 | test util-10.61 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 847 | convertDouble 0xda1dda592e398dd7 |
---|
| 848 | } {-1.263005e+126} |
---|
| 849 | test util-10.62 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 850 | convertDouble 0xdc4e597c0b94b7ae |
---|
| 851 | } {-4.4118455e+136} |
---|
| 852 | test util-10.63 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 853 | convertDouble 0x5aac569e968e0944 |
---|
| 854 | } {6.138508175e+128} |
---|
| 855 | test util-10.64 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 856 | convertDouble 0xdabc569e968e0944 |
---|
| 857 | } {-1.227701635e+129} |
---|
| 858 | test util-10.65 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 859 | convertDouble 0x6ce7ae0c186d8709 |
---|
| 860 | } {4.081560622683637e+216} |
---|
| 861 | test util-10.66 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 862 | convertDouble 0x44b52d02c7e14af7 |
---|
| 863 | } {1.0000000000000001e+23} |
---|
| 864 | test util-10.67 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 865 | convertDouble 0xc589d971e4fe8402 |
---|
| 866 | } {-1e+27} |
---|
| 867 | test util-10.68 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 868 | convertDouble 0x4599d971e4fe8402 |
---|
| 869 | } {2e+27} |
---|
| 870 | test util-10.69 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 871 | convertDouble 0xc5a9d971e4fe8402 |
---|
| 872 | } {-4e+27} |
---|
| 873 | test util-10.70 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 874 | convertDouble 0x3e45798ee2308c3a |
---|
| 875 | } {1e-8} |
---|
| 876 | test util-10.71 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 877 | convertDouble 0xbe55798ee2308c3a |
---|
| 878 | } {-2e-8} |
---|
| 879 | test util-10.72 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 880 | convertDouble 0x3e65798ee2308c3a |
---|
| 881 | } {4e-8} |
---|
| 882 | test util-10.73 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 883 | convertDouble 0xbabef2d0f5da7dd9 |
---|
| 884 | } {-1e-25} |
---|
| 885 | test util-10.74 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 886 | convertDouble 0x44da784379d99db4 |
---|
| 887 | } {5e+23} |
---|
| 888 | test util-10.75 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 889 | convertDouble 0xc4fa784379d99db4 |
---|
| 890 | } {-2e+24} |
---|
| 891 | test util-10.76 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 892 | convertDouble 0x4503da329b633647 |
---|
| 893 | } {3e+24} |
---|
| 894 | test util-10.77 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 895 | convertDouble 0xc54cf389cd46047d |
---|
| 896 | } {-7e+25} |
---|
| 897 | test util-10.78 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 898 | convertDouble 0x3fc999999999999a |
---|
| 899 | } {0.2} |
---|
| 900 | test util-10.79 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 901 | convertDouble 0xbfd3333333333333 |
---|
| 902 | } {-0.3} |
---|
| 903 | test util-10.80 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 904 | convertDouble 0x3cf6849b86a12b9b |
---|
| 905 | } {5e-15} |
---|
| 906 | test util-10.81 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 907 | convertDouble 0xbd16849b86a12b9b |
---|
| 908 | } {-2e-14} |
---|
| 909 | test util-10.82 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 910 | convertDouble 0x3b87ccfc73126788 |
---|
| 911 | } {6.3e-22} |
---|
| 912 | test util-10.83 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 913 | convertDouble 0xbbbdc03b8fd7016a |
---|
| 914 | } {-6.3e-21} |
---|
| 915 | test util-10.84 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 916 | convertDouble 0x3fa3f7ced916872b |
---|
| 917 | } {0.039} |
---|
| 918 | test util-10.85 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 919 | convertDouble 0x460b297cad9f70b6 |
---|
| 920 | } {2.69e+29} |
---|
| 921 | test util-10.86 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 922 | convertDouble 0xc61b297cad9f70b6 |
---|
| 923 | } {-5.38e+29} |
---|
| 924 | test util-10.87 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 925 | convertDouble 0x3adcdc06b20ef183 |
---|
| 926 | } {3.73e-25} |
---|
| 927 | test util-10.88 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 928 | convertDouble 0x45fb297cad9f70b6 |
---|
| 929 | } {1.345e+29} |
---|
| 930 | test util-10.89 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 931 | convertDouble 0xc60b297cad9f70b6 |
---|
| 932 | } {-2.69e+29} |
---|
| 933 | test util-10.90 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 934 | convertDouble 0xbc050a246ecd44f3 |
---|
| 935 | } {-1.4257e-19} |
---|
| 936 | test util-10.91 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 937 | convertDouble 0xbec19b96f36ec68b |
---|
| 938 | } {-2.09901e-6} |
---|
| 939 | test util-10.92 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 940 | convertDouble 0x3dcc06d366394441 |
---|
| 941 | } {5.0980203373e-11} |
---|
| 942 | test util-10.93 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 943 | convertDouble 0xc79f58ac4db68c90 |
---|
| 944 | } {-1.04166211811e+37} |
---|
| 945 | test util-10.94 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 946 | convertDouble 0x4569d971e4fe8402 |
---|
| 947 | } {2.5e+26} |
---|
| 948 | test util-10.95 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 949 | convertDouble 0xc50dc74be914d16b |
---|
| 950 | } {-4.5e+24} |
---|
| 951 | test util-10.96 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 952 | convertDouble 0x4534adf4b7320335 |
---|
| 953 | } {2.5e+25} |
---|
| 954 | test util-10.97 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 955 | convertDouble 0xc54ae22487c1042b |
---|
| 956 | } {-6.5e+25} |
---|
| 957 | test util-10.98 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 958 | convertDouble 0x3c987fe49aab41e0 |
---|
| 959 | } {8.5e-17} |
---|
| 960 | test util-10.99 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 961 | convertDouble 0xbc2f5c05e4b23fd7 |
---|
| 962 | } {-8.5e-19} |
---|
| 963 | test util-10.100 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 964 | convertDouble 0x3d5faa7ab552a552 |
---|
| 965 | } {4.5e-13} |
---|
| 966 | test util-10.101 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 967 | convertDouble 0xbdbb7cdfd9d7bdbb |
---|
| 968 | } {-2.5e-11} |
---|
| 969 | test util-10.102 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 970 | convertDouble 0x44f3da329b633647 |
---|
| 971 | } {1.5e+24} |
---|
| 972 | test util-10.103 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 973 | convertDouble 0xc53cf389cd46047d |
---|
| 974 | } {-3.5e+25} |
---|
| 975 | test util-10.104 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 976 | convertDouble 0x454f04ef12cb04cf |
---|
| 977 | } {7.5e+25} |
---|
| 978 | test util-10.105 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 979 | convertDouble 0xc55f04ef12cb04cf |
---|
| 980 | } {-1.5e+26} |
---|
| 981 | test util-10.106 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 982 | convertDouble 0x3fc3333333333333 |
---|
| 983 | } {0.15} |
---|
| 984 | test util-10.107 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 985 | convertDouble 0xbdb07e1fe91b0b70 |
---|
| 986 | } {-1.5e-11} |
---|
| 987 | test util-10.108 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 988 | convertDouble 0x3de49da7e361ce4c |
---|
| 989 | } {1.5e-10} |
---|
| 990 | test util-10.109 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 991 | convertDouble 0xbe19c511dc3a41df |
---|
| 992 | } {-1.5e-9} |
---|
| 993 | test util-10.110 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 994 | convertDouble 0xc5caa83d74267822 |
---|
| 995 | } {-1.65e+28} |
---|
| 996 | test util-10.111 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 997 | convertDouble 0x4588f1d5969453de |
---|
| 998 | } {9.65e+26} |
---|
| 999 | test util-10.112 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1000 | convertDouble 0x3b91d9bd564dcda6 |
---|
| 1001 | } {9.45e-22} |
---|
| 1002 | test util-10.113 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1003 | convertDouble 0xbcfa58973ecbede6 |
---|
| 1004 | } {-5.85e-15} |
---|
| 1005 | test util-10.114 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1006 | convertDouble 0x45eb297cad9f70b6 |
---|
| 1007 | } {6.725e+28} |
---|
| 1008 | test util-10.115 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1009 | convertDouble 0xc5fb297cad9f70b6 |
---|
| 1010 | } {-1.345e+29} |
---|
| 1011 | test util-10.116 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1012 | convertDouble 0x3accdc06b20ef183 |
---|
| 1013 | } {1.865e-25} |
---|
| 1014 | test util-10.117 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1015 | convertDouble 0xbd036071dcae4565 |
---|
| 1016 | } {-8.605e-15} |
---|
| 1017 | test util-10.118 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1018 | convertDouble 0x462cb968d297dde8 |
---|
| 1019 | } {1.137885e+30} |
---|
| 1020 | test util-10.119 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1021 | convertDouble 0xc661f3e1839eeab1 |
---|
| 1022 | } {-1.137885e+31} |
---|
| 1023 | test util-10.120 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1024 | convertDouble 0x474e9cec176c96f8 |
---|
| 1025 | } {3.179033335e+35} |
---|
| 1026 | test util-10.121 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1027 | convertDouble 0x3dbc06d366394441 |
---|
| 1028 | } {2.54901016865e-11} |
---|
| 1029 | test util-10.122 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { |
---|
| 1030 | convertDouble 0x478f58ac4db68c90 |
---|
| 1031 | } {5.20831059055e+36} |
---|
| 1032 | |
---|
| 1033 | test util-11.1 {Tcl_PrintDouble - scaling} { |
---|
| 1034 | expr 1.1e-5 |
---|
| 1035 | } {1.1e-5} |
---|
| 1036 | test util-11.2 {Tcl_PrintDouble - scaling} { |
---|
| 1037 | expr 1.1e-4 |
---|
| 1038 | } {0.00011} |
---|
| 1039 | test util-11.3 {Tcl_PrintDouble - scaling} { |
---|
| 1040 | expr 1.1e-3 |
---|
| 1041 | } {0.0011} |
---|
| 1042 | test util-11.4 {Tcl_PrintDouble - scaling} { |
---|
| 1043 | expr 1.1e-2 |
---|
| 1044 | } {0.011} |
---|
| 1045 | test util-11.5 {Tcl_PrintDouble - scaling} { |
---|
| 1046 | expr 1.1e-1 |
---|
| 1047 | } {0.11} |
---|
| 1048 | test util-11.6 {Tcl_PrintDouble - scaling} { |
---|
| 1049 | expr 1.1e0 |
---|
| 1050 | } {1.1} |
---|
| 1051 | test util-11.7 {Tcl_PrintDouble - scaling} { |
---|
| 1052 | expr 1.1e1 |
---|
| 1053 | } {11.0} |
---|
| 1054 | test util-11.8 {Tcl_PrintDouble - scaling} { |
---|
| 1055 | expr 1.1e2 |
---|
| 1056 | } {110.0} |
---|
| 1057 | test util-11.9 {Tcl_PrintDouble - scaling} { |
---|
| 1058 | expr 1.1e3 |
---|
| 1059 | } {1100.0} |
---|
| 1060 | test util-11.10 {Tcl_PrintDouble - scaling} { |
---|
| 1061 | expr 1.1e4 |
---|
| 1062 | } {11000.0} |
---|
| 1063 | test util-11.11 {Tcl_PrintDouble - scaling} { |
---|
| 1064 | expr 1.1e5 |
---|
| 1065 | } {110000.0} |
---|
| 1066 | test util-11.12 {Tcl_PrintDouble - scaling} { |
---|
| 1067 | expr 1.1e6 |
---|
| 1068 | } {1100000.0} |
---|
| 1069 | test util-11.13 {Tcl_PrintDouble - scaling} { |
---|
| 1070 | expr 1.1e7 |
---|
| 1071 | } {11000000.0} |
---|
| 1072 | test util-11.14 {Tcl_PrintDouble - scaling} { |
---|
| 1073 | expr 1.1e8 |
---|
| 1074 | } {110000000.0} |
---|
| 1075 | test util-11.15 {Tcl_PrintDouble - scaling} { |
---|
| 1076 | expr 1.1e9 |
---|
| 1077 | } {1100000000.0} |
---|
| 1078 | test util-11.16 {Tcl_PrintDouble - scaling} { |
---|
| 1079 | expr 1.1e10 |
---|
| 1080 | } {11000000000.0} |
---|
| 1081 | test util-11.17 {Tcl_PrintDouble - scaling} { |
---|
| 1082 | expr 1.1e11 |
---|
| 1083 | } {110000000000.0} |
---|
| 1084 | test util-11.18 {Tcl_PrintDouble - scaling} { |
---|
| 1085 | expr 1.1e12 |
---|
| 1086 | } {1100000000000.0} |
---|
| 1087 | test util-11.19 {Tcl_PrintDouble - scaling} { |
---|
| 1088 | expr 1.1e13 |
---|
| 1089 | } {11000000000000.0} |
---|
| 1090 | test util-11.20 {Tcl_PrintDouble - scaling} { |
---|
| 1091 | expr 1.1e14 |
---|
| 1092 | } {110000000000000.0} |
---|
| 1093 | test util-11.21 {Tcl_PrintDouble - scaling} { |
---|
| 1094 | expr 1.1e15 |
---|
| 1095 | } {1100000000000000.0} |
---|
| 1096 | test util-11.22 {Tcl_PrintDouble - scaling} { |
---|
| 1097 | expr 1.1e16 |
---|
| 1098 | } {11000000000000000.0} |
---|
| 1099 | test util-11.23 {Tcl_PrintDouble - scaling} { |
---|
| 1100 | expr 1.1e17 |
---|
| 1101 | } {1.1e+17} |
---|
| 1102 | |
---|
| 1103 | # cleanup |
---|
| 1104 | ::tcltest::cleanupTests |
---|
| 1105 | return |
---|