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" {
87 catch {expr {unarymin 1}}
91 test expr-2.2 "Ternary operator - missing colon" {
92 list [catch {expr {1 ? 2 3}} msg]
95 test expr-2.3 "Ternary operator - missing third term" {
96 list [catch {expr {1 ? 2}} msg]
99 test expr-2.4 "Ternary operator - missing question" {
100 list [catch {expr {1 : 2}} msg]
103 test expr-3.1 "in, ni operators" {
106 list [expr {"a" in $l}] [expr {$c in $l}] [expr {"b" ni $l}] [expr {$c ni $l}]
109 test expr-3.2 "if: in, ni operators" {
131 # Don't want a to become 2.0
132 test expr-4.1 "Shimmering" {