⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compexpr-old.test

📁 tcl是工具命令语言
💻 TEST
📖 第 1 页 / 共 3 页
字号:
test compExpr-old-14.9 {CompilePrimaryExpr: literal primary} {expr {{abc\tde} > {abc\tdef}}} 0test compExpr-old-14.10 {CompilePrimaryExpr: literal primary} {expr {{123}}} 123test compExpr-old-14.11 {CompilePrimaryExpr: var reference primary} {    set i 789    list [expr {$i}] [expr $i]} {789 789}test compExpr-old-14.12 {CompilePrimaryExpr: var reference primary} {    set i {789}    ;# test expr's aggressive conversion to numeric semantics    list [expr {$i}] [expr $i]} {789 789}test compExpr-old-14.13 {CompilePrimaryExpr: var reference primary} {    catch {unset a}    set a(foo) foo    set a(bar) bar    set a(123) 123    set result ""    lappend result [expr $a(123)] [expr {$a(bar)<$a(foo)}]    catch {unset a}    set result} {123 1}test compExpr-old-14.14 {CompilePrimaryExpr: var reference primary} {    set i 123    ;# test "$var.0" floating point conversion hack    list [expr $i] [expr $i.0] [expr $i.0/12.0]} {123 123.0 10.25}test compExpr-old-14.15 {CompilePrimaryExpr: var reference primary} {    set i 123    catch {expr $i.2} msg    set msg} 123.2test compExpr-old-14.16 {CompilePrimaryExpr: error compiling var reference primary} {    catch {expr {$a(foo}} msg    set errorInfo} {missing )    while compiling"expr {$a(foo}"}test compExpr-old-14.17 {CompilePrimaryExpr: string primary that looks like var ref} {    expr $} $test compExpr-old-14.18 {CompilePrimaryExpr: quoted string primary} {    expr "21"} 21test compExpr-old-14.19 {CompilePrimaryExpr: quoted string primary} {    set i 123    set x 456    expr "$i+$x"} 579test compExpr-old-14.20 {CompilePrimaryExpr: quoted string primary} {    set i 3    set x 6    expr 2+"$i.$x"} 5.6test compExpr-old-14.21 {CompilePrimaryExpr: error in quoted string primary} {    catch {expr "[set]"} msg    set msg} {wrong # args: should be "set varName ?newValue?"}test compExpr-old-14.22 {CompilePrimaryExpr: subcommand primary} {    expr {[set i 123; set i]}} 123test compExpr-old-14.23 {CompilePrimaryExpr: error in subcommand primary} {    catch {expr {[set]}} msg    set errorInfo} {wrong # args: should be "set varName ?newValue?"    while compiling"set"    while compiling"expr {[set]}"}test compExpr-old-14.24 {CompilePrimaryExpr: error in subcommand primary} {    catch {expr {[set i}} msg    set errorInfo} {missing close-bracket    while compiling"expr {[set i}"}test compExpr-old-14.25 {CompilePrimaryExpr: math function primary} {    format %.6g [expr exp(1.0)]} 2.71828test compExpr-old-14.26 {CompilePrimaryExpr: math function primary} {    format %.6g [expr pow(2.0+0.1,3.0+0.1)]} 9.97424test compExpr-old-14.27 {CompilePrimaryExpr: error in math function primary} {    catch {expr sinh::(2.0)} msg    set errorInfo} {syntax error in expression "sinh::(2.0)": expected parenthesis enclosing function arguments    while compiling"expr sinh::(2.0)"}test compExpr-old-14.28 {CompilePrimaryExpr: subexpression primary} {    expr 2+(3*4)} 14test compExpr-old-14.29 {CompilePrimaryExpr: error in subexpression primary} {    catch {expr 2+(3*[set])} msg    set errorInfo} {wrong # args: should be "set varName ?newValue?"    while compiling"set"    while compiling"expr 2+(3*[set])"}test compExpr-old-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} {    catch {expr 2+(3*(4+5)} msg    set errorInfo} {syntax error in expression "2+(3*(4+5)": looking for close parenthesis    while compiling"expr 2+(3*(4+5)"}test compExpr-old-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} {    set i "5+10"    list "[expr $i] == 15" "[expr ($i)] == 15" "[eval expr ($i)] == 15"} {{15 == 15} {15 == 15} {15 == 15}}test compExpr-old-14.32 {CompilePrimaryExpr: unexpected token} {    catch {expr @} msg    set errorInfo} {syntax error in expression "@": character not legal in expressions    while compiling"expr @"}test compExpr-old-15.1 {CompileMathFuncCall: missing parenthesis} {    catch {expr sinh2.0)} msg    set errorInfo} {syntax error in expression "sinh2.0)": variable references require preceding $    while compiling"expr sinh2.0)"}test compExpr-old-15.2 {CompileMathFuncCall: unknown math function} {    catch {expr whazzathuh(1)} msg    set errorInfo} {unknown math function "whazzathuh"    while compiling"expr whazzathuh(1)"}test compExpr-old-15.3 {CompileMathFuncCall: too many arguments} {    catch {expr sin(1,2,3)} msg    set errorInfo} {too many arguments for math function    while compiling"expr sin(1,2,3)"}test compExpr-old-15.4 {CompileMathFuncCall: ')' found before last required arg} {    catch {expr sin()} msg    set errorInfo} {too few arguments for math function    while compiling"expr sin()"}test compExpr-old-15.5 {CompileMathFuncCall: too few arguments} {    catch {expr pow(1)} msg    set errorInfo} {too few arguments for math function    while compiling"expr pow(1)"}test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} {    catch {expr sin(1} msg    set errorInfo} {syntax error in expression "sin(1": missing close parenthesis at end of function call    while compiling"expr sin(1"}if $gotT1 {    test compExpr-old-15.7 {CompileMathFuncCall: call registered math function} {	expr 2*T1()    } 246    test compExpr-old-15.8 {CompileMathFuncCall: call registered math function} {	expr T2()*3    } 1035    test compExpr-old-15.9 {CompileMathFuncCall: call registered math function} {	expr T3(21, 37)    } 37    test compExpr-old-15.10 {CompileMathFuncCall: call registered math function} {	expr T3(21.2, 37)    } 37.0    test compExpr-old-15.11 {CompileMathFuncCall: call registered math function} {	expr T3(-21.2, -17.5)    } -17.5}test compExpr-old-16.1 {GetToken: checks whether integer token starting with "0x" (e.g., "0x$") is invalid} {    catch {unset a}    set a(VALUE) ff15    set i 123    if {[expr 0x$a(VALUE)] & 16} {        set i {}    }    set i} {}test compExpr-old-16.2 {GetToken: check for string literal in braces} {    expr {{1}}} {1}# Check "expr" and computed command names.test compExpr-old-17.1 {expr and computed command names} {    set i 0    set z expr    $z 1+2} 3# Check correct conversion of operands to numbers: If the string looks like# an integer, convert to integer. Otherwise, if the string looks like a# double, convert to double.test compExpr-old-18.1 {expr and conversion of operands to numbers} {    set x [lindex 11 0]    catch {expr int($x)}    expr {$x}} 11# Check "expr" and interpreter result object resetting before appending# an error msg during evaluation of exprs not in {}stest compExpr-old-19.1 {expr and interpreter result object resetting} {    proc p {} {        set t  10.0        set x  2.0        set dx 0.2        set f  {$dx-$x/10}        set g  {-$x/5}        set center 1.0        set x  [expr $x-$center]        set dx [expr $dx+$g]        set x  [expr $x+$f+$center]        set x  [expr $x+$f+$center]        set y  [expr round($x)]    }    p} 3# cleanupif {[info exists a]} {    unset a}::tcltest::cleanupTestsreturn

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -