1 source [file dirname [info script]]/testing.tcl
3 test expr-1.1 "Compare strings lt" {
4 expr {"V000500" < "V000405"}
7 test expr-1.2 "Compare strings with embedded nulls" {
8 set s1 [format abc%cdef 0]
9 set s2 [format abc%cghi 0]
13 test expr-1.3 "Hex values" {
14 set mask1 [expr 0x4050 & 0x0CCC]
17 test expr-1.4 "Ternary operator - true" {
21 test expr-1.5 "Ternary operator - false" {
25 test expr-1.6 "Ternary operator - double check" {
29 test expr-1.7 "Ternary operator - string result" {
33 test expr-1.8 "Ternary operator - don't eval false path" {
36 set c [expr {20 ? [incr a] : [incr b]}]
40 test expr-1.9 "Unary minus" {
45 test expr-1.10 "Subtraction" {
51 test expr-1.11 "Short circuit evaluation" {
53 set c [expr {0 || [incr a]}]
57 test expr-1.12 "Short circuit evaluation" {
59 set c [expr {1 || [incr a]}]
63 test expr-1.13 "Short circuit evaluation" {
65 set c [expr {1 || [incr a] && [incr a]}]
69 test expr-1.14 "Rotate left" jim {
73 test expr-1.15 "Rotate left" jim {
77 test expr-1.16 "Rotate right" jim {
81 test expr-1.17 "Rotate left" jim {
85 # This crashes older jim
86 test expr-2.1 "bogus unarymin" -body {
88 } -returnCodes error -match glob -result *
90 test expr-2.2 "Ternary operator - missing colon" -body {
92 } -returnCodes error -match glob -result {missing operator*}
94 test expr-2.3 "Ternary operator - missing third term" -body {
96 } -returnCodes error -match glob -result *
98 test expr-2.4 "Ternary operator - missing question" -body {
100 } -returnCodes error -match glob -result *
102 test expr-2.5 "Ternary operator with -ve values" {
106 test expr-2.6 "Ternary operator with -ve values" {
110 test expr-3.1 "in, ni operators" {
113 list [expr {"a" in $l}] [expr {$c in $l}] [expr {"b" ni $l}] [expr {$c ni $l}]
116 test expr-3.2 "if: in, ni operators" {
138 # Don't want a to become 2.0
139 test expr-4.1 "Shimmering" {