Skip to content
Newer
Older
100755 51 lines (36 sloc) 1.55 KB
d6ead2c Initial commit from r31638 of https://svn.perl.org/parrot/trunk/langu…
wcoleda authored Oct 7, 2008
1 #!perl
2
06994a0 Update the files in the repo to add the Parrot Foundation as copyrigh…
arbelo authored Oct 1, 2009
3 # Copyright (C) 2007, The Parrot Foundation.
d6ead2c Initial commit from r31638 of https://svn.perl.org/parrot/trunk/langu…
wcoleda authored Oct 7, 2008
4
5 # the following lines re-execute this as a tcl script
6 # the \ at the end of these lines makes them a comment in tcl \
c34bff7 Tests only need to run from top level build dir.
wcoleda authored May 21, 2009
7 use lib qw(lib); # \
d6ead2c Initial commit from r31638 of https://svn.perl.org/parrot/trunk/langu…
wcoleda authored Oct 7, 2008
8 use Tcl::Test; #\
9 __DATA__
10
11 source lib/test_more.tcl
12 plan 14
13
14 eval_is {binary} {wrong # args: should be "binary option ?arg arg ...?"} \
15 {binary: no args}
16
17 eval_is {binary foo} {bad option "foo": must be format or scan} \
18 {binary: bad subcommand}
19
20 # we test the default precision (which is special) elsewhere
21 # so just set a precision to work around a bug
22 set tcl_precision 17
23
24 binary scan [binary format dccc -1.3 6 7 8] dcc* d c c*
25 is $d -1.3 {binary: reversible d} {TODO borked}
26 is $c 6 {binary: reversible c} {TODO borked}
27 is ${c*} {7 8} {binary: scan [format cc] c*} {TODO borked}
28
29 binary scan [binary format f -1.3] f f
30 is $f -1.2999999523162842 {binary: reversible f} {TODO borked}
31
32 binary scan [binary format n 9] n n
33 is $n 9 {binary: reversible n} {TODO borked}
34
35 binary scan {foo bar} aa* first rest
36 is [list $first $rest] {f {oo bar}} {binary: scan aa*}
37
38 binary scan [binary format A6A foo bar] A* string
39 eval_is {set string} {foo b} {binary: format A6A, scan A*}
40
41 binary scan [binary format A* {foo bar}] A7 string
42 is $string {foo bar} {binary: format A*, scan A7}
43
44 binary scan [binary format a4a foo bar] a3ca string1 c string2
45 is $string1 foo {binary: format a4a, scan a3ca}
46 is $c 0 {binary: format a4a, scan a3ca}
47 is $string2 b {binary: format a4a, scan a3ca}
48
49 # segfault misc.
50 is [proc a {} { binary scan \x80 d joe } ; a] {0} {BOOM?} {TODO borked}
Something went wrong with that request. Please try again.