diff options
Diffstat (limited to 'tests/expr.test')
-rw-r--r-- | tests/expr.test | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/tests/expr.test b/tests/expr.test index c5b794a..4e0f18b 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -10,20 +10,16 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr.test,v 1.14 2001/12/06 10:59:18 dkf Exp $ +# RCS: @(#) $Id: expr.test,v 1.15 2002/07/10 08:25:59 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest namespace import -force ::tcltest::* } -if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} { - set gotT1 0 - puts "This application hasn't been compiled with the \"T1\" and" - puts "\"T2\" math functions, so I'll skip some of the expr tests." -} else { - set gotT1 1 -} +testConstraint registeredMathFuncs [expr { + ([catch {expr T1()} msg] != 1) || ($msg ne {unknown math function "T1"}) +}] # procedures used below @@ -630,24 +626,36 @@ test expr-15.6 {CompileMathFuncCall: missing ')'} { } {syntax error in expression "sin(1": missing close parenthesis at end of function call while compiling "expr sin(1"} -if $gotT1 { - test expr-15.7 {CompileMathFuncCall: call registered math function} { - expr 2*T1() - } 246 - test expr-15.8 {CompileMathFuncCall: call registered math function} { - expr T2()*3 - } 1035 - - test expr-15.9 {CompileMathFuncCall: call registered math function} { - expr T3(21, 37) - } 37 - test expr-15.10 {CompileMathFuncCall: call registered math function} { - expr T3(21.2, 37) - } 37.0 - test expr-15.11 {CompileMathFuncCall: call registered math function} { - expr T3(-21.2, -17.5) - } -17.5 -} +test expr-15.7 {CompileMathFuncCall: call registered math function} {registeredMathFuncs} { + expr 2*T1() +} 246 +test expr-15.8 {CompileMathFuncCall: call registered math function} {registeredMathFuncs} { + expr T2()*3 +} 1035 +test expr-15.9 {CompileMathFuncCall: call registered math function} {registeredMathFuncs} { + expr T3(21, 37) +} 37 +test expr-15.10 {CompileMathFuncCall: call registered math function} {registeredMathFuncs} { + expr T3(21.2, 37) +} 37.0 +test expr-15.11 {CompileMathFuncCall: call registered math function} {registeredMathFuncs} { + expr T3(-21.2, -17.5) +} -17.5 +test expr-15.12 {ExprCallMathFunc: call registered math function} {registeredMathFuncs} { + expr T3(21, wide(37)) +} 37 +test expr=15.13 {ExprCallMathFunc: call registered math function} {registeredMathFuncs} { + expr T3(wide(21), 37) +} 37 +test expr=15.14 {ExprCallMathFunc: call registered math function} {registeredMathFuncs} { + expr T3(wide(21), wide(37)) +} 37 +test expr-15.15 {ExprCallMathFunc: call registered math function} {registeredMathFuncs} { + expr T3(21.0, wide(37)) +} 37.0 +test expr=15.16 {ExprCallMathFunc: call registered math function} {registeredMathFuncs} { + expr T3(wide(21), 37.0) +} 37.0 test expr-16.1 {GetToken: checks whether integer token starting with "0x" (e.g., "0x$") is invalid} { catch {unset a} |