Tcl Source Code

Check-in [84706f16ce]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Split up tests to get better focus on what is being tested
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tip-312-new
Files: files | file ages | folders
SHA3-256: 84706f16ceb70e5abcabbc0b347ec8e2d001f061f33399d8a2a1e724b1455f92
User & Date: dkf 2019-04-04 08:52:43
Context
2019-04-04
22:48
Fix unsigned wide linking. check-in: 5d6108345e user: dkf tags: tip-312-new
08:52
Split up tests to get better focus on what is being tested check-in: 84706f16ce user: dkf tags: tip-312-new
2019-04-03
12:22
Docs check-in: 3c244a994e user: dkf tags: tip-312-new
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/link.test.

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
578
579
580
581
582
583
584
585
586
587
588
589
590

591





592
593
594
595
596

597



598
599
600
601
602

603

604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622

623





624
625
626
627
628

629



630
631
632
633
634

635

636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653

654





655
656
657
658
659

660



661
662
663
664
665

666

667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684








685
686


687





688
689
690
691
692

693



694
695
696
697
698

699

700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717

718





719
720
721
722
723

724



725
726
727
728
729

730

731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748










749
750


751





752
753
754
755
756

757



758
759
760
761
762

763

764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779

780



781
782
783
784
785

786

787
788
789
790
791
792
793
794
795
796
797
798
799
800

801





802
803
804
805
806
807
808

809



810
811
812
813
814

815

816
817
818
819
820
821
822
823
824
825
826
827
828
829
test link-8.3 {Tcl_UpdateLinkedVar procedure, read-only variable} {testlink} {
    testlink create 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    list [catch {
	testlink update 47 {} {} {} {} {} {} {} {} {} {} {} {} {}
    } msg] $msg $int
} {0 {} 47}

test link-9.1 {linkarray usage messages} -setup {
    set mylist [list]
} -body {
    catch {testlinkarray} msg
    lappend mylist $msg
    catch {testlinkarray x} msg
    lappend mylist $msg
    catch {testlinkarray update} msg
    lappend mylist $msg
    catch {testlinkarray remove} msg
    lappend mylist $msg
    catch {testlinkarray create} msg
    lappend mylist $msg
    catch {testlinkarray create xx 1 my} msg
    lappend mylist $msg
    catch {testlinkarray create char* 0 my} msg
    lappend mylist $msg
    join $mylist "\n"
} -cleanup {
    unset -nocomplain my
} -result {wrong # args: should be "testlinkarray option args"
bad option "x": must be update, remove, or create


wrong # args: should be "testlinkarray create ?-readonly? type size name ?address?"
bad type "xx": must be char, uchar, short, ushort, int, uint, long, ulong, wide, uwide, float, double, string, char*, or binary
wrong array size given}

test link-10.1 {linkarray char*} -setup {
    set mylist [list]
} -body {
    testlinkarray create char* 1 ::my(var)
    lappend mylist [set ::my(var) ""]
    catch {set ::my(var) x} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)



    testlinkarray create char* 4 ::my(var)
    set ::my(var) x
    catch {set ::my(var) xyzz} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)



    testlinkarray create -r char* 4 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {
can't set "::my(var)": wrong size of char* value
can't set "::my(var)": wrong size of char* value
can't set "::my(var)": linked variable is read-only}

test link-11.1 {linkarray char} -setup {
    set mylist [list]
} -body {
    testlinkarray create char 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1234} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)





    testlinkarray create char 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r char 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": variable must have char value
120
can't set "::my(var)": variable must have char value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-12.1 {linkarray unsigned char} -setup {
    set mylist [list]
} -body {
    testlinkarray create uchar 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1234} msg
    lappend mylist $msg
    catch {set ::my(var) -1} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)





    testlinkarray create uchar 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r uchar 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": variable must have unsigned char value
120
can't set "::my(var)": variable must have unsigned char value
can't set "::my(var)": variable must have unsigned char value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-13.1 {linkarray short} -setup {
    set mylist [list]
} -body {
    testlinkarray create short 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 123456} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)





    testlinkarray create short 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r short 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": variable must have short value
120
can't set "::my(var)": variable must have short value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-14.1 {linkarray unsigned short} -setup {
    set mylist [list]
} -body {
    testlinkarray create ushort 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 123456} msg
    lappend mylist $msg
    catch {set ::my(var) -1} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)





    testlinkarray create ushort 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r ushort 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": variable must have unsigned short value
120
can't set "::my(var)": variable must have unsigned short value
can't set "::my(var)": variable must have unsigned short value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-15.1 {linkarray int} -setup {
    set mylist [list]
} -body {
    testlinkarray create int 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e3} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)





    testlinkarray create int 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r int 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": variable must have integer value
120
can't set "::my(var)": variable must have integer value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-16.1 {linkarray unsigned int} -setup {
    set mylist [list]
} -body {
    testlinkarray create uint 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg
    catch {set ::my(var) -1} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)





    testlinkarray create uint 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r uint 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": variable must have unsigned int value
120
can't set "::my(var)": variable must have unsigned int value
can't set "::my(var)": variable must have unsigned int value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-17.1 {linkarray long} -setup {
    set mylist [list]
} -body {
    testlinkarray create long 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)





    testlinkarray create long 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r long 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -match glob -result {can't set "::my(var)": variable must have * value
120
can't set "::my(var)": variable must have * value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-18.1 {linkarray unsigned long} -constraints knownBug -setup {
    set mylist [list]
} -body {
    # Implementation needs to use bignums on 64-bit platforms
    testlinkarray create ulong 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg








    catch {set ::my(var) -1} msg
    lappend mylist $msg


    testlinkarray remove ::my(var)





    testlinkarray create ulong 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r ulong 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -match glob -result {can't set "::my(var)": variable must have unsigned * value
120
can't set "::my(var)": variable must have unsigned * value
can't set "::my(var)": variable must have unsigned * value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-19.1 {linkarray wide} -setup {
    set mylist [list]
} -body {
    testlinkarray create wide 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg

    testlinkarray remove ::my(var)





    testlinkarray create wide 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r wide 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": variable must have wide integer value
120
can't set "::my(var)": variable must have wide integer value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-20.1 {linkarray unsigned wide} -constraints knownBug -setup {
    set mylist [list]
} -body {
    # Implementation needs to use bignums
    testlinkarray create uwide 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg










    catch {set ::my(var) -1} msg
    lappend mylist $msg


    testlinkarray remove ::my(var)





    testlinkarray create uwide 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r uwide 2 ::my(var)
    catch {set ::my(var) {1 2}} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": variable must have unsigned wide int value
120
can't set "::my(var)": variable must have unsigned wide int value
can't set "::my(var)": variable must have unsigned wide int value
can't set "::my(var)": wrong dimension
1 2 3 4
can't set "::my(var)": linked variable is read-only}

test link-21.1 {linkarray string} -setup {
    set mylist [list]
} -body {
    testlinkarray create string 1 ::my(var)
    lappend mylist [set ::my(var) ""]
    lappend mylist [set ::my(var) "xyz"]
    lappend mylist $::my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r string 4 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {
xyz
xyz
can't set "::my(var)": linked variable is read-only}

test link-22.1 {linkarray binary} -setup {
    set mylist [list]
} -body {
    testlinkarray create binary 1 ::my(var)
    set ::my(var) x
    catch {set ::my(var) xy} msg
    lappend mylist $msg
    lappend mylist $::my(var)

    testlinkarray remove ::my(var)





    testlinkarray create binary 4 ::my(var)
    catch {set ::my(var) abc} msg
    lappend mylist $msg
    catch {set ::my(var) abcde} msg
    lappend mylist $msg
    set ::my(var) abcd
    lappend mylist $::my(var)

    testlinkarray remove ::my(var)



    testlinkarray create -r binary 4 ::my(var)
    catch {set ::my(var) xyzv} msg
    lappend mylist $msg
    testlinkarray remove ::my(var)
    join $mylist "\n"

} -cleanup {

    unset -nocomplain my
} -result {can't set "::my(var)": wrong size of binary value
x
can't set "::my(var)": wrong size of binary value
can't set "::my(var)": wrong size of binary value
abcd
can't set "::my(var)": linked variable is read-only}
 
catch {testlink set 0 0 0 - 0 0 0 0 0 0 0 0 0 0}
catch {testlink delete}
foreach i {int real bool string wide} {
    unset -nocomplain $i
}







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
<
<
<
<








>

>
>
>



|
>

>
>
>


<
<
<
>

>

<
<
<
|










>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
|












>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
<
|










>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
|












>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
<
|










>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
|












>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
<
|










>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
|

|


<






>
>
>
>
>
>
>
>

<
>
>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
<
|










>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
|

|


<






>
>
>
>
>
>
>
>
>
>

<
>
>

>
>
>
>
>





>

>
>
>


<
<
<
>

>

<
<
<
<
<
<
|








>

>
>
>


<
<
<
>

>

<
<
<
|









>

>
>
>
>
>







>

>
>
>


<
<
<
>

>

<
<
<
<
<
|







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
578
579
580
581
582
583
584
585
586
587



588
589
590
591






592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621



622
623
624
625





626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657



658
659
660
661






662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691



692
693
694
695





696
697
698
699
700

701
702
703
704
705
706
707
708
709
710
711
712
713
714
715

716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735



736
737
738
739






740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769



770
771
772
773





774
775
776
777
778

779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795

796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815



816
817
818
819






820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835



836
837
838
839



840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870



871
872
873
874





875
876
877
878
879
880
881
882
test link-8.3 {Tcl_UpdateLinkedVar procedure, read-only variable} {testlink} {
    testlink create 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    list [catch {
	testlink update 47 {} {} {} {} {} {} {} {} {} {} {} {} {}
    } msg] $msg $int
} {0 {} 47}

test link-9.1 {linkarray usage messages} -returnCodes error -body {
    testlinkarray
} -result {wrong # args: should be "testlinkarray option args"}
test link-9.2 {linkarray usage messages} -returnCodes error -body {
    testlinkarray x
} -result {bad option "x": must be update, remove, or create}
test link-9.3 {linkarray usage messages} -body {
    testlinkarray update
} -result {}
test link-9.4 {linkarray usage messages} -body {
    testlinkarray remove
} -result {}
test link-9.5 {linkarray usage messages} -returnCodes error -body {
    testlinkarray create
} -result {wrong # args: should be "testlinkarray create ?-readonly? type size name ?address?"}
test link-9.6 {linkarray usage messages} -returnCodes error -body {
    testlinkarray create xx 1 my
} -result {bad type "xx": must be char, uchar, short, ushort, int, uint, long, ulong, wide, uwide, float, double, string, char*, or binary}
test link-9.7 {linkarray usage messages} -returnCodes error -body {
    testlinkarray create char* 0 my
} -result {wrong array size given}







test link-10.1 {linkarray char*} -setup {
    set mylist [list]
} -body {
    testlinkarray create char* 1 ::my(var)
    lappend mylist [set ::my(var) ""]
    catch {set ::my(var) x} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{} {can't set "::my(var)": wrong size of char* value}}
test link-10.2 {linkarray char*} -body {
    testlinkarray create char* 4 ::my(var)
    set ::my(var) x
    catch {set ::my(var) xyzz} msg
    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {can't set "::my(var)": wrong size of char* value}
test link-10.3 {linkarray char*} -body {
    testlinkarray create -r char* 4 ::my(var)
    catch {set ::my(var) x} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my



} -result {can't set "::my(var)": linked variable is read-only}

test link-11.1 {linkarray char} -setup {
    set mylist [list]
} -body {
    testlinkarray create char 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1234} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have char value} 120 {can't set "::my(var)": variable must have char value}}
test link-11.2 {linkarray char} -setup {
    set mylist [list]
} -body {
    testlinkarray create char 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-11.3 {linkarray char} -body {
    testlinkarray create -r char 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my





} -result {can't set "::my(var)": linked variable is read-only}

test link-12.1 {linkarray unsigned char} -setup {
    set mylist [list]
} -body {
    testlinkarray create uchar 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1234} msg
    lappend mylist $msg
    catch {set ::my(var) -1} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have unsigned char value} 120 {can't set "::my(var)": variable must have unsigned char value} {can't set "::my(var)": variable must have unsigned char value}}
test link-12.2 {linkarray unsigned char} -setup {
    set mylist [list]
} -body {
    testlinkarray create uchar 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-12.3 {linkarray unsigned char} -body {
    testlinkarray create -r uchar 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my






} -result {can't set "::my(var)": linked variable is read-only}

test link-13.1 {linkarray short} -setup {
    set mylist [list]
} -body {
    testlinkarray create short 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 123456} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have short value} 120 {can't set "::my(var)": variable must have short value}}
test link-13.2 {linkarray short} -setup {
    set mylist [list]
} -body {
    testlinkarray create short 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-13.3 {linkarray short} -body {
    testlinkarray create -r short 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my





} -result {can't set "::my(var)": linked variable is read-only}

test link-14.1 {linkarray unsigned short} -setup {
    set mylist [list]
} -body {
    testlinkarray create ushort 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 123456} msg
    lappend mylist $msg
    catch {set ::my(var) -1} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have unsigned short value} 120 {can't set "::my(var)": variable must have unsigned short value} {can't set "::my(var)": variable must have unsigned short value}}
test link-14.2 {linkarray unsigned short} -setup {
    set mylist [list]
} -body {
    testlinkarray create ushort 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-14.3 {linkarray unsigned short} -body {
    testlinkarray create -r ushort 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my






} -result {can't set "::my(var)": linked variable is read-only}

test link-15.1 {linkarray int} -setup {
    set mylist [list]
} -body {
    testlinkarray create int 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e3} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have integer value} 120 {can't set "::my(var)": variable must have integer value}}
test link-15.2 {linkarray int} -setup {
    set mylist [list]
} -body {
    testlinkarray create int 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-15.3 {linkarray int} -body {
    testlinkarray create -r int 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my





} -result {can't set "::my(var)": linked variable is read-only}

test link-16.1 {linkarray unsigned int} -setup {
    set mylist [list]
} -body {
    testlinkarray create uint 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg
    catch {set ::my(var) -1} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain ::my
} -result {{can't set "::my(var)": variable must have unsigned int value} 120 {can't set "::my(var)": variable must have unsigned int value} {can't set "::my(var)": variable must have unsigned int value}}
test link-16.2 {linkarray unsigned int} -setup {
    set mylist [list]
} -body {
    testlinkarray create uint 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain ::my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-16.3 {linkarray unsigned int} -body {
    testlinkarray create -r uint 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my






} -result {can't set "::my(var)": linked variable is read-only}

test link-17.1 {linkarray long} -setup {
    set mylist [list]
} -body {
    testlinkarray create long 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg
} -match glob -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have * value} 120 {can't set "::my(var)": variable must have * value}}
test link-17.2 {linkarray long} -setup {
    set mylist [list]
} -body {
    testlinkarray create long 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-17.3 {linkarray long} -body {
    testlinkarray create -r long 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my





} -result {can't set "::my(var)": linked variable is read-only}

test link-18.1 {linkarray unsigned long} -setup {
    set mylist [list]
} -body {

    testlinkarray create ulong 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg
} -match glob -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have unsigned * value} 120 {can't set "::my(var)": variable must have unsigned * value}}
test link-18.2 {linkarray unsigned long} -constraints knownBug -body {
    # BUG: Implementation needs to use bignums on 64-bit platforms
    testlinkarray create ulong 1 ::my(var)
    set ::my(var) 120
    catch {set ::my(var) -1} msg

    return $msg
} -match glob -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {can't set "::my(var)": variable must have unsigned * value}
test link-18.3 {linkarray unsigned long} -setup {
    set mylist [list]
} -body {
    testlinkarray create ulong 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-18.4 {linkarray unsigned long} -body {
    testlinkarray create -r ulong 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my






} -result {can't set "::my(var)": linked variable is read-only}

test link-19.1 {linkarray wide} -setup {
    set mylist [list]
} -body {
    testlinkarray create wide 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have wide integer value} 120 {can't set "::my(var)": variable must have wide integer value}}
test link-19.2 {linkarray wide} -setup {
    set mylist [list]
} -body {
    testlinkarray create wide 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-19.3 {linkarray wide} -body {
    testlinkarray create -r wide 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my





} -result {can't set "::my(var)": linked variable is read-only}

test link-20.1 {linkarray unsigned wide} -setup {
    set mylist [list]
} -body {

    testlinkarray create uwide 1 ::my(var)
    catch {set ::my(var) x} msg
    lappend mylist $msg
    lappend mylist [set ::my(var) 120]
    catch {set ::my(var) 1e33} msg
    lappend mylist $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": variable must have unsigned wide int value} 120 {can't set "::my(var)": variable must have unsigned wide int value}}
test link-20.2 {linkarray unsigned wide} -constraints knownBug -setup {
    set mylist [list]
} -body {
    # BUG: Implementation needs to use bignums
    testlinkarray create uwide 1 ::my(var)
    set ::my(var) 120
    catch {set ::my(var) -1} msg

    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {can't set "::my(var)": variable must have unsigned wide int value}
test link-20.3 {linkarray unsigned wide} -setup {
    set mylist [list]
} -body {
    testlinkarray create uwide 4 ::my(var)
    catch {set ::my(var) {1 2 3}} msg
    lappend mylist $msg
    set ::my(var) {1 2 3 4}
    lappend mylist $my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong dimension} {1 2 3 4}}
test link-20.4 {linkarray unsigned wide} -body {
    testlinkarray create -r uwide 2 ::my(var)
    catch {set ::my(var) {1 2}} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my






} -result {can't set "::my(var)": linked variable is read-only}

test link-21.1 {linkarray string} -setup {
    set mylist [list]
} -body {
    testlinkarray create string 1 ::my(var)
    lappend mylist [set ::my(var) ""]
    lappend mylist [set ::my(var) "xyz"]
    lappend mylist $::my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{} xyz xyz}
test link-21.2 {linkarray string} -body {
    testlinkarray create -r string 4 ::my(var)
    catch {set ::my(var) x} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my



} -result {can't set "::my(var)": linked variable is read-only}

test link-22.1 {linkarray binary} -setup {
    set mylist [list]
} -body {
    testlinkarray create binary 1 ::my(var)
    set ::my(var) x
    catch {set ::my(var) xy} msg
    lappend mylist $msg
    lappend mylist $::my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong size of binary value} x}
test link-22.2 {linkarray binary} -setup {
    set mylist [list]
} -body {
    testlinkarray create binary 4 ::my(var)
    catch {set ::my(var) abc} msg
    lappend mylist $msg
    catch {set ::my(var) abcde} msg
    lappend mylist $msg
    set ::my(var) abcd
    lappend mylist $::my(var)
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my
} -result {{can't set "::my(var)": wrong size of binary value} {can't set "::my(var)": wrong size of binary value} abcd}
test link-22.3 {linkarray binary} -body {
    testlinkarray create -r binary 4 ::my(var)
    catch {set ::my(var) xyzv} msg



    return $msg
} -cleanup {
    testlinkarray remove ::my(var)
    unset -nocomplain my





} -result {can't set "::my(var)": linked variable is read-only}
 
catch {testlink set 0 0 0 - 0 0 0 0 0 0 0 0 0 0}
catch {testlink delete}
foreach i {int real bool string wide} {
    unset -nocomplain $i
}