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

📄 io.test

📁 linux系统下的音频通信
💻 TEST
📖 第 1 页 / 共 5 页
字号:
    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf -eofchar {}    set s [format "abc\ndef\n%cghi\nqrs" 26]    puts $f $s    close $f    set f [open test1 r]    fconfigure $f -translation lf -eofchar {}    set l ""    lappend l [gets $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} "abc def 0 \x1aghi 0 qrs 0 {} 1"test io-7.21 {Tcl_Write, ^Z in middle ignored, Tcl_Read cr} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf -eofchar {}    set s [format "abc\ndef\n%cghi\nqrs" 26]    puts $f $s    close $f    set f [open test1 r]    fconfigure $f -translation cr -eofchar {}    set l ""    set x [gets $f]    lappend l [string compare $x "abc\ndef\n\x1aghi\nqrs"]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} {0 1 {} 1}test io-7.22 {Tcl_Write, ^Z in middle ignored, Tcl_Read crlf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf -eofchar {}    set s [format "abc\ndef\n%cghi\nqrs" 26]    puts $f $s    close $f    set f [open test1 r]    fconfigure $f -translation crlf -eofchar {}    set l ""    set x [gets $f]    lappend l [string compare $x "abc\ndef\n\x1aghi\nqrs"]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} {0 1 {} 1}test io-7.23 {Tcl_Write lf, ^Z in middle, Tcl_Read auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    set c [format abc\ndef\n%cqrs\ntuv 26]    puts $f $c    close $f    set f [open test1 r]    fconfigure $f -translation auto -eofchar \x1a    set c [string length [read $f]]    set e [eof $f]    close $f    list $c $e} {8 1}test io-7.24 {Tcl_Write lf, ^Z in middle, Tcl_Read lf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    set c [format abc\ndef\n%cqrs\ntuv 26]    puts $f $c    close $f    set f [open test1 r]    fconfigure $f -translation lf -eofchar \x1a    set c [string length [read $f]]    set e [eof $f]    close $f    list $c $e} {8 1}test io-7.25 {Tcl_Write cr, ^Z in middle, Tcl_Read auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation cr    set c [format abc\ndef\n%cqrs\ntuv 26]    puts $f $c    close $f    set f [open test1 r]    fconfigure $f -translation auto -eofchar \x1a    set c [string length [read $f]]    set e [eof $f]    close $f    list $c $e} {8 1}test io-7.26 {Tcl_Write cr, ^Z in middle, Tcl_Read cr} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation cr    set c [format abc\ndef\n%cqrs\ntuv 26]    puts $f $c    close $f    set f [open test1 r]    fconfigure $f -translation cr -eofchar \x1a    set c [string length [read $f]]    set e [eof $f]    close $f    list $c $e} {8 1}test io-7.27 {Tcl_Write crlf, ^Z in middle, Tcl_Read auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation crlf    set c [format abc\ndef\n%cqrs\ntuv 26]    puts $f $c    close $f    set f [open test1 r]    fconfigure $f -translation auto -eofchar \x1a    set c [string length [read $f]]    set e [eof $f]    close $f    list $c $e} {8 1}test io-7.28 {Tcl_Write crlf, ^Z in middle, Tcl_Read crlf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation crlf    set c [format abc\ndef\n%cqrs\ntuv 26]    puts $f $c    close $f    set f [open test1 r]    fconfigure $f -translation crlf -eofchar \x1a    set c [string length [read $f]]    set e [eof $f]    close $f    list $c $e} {8 1}# Test end of line translations. Functions tested are Tcl_Write and Tcl_Gets.test io-8.1 {Tcl_Write lf, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    set l ""    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    close $f    set l} {hello 6 auto there 12 auto}test io-8.2 {Tcl_Write cr, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation cr    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    set l ""    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    close $f    set l} {hello 6 auto there 12 auto}test io-8.3 {Tcl_Write crlf, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation crlf    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    set l ""    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    close $f    set l} {hello 7 auto there 14 auto}test io-8.4 {Tcl_Write lf, Tcl_Gets lf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation lf    set l ""    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    close $f    set l} {hello 6 lf there 12 lf}test io-8.5 {Tcl_Write lf, Tcl_Gets cr} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation cr    set l ""    lappend l [string length [gets $f]]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    close $f    set l} {20 21 cr 1 {} 21 cr 1}test io-8.6 {Tcl_Write lf, Tcl_Gets crlf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation crlf    set l ""    lappend l [string length [gets $f]]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    close $f    set l} {20 21 crlf 1 {} 21 crlf 1}test io-8.7 {Tcl_Write cr, Tcl_Gets cr} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation cr    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation cr    set l ""    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    close $f    set l} {hello 6 cr 0 there 12 cr 0}test io-8.8 {Tcl_Write cr, Tcl_Gets lf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation cr    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation lf    set l ""    lappend l [string length [gets $f]]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    close $f    set l} {21 21 lf 1 {} 21 lf 1}test io-8.9 {Tcl_Write cr, Tcl_Gets crlf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation cr    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation crlf    set l ""    lappend l [string length [gets $f]]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    close $f    set l} {21 21 crlf 1 {} 21 crlf 1}test io-8.10 {Tcl_Write crlf, Tcl_Gets crlf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation crlf    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation crlf    set l ""    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    close $f    set l} {hello 7 crlf 0 there 14 crlf 0}test io-8.11 {Tcl_Write crlf, Tcl_Gets cr} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation crlf    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation cr    set l ""    lappend l [gets $f]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    lappend l [string length [gets $f]]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    close $f    set l} {hello 6 cr 0 6 13 cr 0}test io-8.12 {Tcl_Write crlf, Tcl_Gets lf} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation crlf    puts $f hello\nthere\nand\nhere    close $f    set f [open test1 r]    fconfigure $f -translation lf    set l ""    lappend l [string length [gets $f]]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    lappend l [string length [gets $f]]    lappend l [tell $f]    lappend l [fconfigure $f -translation]    lappend l [eof $f]    close $f    set l} {6 7 lf 0 6 14 lf 0}test io-8.13 {binary mode is synonym of lf mode} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation binary    set x [fconfigure $f -translation]    close $f    set x} lf## Test io-9.14 has been removed because "auto" output translation mode is# not supoprted.#test io-8.14 {Tcl_Write mixed, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    puts $f hello\nthere\rand\r\nhere    close $f    set f [open test1 r]    fconfigure $f -translation auto    set l ""    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} {hello there and here 0 {} 1}test io-8.15 {Tcl_Write mixed, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    puts -nonewline $f hello\nthere\rand\r\nhere\r    close $f    set f [open test1 r]    fconfigure $f -translation auto    set l ""    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} {hello there and here 0 {} 1}test io-8.16 {Tcl_Write mixed, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    puts -nonewline $f hello\nthere\rand\r\nhere\n    close $f    set f [open test1 r]    set l ""    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} {hello there and here 0 {} 1}test io-8.17 {Tcl_Write mixed, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    puts -nonewline $f hello\nthere\rand\r\nhere\r\n    close $f    set f [open test1 r]    fconfigure $f -translation auto    set l ""    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} {hello there and here 0 {} 1}test io-8.18 {Tcl_Write ^Z at end, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    set s [format "hello\nthere\nand\rhere\n\%c" 26]    puts $f $s    close $f    set f [open test1 r]    fconfigure $f -eofchar \x1a -translation auto    set l ""    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} {hello there and here 0 {} 1}test io-8.19 {Tcl_Write, implicit ^Z at end, Tcl_Gets auto} {    removeFile test1    set f [open test1 w]    fconfigure $f -eofchar \x1a -translation lf    puts $f hello\nthere\nand\rhere    close $f    set f [open test1 r]    fconfigure $f -eofchar \x1a -translation auto    set l ""    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [gets $f]    lappend l [eof $f]    lappend l [gets $f]    lappend l [eof $f]    close $f    set l} {hello there and here 0 {} 1}test io-8.20 {Tcl_Write, ^Z in middle, Tcl_Gets auto, eofChar} {    removeFile test1    set f [open test1 w]    fconfigure $f -translation lf    set s [format "abc\ndef\n%cqrs\ntuv" 26]    puts $f $s    close $f    set f [open test1 r]    fconfigure $f -eofchar \x1a    fconfigure $f -translation auto    set l ""    lappend l [gets $f]    lappend l [gets $f]

⌨️ 快捷键说明

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