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

📄 expr.test

📁 linux系统下的音频通信
💻 TEST
📖 第 1 页 / 共 3 页
字号:
test expr-14.9 {CompilePrimaryExpr: literal primary} {expr {{abc\tde} > {abc\tdef}}} 0test expr-14.10 {CompilePrimaryExpr: literal primary} {expr {{123}}} 123test expr-14.11 {CompilePrimaryExpr: var reference primary} {    set i 789    list [expr {$i}] [expr $i]} {789 789}test expr-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 expr-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 expr-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 expr-14.15 {CompilePrimaryExpr: var reference primary} {    set i 123    catch {expr $i.2} msg    set msg} 123.2test expr-14.16 {CompilePrimaryExpr: error compiling var reference primary} {    catch {expr {$a(foo}} msg    set errorInfo} {missing )    (parsing index for array "a")    while compiling"expr {$a(foo}"}test expr-14.17 {CompilePrimaryExpr: string primary that looks like var ref} {    expr $} $test expr-14.18 {CompilePrimaryExpr: quoted string primary} {    expr "21"} 21test expr-14.19 {CompilePrimaryExpr: quoted string primary} {    set i 123    set x 456    expr "$i+$x"} 579test expr-14.20 {CompilePrimaryExpr: quoted string primary} {    set i 3    set x 6    expr 2+"$i.$x"} 5.6test expr-14.21 {CompilePrimaryExpr: error in quoted string primary} {    catch {expr "[set]"} msg    set msg} {wrong # args: should be "set varName ?newValue?"}test expr-14.22 {CompilePrimaryExpr: subcommand primary} {    expr {[set i 123; set i]}} 123test expr-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 expr-14.24 {CompilePrimaryExpr: error in subcommand primary} {    catch {expr {[set i}} msg    set errorInfo} {missing close-bracket or close-brace    while compiling"set i"    while compiling"expr {[set i}"}test expr-14.25 {CompilePrimaryExpr: math function primary} {    format %.6g [expr exp(1.0)]} 2.71828test expr-14.26 {CompilePrimaryExpr: math function primary} {    format %.6g [expr pow(2.0+0.1,3.0+0.1)]} 9.97424test expr-14.27 {CompilePrimaryExpr: error in math function primary} {    catch {expr sinh::(2.0)} msg    set errorInfo} {syntax error in expression "sinh::(2.0)"    while executing"expr sinh::(2.0)"}test expr-14.28 {CompilePrimaryExpr: subexpression primary} {    expr 2+(3*4)} 14test expr-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 expr-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)"    while executing"expr 2+(3*(4+5)"}test expr-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 expr-14.32 {CompilePrimaryExpr: unexpected token} {    catch {expr @} msg    set errorInfo} {syntax error in expression "@"    while executing"expr @"}test expr-15.1 {CompileMathFuncCall: missing parenthesis} {    catch {expr sinh2.0)} msg    set errorInfo} {syntax error in expression "sinh2.0)"    while executing"expr sinh2.0)"}test expr-15.2 {CompileMathFuncCall: unknown math function} {    catch {expr whazzathuh(1)} msg    set errorInfo} {unknown math function "whazzathuh"    while executing"expr whazzathuh(1)"}test expr-15.3 {CompileMathFuncCall: too many arguments} {    catch {expr sin(1,2,3)} msg    set errorInfo} {too many arguments for math function    while executing"expr sin(1,2,3)"}test expr-15.4 {CompileMathFuncCall: ')' found before last required arg} {    catch {expr sin()} msg    set errorInfo} {syntax error in expression "sin()"    while executing"expr sin()"}test expr-15.5 {CompileMathFuncCall: too few arguments} {    catch {expr pow(1)} msg    set errorInfo} {too few arguments for math function    while executing"expr pow(1)"}test expr-15.6 {CompileMathFuncCall: missing ')'} {    catch {expr sin(1} msg    set errorInfo} {syntax error in expression "sin(1"    while executing"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-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 expr-16.2 {GetToken: check for string literal in braces} {    expr {{1}}} {1}# Check "expr" and computed command names.test expr-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 expr-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 expr-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} 3unset a

⌨️ 快捷键说明

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