1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# This file is a Tcl script to test the code in the file tclUtil.c.
# This file is organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1995-1998 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: util.test,v 1.10.6.3 2004/05/27 14:29:22 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
test util-1.1 {TclFindElement procedure - binary element in middle of list} {
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# This file is a Tcl script to test the code in the file tclUtil.c.
# This file is organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1995-1998 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: util.test,v 1.10.6.4 2005/04/29 22:41:02 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
test util-1.1 {TclFindElement procedure - binary element in middle of list} {
|
383
384
385
386
387
388
389
390
391
392
393
|
testdstring free
testdstring append {\\ } -1
testdstring append \{ -1
testdstring element foo
testdstring append \} -1
list [llength [testdstring get]] [string length [testdstring get]]
} {2 9}
# cleanup
::tcltest::cleanupTests
return
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
testdstring free
testdstring append {\\ } -1
testdstring append \{ -1
testdstring element foo
testdstring append \} -1
list [llength [testdstring get]] [string length [testdstring get]]
} {2 9}
test util-9.0.0 {TclGetIntForIndex} {
string index abcd 0
} a
test util-9.0.1 {TclGetIntForIndex} {
string index abcd 0x0
} a
test util-9.0.2 {TclGetIntForIndex} {
string index abcd -0x0
} a
test util-9.0.3 {TclGetIntForIndex} {
string index abcd { 0 }
} a
test util-9.0.4 {TclGetIntForIndex} {
string index abcd { 0x0 }
} a
test util-9.0.5 {TclGetIntForIndex} {
string index abcd { -0x0 }
} a
test util-9.0.6 {TclGetIntForIndex} {
string index abcd 01
} b
test util-9.0.7 {TclGetIntForIndex} {
string index abcd { 01 }
} b
test util-9.1.0 {TclGetIntForIndex} {
string index abcd 3
} d
test util-9.1.1 {TclGetIntForIndex} {
string index abcd { 3 }
} d
test util-9.1.2 {TclGetIntForIndex} {
string index abcdefghijk 0xa
} k
test util-9.1.3 {TclGetIntForIndex} {
string index abcdefghijk { 0xa }
} k
test util-9.2.0 {TclGetIntForIndex} {
string index abcd end
} d
test util-9.2.1 {TclGetIntForIndex} -body {
string index abcd { end}
} -returnCodes error -match glob -result *
test util-9.2.2 {TclGetIntForIndex} -body {
string index abcd {end }
} -returnCodes error -match glob -result *
test util-9.3 {TclGetIntForIndex} {
# Deprecated
string index abcd en
} d
test util-9.4 {TclGetIntForIndex} {
# Deprecated
string index abcd e
} d
test util-9.5.0 {TclGetIntForIndex} {
string index abcd end-1
} c
test util-9.5.1 {TclGetIntForIndex} {
string index abcd {end-1 }
} c
test util-9.5.2 {TclGetIntForIndex} -body {
string index abcd { end-1}
} -returnCodes error -match glob -result *
test util-9.6 {TclGetIntForIndex} {
string index abcd end+-1
} c
test util-9.7 {TclGetIntForIndex} {
string index abcd end+1
} {}
test util-9.8 {TclGetIntForIndex} {
string index abcd end--1
} {}
test util-9.9.0 {TclGetIntForIndex} {
string index abcd 0+0
} a
test util-9.9.1 {TclGetIntForIndex} {
string index abcd { 0+0 }
} a
test util-9.10 {TclGetIntForIndex} {
string index abcd 0-0
} a
test util-9.11 {TclGetIntForIndex} {
string index abcd 1+0
} b
test util-9.12 {TclGetIntForIndex} {
string index abcd 1-0
} b
test util-9.13 {TclGetIntForIndex} {
string index abcd 1+1
} c
test util-9.14 {TclGetIntForIndex} {
string index abcd 1-1
} a
test util-9.15 {TclGetIntForIndex} {
string index abcd -1+2
} b
test util-9.16 {TclGetIntForIndex} {
string index abcd -1--2
} b
test util-9.17 {TclGetIntForIndex} {
string index abcd { -1+2 }
} b
test util-9.18 {TclGetIntForIndex} {
string index abcd { -1--2 }
} b
test util-9.19 {TclGetIntForIndex} -body {
string index a {}
} -returnCodes error -match glob -result *
test util-9.20 {TclGetIntForIndex} -body {
string index a { }
} -returnCodes error -match glob -result *
test util-9.21 {TclGetIntForIndex} -body {
string index a " \r\t\n"
} -returnCodes error -match glob -result *
test util-9.22 {TclGetIntForIndex} -body {
string index a +
} -returnCodes error -match glob -result *
test util-9.23 {TclGetIntForIndex} -body {
string index a -
} -returnCodes error -match glob -result *
test util-9.24 {TclGetIntForIndex} -body {
string index a x
} -returnCodes error -match glob -result *
test util-9.25 {TclGetIntForIndex} -body {
string index a +x
} -returnCodes error -match glob -result *
test util-9.26 {TclGetIntForIndex} -body {
string index a -x
} -returnCodes error -match glob -result *
test util-9.27 {TclGetIntForIndex} -body {
string index a 0y
} -returnCodes error -match glob -result *
test util-9.28 {TclGetIntForIndex} -body {
string index a 1*
} -returnCodes error -match glob -result *
test util-9.29 {TclGetIntForIndex} -body {
string index a 0+
} -returnCodes error -match glob -result *
test util-9.30 {TclGetIntForIndex} -body {
string index a {0+ }
} -returnCodes error -match glob -result *
test util-9.31 {TclGetIntForIndex} -body {
string index a 0x
} -returnCodes error -match glob -result *
test util-9.32 {TclGetIntForIndex} -body {
string index a 0x1FFFFFFFF+0
} -returnCodes error -match glob -result *
test util-9.33 {TclGetIntForIndex} -body {
string index a 100000000000+0
} -returnCodes error -match glob -result *
test util-9.34 {TclGetIntForIndex} -body {
string index a 1.0
} -returnCodes error -match glob -result *
test util-9.35 {TclGetIntForIndex} -body {
string index a 1e23
} -returnCodes error -match glob -result *
test util-9.36 {TclGetIntForIndex} -body {
string index a 1.5e2
} -returnCodes error -match glob -result *
test util-9.37 {TclGetIntForIndex} -body {
string index a 0+x
} -returnCodes error -match glob -result *
test util-9.38 {TclGetIntForIndex} -body {
string index a 0+0x
} -returnCodes error -match glob -result *
test util-9.39 {TclGetIntForIndex} -body {
string index a 0+0xg
} -returnCodes error -match glob -result *
test util-9.40 {TclGetIntForIndex} -body {
string index a 0+0xg
} -returnCodes error -match glob -result *
test util-9.41 {TclGetIntForIndex} -body {
string index a 0+1.0
} -returnCodes error -match glob -result *
test util-9.42 {TclGetIntForIndex} -body {
string index a 0+1e2
} -returnCodes error -match glob -result *
test util-9.43 {TclGetIntForIndex} -body {
string index a 0+1.5e1
} -returnCodes error -match glob -result *
test util-9.44 {TclGetIntForIndex} -body {
string index a 0+1000000000000
} -returnCodes error -match glob -result *
# cleanup
::tcltest::cleanupTests
return
|