1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 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 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 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339
|
# Test switches
#
# -before, -after, -node for "insert" operation
#
package require BLT
if {[info procs test] != "test"} {
source defs
}
if [file exists ../library] {
set blt_library ../library
}
#set VERBOSE 1
test vector.1 {vector no args} {
list [catch {blt::vector} msg] $msg
} {1 {wrong # args: should be one of...
blt::vector create ?vecName? ?switches...?
blt::vector destroy ?vecName...?
blt::vector expr expression
blt::vector names ?pattern...?}}
test vector.2 {vector create} {
list [catch {blt::vector create \#auto} msg] $msg
} {0 ::vector1}
test vector.3 {vector create myVec} {
list [catch {blt::vector create myVec} msg] $msg
} {0 ::myVec}
test vector.4 {vector create myVec.\#auto} {
list [catch {blt::vector create myVec.\#auto} msg] $msg
} {0 ::myVec.vector2}
test vector.5 {vector create \#auto.myVec} {
list [catch {blt::vector create \#auto.myVec} msg] $msg
} {0 ::vector3.myVec}
test vector.6 {vector create myVec.\#auto.myVec} {
list [catch {blt::vector create myVec.\#auto.myVec} msg] $msg
} {0 ::myVec.vector4.myVec}
test vector.7 {vector destroy vector1} {
list [catch {eval blt::vector destroy vector1} msg] $msg
} {0 {}}
test vector.8 {vector destroy [vector names]} {
list [catch {eval blt::vector destroy [blt::vector names]} msg] $msg
} {0 {}}
test vector.9 {create myVec} {
list [catch {blt::vector create myVec} msg] $msg
} {0 ::myVec}
test vector.10 {vector names} {
list [catch {blt::vector names} msg] [lsort $msg]
} {0 ::myVec}
test vector.11 {create myVec} {
list [catch {blt::vector create myVec} msg] $msg
} {1 {a vector "::myVec" already exists}}
test vector.12 {create if} {
list [catch {blt::vector create if} msg] $msg
} {1 {a command "::if" already exists}}
test vector.13 {vector create (bad namespace)} {
list [catch {blt::vector create badNamespace::myVec} msg] $msg
} {1 {unknown namespace "badNamespace"}}
test vector.14 {vector create (bad switch)} {
list [catch {blt::vector create a badSwitch} msg] $msg
} {1 {unknown switch "badSwitch"
The following switches are available:
-variable varName
-command command
-watchunset bool
-flush bool
-length length
-first index
-last index}}
test vector.15 {vector names} {
list [catch {blt::vector names} msg] [lsort $msg]
} {0 ::myVec}
test vector.16 {vector create myVec2} {
list [catch {blt::vector create myVec2} msg] [lsort $msg]
} {0 ::myVec2}
test vector.17 {vector names pattern)} {
list [catch {blt::vector names ::myVec*} msg] [lsort $msg]
} {0 {::myVec ::myVec2}}
test vector.18 {vector names badPattern)} {
list [catch {blt::vector names badPattern*} msg] $msg
} {0 {}}
test vector.19 {vector names pattern arg (wrong # args)} {
list [catch {blt::vector names pattern arg} msg] $msg
} {1 {wrong # args: should be "blt::vector names ?pattern...?"}}
test vector.20 {vector destroy (wrong # args)} {
list [catch {blt::vector destroy} msg] $msg
} {0 {}}
test vector.21 {vector destroy badVector} {
list [catch {blt::vector destroy badVector} msg] $msg
} {1 {can't find a vector named "badVector"}}
test vector.22 {vector destroy myVec2} {
list [catch {blt::vector destroy myVec2} msg] $msg
} {0 {}}
test vector.23 {vector destroy myVec2 myVec} {
list [catch {blt::vector destroy myVec2 myVec} msg] $msg
} {1 {can't find a vector named "myVec2"}}
test vector.24 {vector names)} {
list [catch {blt::vector names} msg] [lsort $msg]
} {0 ::myVec}
test vector.25 {vector destroy myVec} {
list [catch {blt::vector destroy myVec} msg] $msg
} {0 {}}
test vector.26 {create} {
list [catch {blt::vector create myVec} msg] $msg
} {0 ::myVec}
test vector.27 {myVec} {
list [catch {myVec} msg] $msg
} {1 {wrong # args: should be one of...
myVec * item
myVec + item
myVec - item
myVec / item
myVec append item ?item...?
myVec binread channel ?numValues? ?flags?
myVec clear
myVec count what
myVec delete index ?index...?
myVec duplicate ?vecName?
myVec export format ?switches?
myVec expr expression
myVec fft vecName ?switches?
myVec frequency vecName numBins
myVec indices what
myVec inversefft vecName vecName
myVec length ?newSize?
myVec limits
myVec linspace first last ?numSteps?
myVec maximum
myVec merge vecName ?vecName...?
myVec minimum
myVec normalize ?vecName?
myVec notify keyword
myVec offset ?offset?
myVec pack
myVec populate vecName density
myVec print format ?switches?
myVec random ?seed?
myVec range first last
myVec search ?-value? value ?value?
myVec sequence start stop ?step?
myVec set item
myVec simplify x y ?tol?
myVec sort ?switches? ?vecName...?
myVec split ?vecName...?
myVec value oper
myVec values ?switches?
myVec variable ?varName?}}
test vector.28 {myVec badOp} {
list [catch {myVec badOp} msg] $msg
} {1 {bad operation "badOp": should be one of...
myVec * item
myVec + item
myVec - item
myVec / item
myVec append item ?item...?
myVec binread channel ?numValues? ?flags?
myVec clear
myVec count what
myVec delete index ?index...?
myVec duplicate ?vecName?
myVec export format ?switches?
myVec expr expression
myVec fft vecName ?switches?
myVec frequency vecName numBins
myVec indices what
myVec inversefft vecName vecName
myVec length ?newSize?
myVec limits
myVec linspace first last ?numSteps?
myVec maximum
myVec merge vecName ?vecName...?
myVec minimum
myVec normalize ?vecName?
myVec notify keyword
myVec offset ?offset?
myVec pack
myVec populate vecName density
myVec print format ?switches?
myVec random ?seed?
myVec range first last
myVec search ?-value? value ?value?
myVec sequence start stop ?step?
myVec set item
myVec simplify x y ?tol?
myVec sort ?switches? ?vecName...?
myVec split ?vecName...?
myVec value oper
myVec values ?switches?
myVec variable ?varName?}}
test vector.29 {myVec length} {
list [catch {myVec length} msg] $msg
} {0 0}
test vector.30 {myVec l} {
list [catch {myVec l} msg] $msg
} {1 {ambiguous operation "l" matches: length limits linspace}}
test vector.31 {myVec le} {
list [catch {myVec le} msg] $msg
} {0 0}
test vector.32 {myVec len} {
list [catch {myVec len} msg] $msg
} {0 0}
test vector.33 {myVec leng} {
list [catch {myVec leng} msg] $msg
} {0 0}
test vector.34 {myVec lengt} {
list [catch {myVec lengt} msg] $msg
} {0 0}
test vector.35 {myVec length 10} {
list [catch {myVec length 10} msg] $msg
} {0 10}
test vector.36 {myVec length 10} {
list [catch {myVec length 10} msg] $msg
} {0 10}
test vector.37 {myVec length -20} {
list [catch {myVec length -20} msg] $msg
} {1 {invalid length "-20": can't be negative}}
test vector.38 {myVec length 0} {
list [catch {myVec length 0} msg] $msg
} {0 0}
test vector.39 {myVec length 0 badArg} {
list [catch {myVec length 0 badArg} msg] $msg
} {1 {wrong # args: should be "myVec length ?newSize?"}}
test vector.40 {myVec length 10} {
list [catch {myVec length 10} msg] $msg
} {0 10}
test vector.41 {myVec values} {
list [catch {myVec values} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.42 {myVec maximum} {
list [catch {myVec maximum} msg] $msg
} {0 NaN}
test vector.43 {myVec minimum} {
list [catch {myVec minimum} msg] $msg
} {0 NaN}
test vector.44 {myVec set "1 2 3 ..." } {
list [catch {myVec set { 1 2 3 4 5 6 7 8 9 10 }} msg] $msg
} {0 {}}
test vector.45 {myVec values} {
list [catch {myVec values} msg] $msg
} {0 {1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0}}
test vector.46 {myVec values -format "%E"} {
list [catch {myVec values -format "%E"} msg] $msg
} {0 {1.000000E+00 2.000000E+00 3.000000E+00 4.000000E+00 5.000000E+00 6.000000E+00 7.000000E+00 8.000000E+00 9.000000E+00 1.000000E+01}}
test vector.47 {blt::vector create test.\#auto} {
list [catch {blt::vector create test.\#auto} msg] $msg
} {0 ::test.vector5}
test vector.48 {test.vector5 length} {
list [catch {test.vector5 length} msg] $msg
} {0 0}
test vector.49 {test.vector5 values} {
list [catch {test.vector5 values} msg] $msg
} {0 {}}
test vector.50 {test.vector5 values -empty no} {
list [catch {test.vector5 values -empty no} msg] $msg
} {0 {}}
test vector.51 {test.vector5 values -empty yes} {
list [catch {test.vector5 values -empty yes} msg] $msg
} {0 {}}
test vector.52 {test.vector5 values -badSwitch} {
list [catch {test.vector5 values -badSwitch} msg] $msg
} {1 {unknown switch "-badSwitch"
The following switches are available:
-format string
-from index
-to index
-empty bool}}
test vector.53 {test.vector5 values -from 0 -to 20} {
list [catch {test.vector5 values -from 0 -to 20} msg] $msg
} {1 {index "0" is out of range}}
test vector.54 {test.vector5 values -from 1 -to 20} {
list [catch {test.vector5 values -from 1 -to 20} msg] $msg
} {1 {index "1" is out of range}}
test vector.55 {blt::vector create test.\#auto -length 20} {
list [catch {blt::vector create test.\#auto -length 20 } msg] $msg
} {0 ::test.vector6}
test vector.56 {test.vector6 length} {
list [catch {test.vector6 length} msg] $msg
} {0 20}
test vector.57 {test.vector6 count empty} {
list [catch {test.vector6 count empty} msg] $msg
} {0 20}
test vector.58 {test.vector6 values} {
list [catch {test.vector6 values} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.59 {info exists test.vector5} {
list [catch {info exists test.vector5} msg] $msg
} {0 1}
test vector.60 {info exists test.vector6} {
list [catch {info exists test.vector6} msg] $msg
} {0 1}
test vector.61 {blt::vector create test.\#auto -variable myVar} {
list [catch {blt::vector create test.\#auto -variable myVar} msg] $msg
} {0 ::test.vector7}
test vector.62 {info exists myVar} {
list [catch {info exists myVar} msg] $msg
} {0 1}
test vector.63 {info commands ::test.*} {
list [catch {info command ::test.*} msg] [lsort $msg]
} {0 {::test.vector5 ::test.vector6 ::test.vector7}}
test vector.64 {blt::vector names ::test.*} {
list [catch {blt::vector names ::test.*} msg] [lsort $msg]
} {0 {::test.vector5 ::test.vector6 ::test.vector7}}
test vector.65 {blt::vector destroy names ::test.*} {
list [catch {
eval blt::vector destroy [blt::vector names ::test.*]
} msg] $msg
} {0 {}}
test vector.66 {info exists test.vector5} {
list [catch {info exists test.vector5} msg] $msg
} {0 0}
test vector.67 {info exists test.vector6} {
list [catch {info exists test.vector6} msg] $msg
} {0 0}
test vector.68 {info exists myVar} {
list [catch {info exists myVar} msg] $msg
} {0 0}
test vector.69 {info commands ::test.*} {
list [catch {info command ::test.*} msg] [lsort $msg]
} {0 {}}
test vector.70 {blt::vector create myVec1 -length 20} {
list [catch {blt::vector create myVec1 -length 20 } msg] $msg
} {0 ::myVec1}
test vector.71 {blt::vector create myVec2} {
list [catch {blt::vector create myVec2} msg] $msg
} {0 ::myVec2}
test vector.72 {myVec2 set { 1 2 3 ... }} {
list [catch {myVec2 set { 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20}} msg] $msg
} {0 {}}
test vector.73 {blt::vector expr myVec1+myVec2} {
list [catch {blt::vector expr myVec1+myVec2} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.74 {blt::vector expr myVec1-myVec2} {
list [catch {blt::vector expr myVec1-myVec2} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.75 {blt::vector expr myVec1/myVec2} {
list [catch {blt::vector expr myVec1/myVec2} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.76 {blt::vector expr myVec1*myVec2} {
list [catch {blt::vector expr myVec1*myVec2} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.77 {set myVec1(2) 3.0} {
list [catch {set myVec1(2) 3.0} msg] $msg
} {0 3.0}
test vector.78 {myVec1 value set 3 4.0} {
list [catch {myVec1 value set 3 4.0} msg] $msg
} {0 4.0}
test vector.79 {myVec1 values} {
list [catch {myVec1 values} msg] $msg
} {0 {NaN NaN 3.0 4.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.80 {myVec1 maximum} {
list [catch {myVec1 maximum} msg] $msg
} {0 4.0}
test vector.81 {myVec1 minimum} {
list [catch {myVec1 minimum} msg] $msg
} {0 3.0}
test vector.82 {blt::vector expr myVec1+myVec2} {
list [catch {blt::vector expr myVec1+myVec2} msg] $msg
} {0 {NaN NaN 6.0 8.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.83 {blt::vector expr myVec1-myVec2} {
list [catch {blt::vector expr myVec1-myVec2} msg] $msg
} {0 {NaN NaN 0.0 0.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.84 {blt::vector expr myVec1/myVec2} {
list [catch {blt::vector expr myVec1/myVec2} msg] $msg
} {0 {NaN NaN 1.0 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.85 {blt::vector expr myVec1*myVec2} {
list [catch {blt::vector expr myVec1*myVec2} msg] $msg
} {0 {NaN NaN 9.0 16.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.86 {myVec1 count empty} {
list [catch {myVec1 count empty} msg] $msg
} {0 18}
test vector.87 {myVec1 count zero} {
list [catch {myVec1 count zero} msg] $msg
} {0 0}
test vector.88 {myVec1 count nonzero} {
list [catch {myVec1 count nonzero} msg] $msg
} {0 2}
test vector.89 {myVec1 count nonempty} {
list [catch {myVec1 count nonempty} msg] $msg
} {0 2}
test vector.90 {myVec1 value set 10 0.0} {
list [catch {myVec1 value set 10 0.0} msg] $msg
} {0 0.0}
test vector.91 {myVec1 count nonzero} {
list [catch {myVec1 count nonzero} msg] $msg
} {0 2}
test vector.92 {myVec1 count zero} {
list [catch {myVec1 count zero} msg] $msg
} {0 1}
test vector.93 {myVec1 value set 10 1.0} {
list [catch {myVec1 value set 10 1.0} msg] $msg
} {0 1.0}
test vector.94 {blt::vector expr myVec1+1.0} {
list [catch {blt::vector expr myVec1+1.0} msg] $msg
} {0 {NaN NaN 4.0 5.0 NaN NaN NaN NaN NaN NaN 2.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.95 {blt::vector expr myVec1-1.0} {
list [catch {blt::vector expr myVec1-1.0} msg] $msg
} {0 {NaN NaN 2.0 3.0 NaN NaN NaN NaN NaN NaN 0.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.96 {blt::vector expr myVec1/2.0} {
list [catch {blt::vector expr myVec1/2.0} msg] $msg
} {0 {NaN NaN 1.5 2.0 NaN NaN NaN NaN NaN NaN 0.5 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.97 {blt::vector expr myVec1*2.0} {
list [catch {blt::vector expr myVec1*2.0} msg] $msg
} {0 {NaN NaN 6.0 8.0 NaN NaN NaN NaN NaN NaN 2.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.98 {blt::vector expr 1.0+myVec} {
list [catch {blt::vector expr 1.0+myVec1} msg] $msg
} {0 {NaN NaN 4.0 5.0 NaN NaN NaN NaN NaN NaN 2.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.99 {blt::vector expr 1.0-myVec1} {
list [catch {blt::vector expr 1.0-myVec1} msg] $msg
} {0 {NaN NaN -2.0 -3.0 NaN NaN NaN NaN NaN NaN 0.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.100 {blt::vector expr 2.0/myVec1} {
list [catch {blt::vector expr 2.0/myVec1} msg] $msg
} {0 {NaN NaN 0.6666666666666666 0.5 NaN NaN NaN NaN NaN NaN 2.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.101 {blt::vector expr 2.0*myVec1} {
list [catch {blt::vector expr 2.0*myVec1} msg] $msg
} {0 {NaN NaN 6.0 8.0 NaN NaN NaN NaN NaN NaN 2.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.102 {blt::vector expr 1.0+myVec1*myVec2} {
list [catch {blt::vector expr 1.0+myVec1*myVec2} msg] $msg
} {0 {NaN NaN 10.0 17.0 NaN NaN NaN NaN NaN NaN 12.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.103 {blt::vector expr sin(myVec1)} {
list [catch {blt::vector expr sin(myVec1)} msg] $msg
} {0 {NaN NaN 0.1411200080598672 -0.7568024953079282 NaN NaN NaN NaN NaN NaN 0.8414709848078965 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.104 {blt::vector expr -myVec1} {
list [catch {blt::vector expr -myVec1} msg] $msg
} {0 {NaN NaN -3.0 -4.0 NaN NaN NaN NaN NaN NaN -1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.105 {blt::vector expr +myVec1} {
list [catch {blt::vector expr +myVec1} msg] $msg
} {1 {missing operand for 11}}
test vector.106 {blt::vector expr myVec1} {
list [catch {blt::vector expr myVec1} msg] $msg
} {0 {NaN NaN 3.0 4.0 NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.107 {blt::vector expr pow(myVec1,3.0)} {
list [catch {blt::vector expr -myVec1} msg] $msg
} {0 {NaN NaN -3.0 -4.0 NaN NaN NaN NaN NaN NaN -1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.108 {blt::vector expr sqrt(myVec1)} {
list [catch {blt::vector expr sqrt(myVec1)} msg] $msg
} {0 {NaN NaN 1.7320508075688772 2.0 NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.109 {blt::vector expr atan(myVec1)} {
list [catch {blt::vector expr -myVec1} msg] $msg
} {0 {NaN NaN -3.0 -4.0 NaN NaN NaN NaN NaN NaN -1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.110 {blt::vector expr myVec1==myVec1} {
list [catch {blt::vector expr myVec1==myVec1} msg] $msg
} {0 {NaN NaN 1.0 1.0 NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.111 {blt::vector expr myVec1!=myVec1} {
list [catch {blt::vector expr myVec1!=myVec1} msg] $msg
} {0 {NaN NaN 0.0 0.0 NaN NaN NaN NaN NaN NaN 0.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.112 {blt::vector expr myVec1^3} {
list [catch {blt::vector expr myVec1^3} msg] $msg
} {0 {NaN NaN 27.0 64.0 NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.113 {blt::vector expr sum(myVec1)} {
list [catch {blt::vector expr sum(myVec1)} msg] $msg
} {0 8.0}
test vector.114 {blt::vector expr skew(myVec1)} {
list [catch {blt::vector expr skew(myVec1)} msg] $msg
} {0 -0.20782656212951636}
test vector.115 {blt::vector expr var(myVec1)} {
list [catch {blt::vector expr var(myVec1)} msg] $msg
} {0 2.333333333333333}
test vector.116 {blt::vector expr sdev(myVec1)} {
list [catch {blt::vector expr sdev(myVec1)} msg] $msg
} {0 1.5275252316519465}
test vector.117 {blt::vector expr adev(myVec1)} {
list [catch {blt::vector expr adev(myVec1)} msg] $msg
} {0 1.1111111111111112}
test vector.118 {blt::vector expr prod(myVec1)} {
list [catch {blt::vector expr prod(myVec1)} msg] $msg
} {0 12.0}
test vector.119 {blt::vector expr mean(myVec1)} {
list [catch {blt::vector expr mean(myVec1)} msg] $msg
} {0 2.6666666666666665}
test vector.120 {blt::vector expr skew(myVec1)} {
list [catch {blt::vector expr skew(myVec1)} msg] $msg
} {0 -0.20782656212951636}
test vector.121 {blt::vector expr tanh(myVec1)} {
list [catch {blt::vector expr tanh(myVec1)} msg] $msg
} {0 {NaN NaN 0.9950547536867305 0.999329299739067 NaN NaN NaN NaN NaN NaN 0.7615941559557649 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.122 {blt::vector expr sort(myVec1)} {
list [catch {blt::vector expr sort(myVec1)} msg] $msg
} {0 {1.0 3.0 4.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.123 {blt::vector expr median(myVec1)} {
list [catch {blt::vector expr median(myVec1)} msg] $msg
} {0 3.0}
test vector.124 {blt::vector expr sort(myVec1)} {
list [catch {blt::vector expr sort(myVec1)} msg] $msg
} {0 {1.0 3.0 4.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.125 {blt::vector expr median(myVec1)} {
list [catch {blt::vector expr median(myVec1)} msg] $msg
} {0 3.0}
test vector.126 {blt::vector expr exp(myVec1)} {
list [catch {blt::vector expr exp(myVec1)} msg] $msg
} {0 {NaN NaN 20.085536923187668 54.598150033144236 NaN NaN NaN NaN NaN NaN 2.718281828459045 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.127 {blt::vector expr log10(myVec1)} {
list [catch {blt::vector expr log10(myVec1)} msg] $msg
} {0 {NaN NaN 0.47712125471966244 0.6020599913279624 NaN NaN NaN NaN NaN NaN 0.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.128 {blt::vector expr log(myVec1)} {
list [catch {blt::vector expr log(myVec1)} msg] $msg
} {0 {NaN NaN 1.0986122886681098 1.3862943611198906 NaN NaN NaN NaN NaN NaN 0.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.129 {blt::vector expr badFunc(myVec1)} {
list [catch {blt::vector expr badFunc(myVec1)} msg] $msg
} {1 {can't find a vector named "badFunc"}}
test vector.130 {blt::vector expr myVec2)} {
list [catch {blt::vector expr myVec2} msg] $msg
} {0 {1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0}}
test vector.131 {blt::vector create myVec7} {
list [catch {blt::vector create myVec7} msg] $msg
} {0 ::myVec7}
test vector.132 {blt::vector expr {myVec2 > 3.0 && myVec2 < 13.0}} {
list [catch { blt::vector expr {myVec2 > 3.0 && myVec2 < 13.0} } msg] $msg
} {0 {0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0}}
test vector.133 {myVec7 expr {myVec2 > 3.0}} {
list [catch {myVec7 expr {myVec2 > 3.0}} msg] $msg
} {0 {}}
test vector.134 {myVec7 values} {
list [catch {myVec7 values} msg] $msg
} {0 {0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0}}
test vector.135 {myVec7 indices zero} {
list [catch {myVec7 indices zero} msg] $msg
} {0 {0 1 2}}
test vector.136 {myVec7 indices nonzero} {
list [catch {myVec7 indices nonzero} msg] $msg
} {0 {3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19}}
test vector.137 {myVec7 indices nonempty} {
list [catch {myVec7 indices nonempty} msg] $msg
} {0 {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19}}
test vector.138 {myVec7 indices empty} {
list [catch {myVec7 indices empty} msg] $msg
} {0 {}}
test vector.139 {blt::vector expr median(myVec1)} {
list [catch {blt::vector expr median(myVec1)} msg] $msg
} {0 3.0}
test vector.140 {blt::vector expr q1(myVec1)} {
list [catch {blt::vector expr q1(myVec1)} msg] $msg
} {0 1.0}
test vector.141 {blt::vector expr q2(myVec1)} {
list [catch {blt::vector expr q2(myVec1)} msg] $msg
} {0 3.0}
test vector.142 {blt::vector expr q3(myVec1)} {
list [catch {blt::vector expr q3(myVec1)} msg] $msg
} {0 4.0}
test vector.143 {blt::vector expr myVec1+0.111} {
list [catch {blt::vector expr myVec1+0.111} msg] $msg
} {0 {NaN NaN 3.111 4.111 NaN NaN NaN NaN NaN NaN 1.111 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.144 {blt::vector expr ceil(myVec1+0.111)} {
list [catch {blt::vector expr ceil(myVec1+0.111)} msg] $msg
} {0 {NaN NaN 4.0 5.0 NaN NaN NaN NaN NaN NaN 2.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.145 {blt::vector expr floor(myVec1+0.111)} {
list [catch {blt::vector expr floor(myVec1+0.111)} msg] $msg
} {0 {NaN NaN 3.0 4.0 NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.146 {blt::vector expr floor(myVec1)} {
list [catch {blt::vector expr floor(myVec1)} msg] $msg
} {0 {NaN NaN 3.0 4.0 NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.147 {blt::vector expr ceil(myVec1)} {
list [catch {blt::vector expr ceil(myVec1)} msg] $msg
} {0 {NaN NaN 3.0 4.0 NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.148 {blt::vector create myVec3 -length 10} {
list [catch {blt::vector create myVec3 -length 10} msg] $msg
} {0 ::myVec3}
# Is there a graceful way of handling the range when the vector is empty?
# Should it return an empty string rather than an error?
test vector.149 {myVec3 range 1 2} {
list [catch {myVec3 range 1 2} msg] $msg
} {0 {NaN NaN}}
test vector.150 {myVec3 range 1 2 3} {
list [catch {myVec3 range 1 2 3} msg] $msg
} {1 {wrong # args: should be "myVec3 range first last"}}
test vector.151 {myVec3 range 1 } {
list [catch {myVec3 range 1 } msg] $msg
} {1 {wrong # args: should be "myVec3 range ?first last?"}}
test vector.152 {myVec3 range} {
list [catch {myVec3 range} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.153 {myVec3 variable} {
list [catch {myVec3 variable} msg] $msg
} {0 ::myVec3}
test vector.154 {myVec3 variable myVar badArg} {
list [catch {myVec3 variable myVar badArg} msg] $msg
} {1 {wrong # args: should be "myVec3 variable ?varName?"}}
# linspace uses the length of the vector if no step is given.
test vector.155 {myVec3 linspace 0 20} {
list [catch {myVec3 linspace 0 20} msg] $msg
} {0 {}}
# sequence will resize the vector. The default number of steps is 1.
test vector.156 {myVec3 sequence 0 20 20/9} {
list [catch {myVec3 sequence 0 20 [expr 20.0/9]} msg] $msg
} {0 {}}
test vector.157 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {0.0 2.2222222222222223 4.444444444444445 6.666666666666667 8.88888888888889 11.11111111111111 13.333333333333334 15.555555555555557 17.77777777777778 20.0}}
test vector.158 {myVec3 random 10} {
list [catch {myVec3 random 10} msg] $msg
} {0 {}}
test vector.159 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {0.8788511227621747 0.7958066229216172 0.4808272810570422 0.5256732582083217 0.45916247450539416 0.9454757943603767 0.6461477888718399 0.5854443700928513 0.6398346405389113 0.9568804954767529}}
test vector.160 {myVec3 value set all 4.0} {
list [catch {myVec3 value set all 4.0} msg] $msg
} {0 4.0}
test vector.161 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {4.0 4.0 4.0 4.0 4.0 4.0 4.0 4.0 4.0 4.0}}
test vector.162 {myVec3 value set all 0.0} {
list [catch {myVec3 value set all 0.0} msg] $msg
} {0 0.0}
test vector.163 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0}}
test vector.164 {myVec3 value set 1:end 1.0} {
list [catch {myVec3 value set 1:end 1.0} msg] $msg
} {0 1.0}
test vector.165 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0}}
test vector.166 {myVec3 value set 1:3 14.0} {
list [catch {
myVec3 value set 1:3 14.0
myVec3 values
} msg] $msg
} {0 {0.0 14.0 14.0 14.0 1.0 1.0 1.0 1.0 1.0 1.0}}
test vector.167 {myVec3 value set 0:end 7.0} {
list [catch {myVec3 value set 0:end 7.0} msg] $msg
} {0 7.0}
test vector.168 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {7.0 7.0 7.0 7.0 7.0 7.0 7.0 7.0 7.0 7.0}}
test vector.169 {myVec3 value set 0:end++ 2.0} {
list [catch {myVec3 value set 0:end++ 2.0} msg] $msg
} {1 {bad index "end++"}}
test vector.170 {myVec3 length} {
list [catch {myVec3 length} msg] $msg
} {0 10}
test vector.171 {myVec3 value set ++end 2.0} {
list [catch {myVec3 value set ++end 2.0} msg] $msg
} {0 2.0}
test vector.172 {myVec3 value set 0:end 2.0} {
list [catch {myVec3 value set 0:end 2.0} msg] $msg
} {0 2.0}
test vector.173 {myVec3 length} {
list [catch {myVec3 length} msg] $msg
} {0 11}
test vector.174 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0}}
test vector.175 {myVec3 delete end} {
list [catch {
myVec3 delete end
} msg] $msg
} {0 {}}
test vector.176 {myVec3 value set ++end 0.0} {
list [catch {
myVec3 value set ++end 100.0
} msg] $msg
} {0 100.0}
test vector.177 {myVec3 length} {
list [catch {myVec3 length} msg] $msg
} {0 11}
test vector.178 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 100.0}}
test vector.179 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 100.0}}
test vector.180 {myVec3 value set end 0.0} {
list [catch {myVec3 value set end 0.0} msg] $msg
} {0 0.0}
test vector.181 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 0.0}}
test vector.182 {myVec3 value set 0 0.0} {
list [catch {myVec3 value set 0 0.0} msg] $msg
} {0 0.0}
test vector.183 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {0.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 0.0}}
test vector.184 {myVec3 delete end} {
list [catch {myVec3 delete end} msg] $msg
} {0 {}}
test vector.185 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {0.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0}}
test vector.186 {myVec3 linspace 0 0} {
list [catch {myVec3 linspace 0 0} msg] $msg
} {0 {}}
test vector.187 {myVec3 values} {
list [catch {myVec3 values} msg] $msg
} {0 {0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0}}
test vector.188 {myVec1 values} {
list [catch {myVec1 values} msg] $msg
} {0 {NaN NaN 3.0 4.0 NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.189 {myVec1 sort -help} {
list [catch {myVec1 sort -help} msg] $msg
} {1 {The following switches are available:
-decreasing
-indices
-reverse
-unique
-values }}
test vector.190 {myVec1 sort -indices} {
list [catch {myVec1 sort -indices} msg] $msg
} {0 {10 2 3 0 1 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19}}
test vector.191 {myVec1 sort -values} {
list [catch {
myVec1 sort -values
} msg] $msg
} {0 {1.0 3.0 4.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.192 {myVec1 sort -decreasing -values} {
list [catch {myVec1 sort -decreasing -values} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 4.0 3.0 1.0}}
test vector.193 {myVec1 sort -uniq -values} {
list [catch {myVec1 sort -uniq -values} msg] $msg
} {0 {1.0 3.0 4.0 NaN}}
test vector.194 {myVec1 sort myVec1} {
list [catch {myVec1 sort myVec1} msg] $msg
} {0 {}}
test vector.195 {myVec1 pack} {
list [catch {myVec1 pack} msg] $msg
} {0 17}
test vector.196 {myVec1 sort} {
list [catch {myVec1 sort} msg] $msg
} {0 {}}
test vector.197 {myVec1 values} {
list [catch {myVec1 values} msg] $msg
} {0 {1.0 3.0 4.0}}
test vector.198 {myVec1 length} {
list [catch {myVec1 length} msg] $msg
} {0 3}
test vector.199 {myVec1 count empty} {
list [catch {myVec1 count empty} msg] $msg
} {0 0}
test vector.200 {myVec1 count zero} {
list [catch {myVec1 count zero} msg] $msg
} {0 0}
test vector.201 {myVec3 duplicate} {
list [catch {myVec3 duplicate} msg] $msg
} {0 ::vector8}
test vector.202 {myVec3 duplicate myVec4} {
list [catch {myVec3 duplicate myVec4} msg] $msg
} {0 ::myVec4}
test vector.203 {blt::vector expr myVec4==myVec3} {
list [catch {blt::vector expr myVec4==myVec3} msg] $msg
} {0 {1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0}}
test vector.204 {blt::vector create myVec5 -length 20} {
list [catch {blt::vector create myVec5 -length 20} msg] $msg
} {0 ::myVec5}
test vector.205 {myVec5 length} {
list [catch {myVec5 length} msg] $msg
} {0 20}
test vector.206 {myVec5 values} {
list [catch {myVec5 values} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.207 {blt::vector expr myVec5==myVec5} {
list [catch {blt::vector expr myVec5==myVec5} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.208 {blt::vector destroy myVec4 vector8} {
list [catch {blt::vector destroy myVec4 vector8} msg] $msg
} {0 {}}
test vector.209 {myVec set (missing arg)} {
list [catch {myVec set} msg] $msg
} {1 {wrong # args: should be "myVec set item"}}
test vector.210 {myVec3 value badOp} {
list [catch {myVec3 value badOp} msg] $msg
} {1 {bad operation "badOp": should be one of...
myVec3 value get index
myVec3 value set index value
myVec3 value unset ?index...?}}
test vector.211 {myVec3 value badOp extraArgs } {
list [catch {myVec3 value badOp extraArgs} msg] $msg
} {1 {bad operation "badOp": should be one of...
myVec3 value get index
myVec3 value set index value
myVec3 value unset ?index...?}}
test vector.212 {myVec3 linspace 1 10} {
list [catch {myVec3 linspace 1 10} msg] $msg
} {0 {}}
test vector.213 {myVec3 value get } {
list [catch {myVec3 value get} msg] $msg
} {1 {wrong # args: should be "myVec3 value get index"}}
test vector.214 {myVec3 value get badIndex} {
list [catch {myVec3 value get badIndex} msg] $msg
} {1 {bad index "badIndex"}}
test vector.215 {myVec3 value get -1} {
list [catch {myVec3 value get -1} msg] $msg
} {1 {index "-1" is out of range}}
test vector.216 {myVec3 value get ++end} {
list [catch {myVec3 value get ++end} msg] $msg
} {1 {can't get index "++end"}}
test vector.217 {myVec3 value get min} {
list [catch {myVec3 value get min} msg] $msg
} {0 1.0}
test vector.218 {myVec3 value get max} {
list [catch {myVec3 value get max} msg] $msg
} {0 10.0}
test vector.219 {myVec3 value get 0} {
list [catch {myVec3 value get 0} msg] $msg
} {0 1.0}
test vector.220 {myVec3 value get 1} {
list [catch {myVec3 value get 1} msg] $msg
} {0 2.0}
test vector.221 {myVec3 value get end} {
list [catch {myVec3 value get end} msg] $msg
} {0 10.0}
test vector.222 {myVec3 value get 0 extraArg} {
list [catch {myVec3 value get 0 extraArg} msg] $msg
} {1 {wrong # args: should be "myVec3 value get index"}}
test vector.223 {myVec3 value set ++end 1000.0} {
list [catch {myVec3 value set ++end 1000.0} msg] $msg
} {0 1000.0}
test vector.224 {myVec3 value unset end} {
list [catch {myVec3 value unset end} msg] $msg
} {0 {}}
test vector.225 {myVec3 value get end} {
list [catch {myVec3 value get end} msg] $msg
} {0 NaN}
test vector.226 {myVec3 value set all 1.0} {
list [catch {myVec3 value set all 1.0} msg] $msg
} {0 1.0}
test vector.227 {myVec3 value unset all} {
list [catch {myVec3 value unset all} msg] $msg
} {0 {}}
test vector.228 {myVec3 value get end} {
list [catch {myVec3 value get end} msg] $msg
} {0 NaN}
test vector.229 {myVec3 value set all 1.0} {
list [catch {myVec3 value set all 1.0} msg] $msg
} {0 1.0}
test vector.230 {myVec3 value unset 0:end} {
list [catch {myVec3 value unset 0:end} msg] $msg
} {0 {}}
test vector.231 {myVec3 value get end} {
list [catch {myVec3 value get end} msg] $msg
} {0 NaN}
test vector.232 {vector create myVec6} {
list [catch {blt::vector create myVec6} msg] $msg
} {0 ::myVec6}
test vector.233 {myVec6 populate} {
list [catch {myVec6 populate} msg] $msg
} {1 {wrong # args: should be "myVec6 populate vecName density"}}
test vector.234 {myVec6 populate myVec4} {
list [catch {myVec6 populate myVec4} msg] $msg
} {1 {wrong # args: should be "myVec6 populate vecName density"}}
test vector.235 {myVec6 populate myVec3 10} {
list [catch {myVec6 populate myVec3 10} msg] $msg
} {0 {}}
test vector.236 {myVec6 values} {
list [catch {myVec6 values} msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN}}
test vector.237 {myVec6 populate myVec2 2} {
list [catch {myVec6 populate myVec2 2} msg] $msg
} {0 {}}
test vector.238 {myVec6 values} {
list [catch {myVec6 values} msg] $msg
} {0 {1.0 1.3333333333333333 1.6666666666666665 2.0 2.3333333333333335 2.6666666666666665 3.0 3.3333333333333335 3.6666666666666665 4.0 4.333333333333333 4.666666666666667 5.0 5.333333333333333 5.666666666666667 6.0 6.333333333333333 6.666666666666667 7.0 7.333333333333333 7.666666666666667 8.0 8.333333333333334 8.666666666666666 9.0 9.333333333333334 9.666666666666666 10.0 10.333333333333334 10.666666666666666 11.0 11.333333333333334 11.666666666666666 12.0 12.333333333333334 12.666666666666666 13.0 13.333333333333334 13.666666666666666 14.0 14.333333333333334 14.666666666666666 15.0 15.333333333333334 15.666666666666666 16.0 16.333333333333332 16.666666666666668 17.0 17.333333333333332 17.666666666666668 18.0 18.333333333333332 18.666666666666668 19.0 19.333333333333332 19.666666666666668 20.0}}
test vector.239 {sum} {
list [catch {
myVec6 set { 1 2 3 4 }
blt::vector expr sum(myVec6)
} msg] $msg
} {0 10.0}
test vector.240 {blt::vector expr myVec6(0))} {
list [catch {blt::vector expr myVec6(0)} msg] $msg
} {0 1.0}
test vector.241 {blt::vector expr myVec6(1))} {
list [catch {blt::vector expr myVec6(1)} msg] $msg
} {0 2.0}
test vector.242 {blt::vector expr myVec6(3))} {
list [catch {blt::vector expr myVec6(3)} msg] $msg
} {0 4.0}
test vector.243 {blt::vector expr myVec6(2:3))} {
list [catch {blt::vector expr myVec6(2:3)} msg] $msg
} {0 {3.0 4.0}}
test vector.244 {blt::vector expr myVec6(end))} {
list [catch {blt::vector expr myVec6(end)} msg] $msg
} {0 4.0}
test vector.245 {blt::vector expr myVec6(4))} {
list [catch {blt::vector expr myVec6(4)} msg] $msg
} {1 {index "4" is out of range}}
test vector.245 {blt::vector create myVector} {
list [catch {blt::vector create myVector} msg] $msg
} {0 ::myVector}
test vector.245 {myVector merge myVec6 myVec3} {
list [catch {myVector merge myVec6 myVec3} msg] $msg
} {1 {vectors "::myVector" and "::myVec3" differ in length}}
test vector.245 {myVector merge myVec6 myVec3} {
list [catch {
myVec6 set "0 2 4 6 8"
myVec3 set "1 3 5 7 9"
myVector merge myVec6 myVec3
} msg] $msg
} {0 {}}
test vector.245 {myVector values} {
list [catch {myVector values} msg] $msg
} {0 {0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0}}
test vector.245 {myVector merge myVec6 myVec3} {
list [catch {
myVec6 set "0 2 4 6 8"
myVec3 set "1 3 5 7 9"
myVector merge myVec3 myVec6
} msg] $msg
} {0 {}}
test vector.245 {myVector values} {
list [catch {myVector values} msg] $msg
} {0 {1.0 0.0 3.0 2.0 5.0 4.0 7.0 6.0 9.0 8.0}}
test vector.245 {myVector split a b} {
list [catch {
blt::vector create a
blt::vector create b
myVector split a b} msg] $msg
} {0 {}}
test vector.245 {a values} {
list [catch {a values} msg] $msg
} {0 {1.0 3.0 5.0 7.0 9.0}}
test vector.245 {b values} {
list [catch {b values} msg] $msg
} {0 {0.0 2.0 4.0 6.0 8.0}}
test vector.245 {b * 3} {
list [catch {b * 3} msg] $msg
} {0 {0.0 6.0 12.0 18.0 24.0}}
test vector.245 {b - 1} {
list [catch {b - 1} msg] $msg
} {0 {-1.0 1.0 3.0 5.0 7.0}}
test vector.245 {b / 2} {
list [catch {b / 2} msg] $msg
} {0 {0.0 1.0 2.0 3.0 4.0}}
test vector.245 {b + 1} {
list [catch {b + 1} msg] $msg
} {0 {1.0 3.0 5.0 7.0 9.0}}
test vector.245 { preallocated vector } {
list [catch { blt::vector x_values(50) } msg] $msg
} {0 ::x_values}
test vector.246 { preallocated vector } {
list [catch {
set x_values(end) 52
} msg] $msg
} {0 52}
test vector.246 { preallocated vector } {
list [catch { x_values values } msg] $msg
} {0 {NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 52.0}}
test vector.246 { preallocated vector } {
list [catch { set x_values(end) } msg] $msg
} {0 52.0}
test vector.247 { preallocated vector } {
list [catch { blt::vector create z_values(50) } msg] $msg
} {0 ::z_values}
test vector.248 { preallocated vector } {
list [catch { blt::vector create y_values -length 50 } msg] $msg
} {0 ::y_values}
test vector.249 { preallocated vector by range } {
list [catch { blt::vector create z1_values(1:50) } msg] $msg
} {0 ::z1_values}
test vector.250 { preallocated vector by range error } {
list [catch { blt::vector create z2_values(50:1) } msg] $msg
} {1 {bad vector range "50:1"}}
test vector.251 { preallocated vector with first index } {
list [catch {
blt::vector create y1_values -first 10
y1_values append 0.0
set y1_values(10)
} msg] $msg
} {0 0.0}
test vector.252 { preallocated vector with first index and length } {
list [catch {
blt::vector create y2_values -first 10 -length 2
list [set y2_values(10)] [set y2_values(:)]
} msg] $msg
} {0 {NaN {NaN NaN}}}
test vector.253 { preallocated vector with first and last indices } {
list [catch {
blt::vector create y3_values -first 10 -last 12
list [set y3_values(10)] [set y3_values(12)] [set y3_values(:)]
} msg] $msg
} {0 {NaN NaN {NaN NaN NaN}}}
# last overrides length
test vector.254 { preallocated vector with first, last indices and length } {
list [catch {
blt::vector create y4_values -first 10 -last 12 -length 10
list [set y4_values(10)] [set y4_values(12)] [set y4_values(:)]
} msg] $msg
} {0 {NaN NaN {NaN NaN NaN}}}
# last overrides length
test vector.255 { preallocated vector with last index and length } {
list [catch {
blt::vector create y5_values -last 2 -length 10
list [set y5_values(0)] [set y5_values(2)] [set y5_values(:)]
} msg] $msg
} {0 {NaN NaN {NaN NaN NaN}}}
test vector.256 { preallocated vector with error in first index } {
list [catch { blt::vector create -first x } msg] $msg
} {1 {expected integer but got "x"}}
test vector.257 { preallocated vector with error in first index } {
list [catch { blt::vector create -last x } msg] $msg
} {1 {expected integer but got "x"}}
test vector.258 { preallocated vector with error in first index } {
list [catch { blt::vector create -length x } msg] $msg
} {1 {expected integer but got "x"}}
test vector.256 { preallocated vector with error in first index } {
list [catch { blt::vector create -first -1 } msg] $msg
} {1 {bad value "-1": can't be negative}}
test vector.257 { preallocated vector with error in first index } {
list [catch { blt::vector create -last -1 } msg] $msg
} {1 {bad value "-1": can't be negative}}
test vector.258 { preallocated vector with error in first index } {
list [catch { blt::vector create -length -1 } msg] $msg
} {1 {bad value "-1": can't be negative}}
test vector.259 { empty vector } {
list [catch {
blt::vector create y6_values
set y6_values(:)
} msg] $msg
} {0 {}}
exit 0
{"*", 1, ArithOp, 3, 3, "item",}, /*Deprecated*/
{"+", 1, ArithOp, 3, 3, "item",}, /*Deprecated*/
{"-", 1, ArithOp, 3, 3, "item",}, /*Deprecated*/
{"/", 1, ArithOp, 3, 3, "item",}, /*Deprecated*/
{"append", 1, AppendOp, 3, 0, "item ?item...?",},
{"binread", 2, BinreadOp, 3, 0, "channel ?numValues? ?flags?",},
{"clear", 2, ClearOp, 2, 2, "",},
{"count", 2, CountOp, 3, 3, "what",},
{"delete", 2, DeleteOp, 2, 0, "index ?index...?",},
{"duplicate", 2, DupOp, 2, 3, "?vecName?",},
{"export", 4, ExportOp, 3, 0, "format ?switches?",},
{"expr", 4, InstExprOp, 3, 3, "expression",},
{"fft", 2, FFTOp, 3, 0, "vecName ?switches?",},
{"frequency", 2, FrequencyOp, 4, 4, "vecName numBins",},
{"indices", 3, IndicesOp, 3, 3, "what",},
{"inversefft",3, InverseFFTOp,4, 4, "vecName vecName",},
{"length", 2, LengthOp, 2, 3, "?newSize?",},
{"limits", 3, LimitsOp, 2, 2, "",},
{"linspace", 3, LinspaceOp, 4, 5, "first last ?numSteps?",},
{"maximum", 2, MaxOp, 2, 2, "",},
{"merge", 2, MergeOp, 3, 0, "vecName ?vecName...?",},
{"minimum", 2, MinOp, 2, 2, "",},
{"normalize", 3, NormalizeOp, 2, 3, "?vecName?",}, /*Deprecated*/
{"notify", 3, NotifyOp, 3, 3, "keyword",},
{"offset", 1, OffsetOp, 2, 3, "?offset?",},
{"pack", 2, PackOp, 2, 2, "",},
{"populate", 2, PopulateOp, 4, 4, "vecName density",},
{"print", 2, PrintOp, 3, 0, "format ?switches?",},
{"random", 4, RandomOp, 2, 3, "?seed?",}, /*Deprecated*/
{"range", 4, RangeOp, 2, 4, "first last",},
{"search", 3, SearchOp, 3, 5, "?-value? value ?value?",},
{"sequence", 3, SequenceOp, 4, 5, "start stop ?step?",},
{"set", 3, SetOp, 3, 3, "item",},
{"simplify", 2, SimplifyOp, 4, 5, "x y ?tol?" },
{"sort", 2, SortOp, 2, 0, "?switches? ?vecName...?",},
{"split", 2, SplitOp, 2, 0, "?vecName...?",},
{"value", 5, ValueOp, 2, 0, "oper",},
{"values", 6, ValuesOp, 2, 0, "?switches?",},
{"variable", 3, MapOp, 2, 3, "?varName?",},
|