From d08fb1df93b9f9585f401b1cf156df627c1cf024 Mon Sep 17 00:00:00 2001 From: mescalinum Date: Thu, 17 Nov 2011 20:44:52 +0000 Subject: add test for binbuf & atom types svn path=/trunk/externals/loaders/tclpd/; revision=15792 --- tests/Makefile | 2 ++ tests/binbuf.pd | 18 ++++++++++++++++++ tests/binbuf.ref | 14 ++++++++++++++ tests/binbuf_helper.tcl | 17 +++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 tests/binbuf.pd create mode 100644 tests/binbuf.ref create mode 100644 tests/binbuf_helper.tcl diff --git a/tests/Makefile b/tests/Makefile index 6829119..01ebc9e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,6 +6,8 @@ all: @sh runtest.sh basic_output @# basic input test - dispatching to correct methods @sh runtest.sh basic_input + @# atoms conversion test & binbuf retrieval + @sh runtest.sh binbuf clean: rm -fv *.out runtest-*.pd diff --git a/tests/binbuf.pd b/tests/binbuf.pd new file mode 100644 index 0000000..87f68d8 --- /dev/null +++ b/tests/binbuf.pd @@ -0,0 +1,18 @@ +#N canvas 306 152 450 300 10; +#X obj 48 53 inlet; +#X obj 48 234 outlet; +#N canvas 0 0 450 300 bang_swap 0; +#X obj 63 58 inlet; +#X obj 63 112 t b b; +#X obj 112 172 outlet; +#X obj 63 172 outlet; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 1 1 3 0; +#X restore 48 89 pd bang_swap; +#X obj 117 115 outlet; +#X obj 48 187 binbuf_helper \$0 \$1.foo foo 123 \, \;; +#X connect 0 0 2 0; +#X connect 2 0 4 0; +#X connect 2 1 3 0; +#X connect 4 0 1 0; diff --git a/tests/binbuf.ref b/tests/binbuf.ref new file mode 100644 index 0000000..f30f622 --- /dev/null +++ b/tests/binbuf.ref @@ -0,0 +1,14 @@ +atomtype symbol; +atomvalue binbuf_helper; +atomtype dollar; +atomvalue \$0; +atomtype dollsym; +atomvalue \$1.foo; +atomtype symbol; +atomvalue foo; +atomtype float; +atomvalue 123.0; +atomtype comma; +atomvalue \,; +atomtype semi; +atomvalue \;; diff --git a/tests/binbuf_helper.tcl b/tests/binbuf_helper.tcl new file mode 100644 index 0000000..863dd01 --- /dev/null +++ b/tests/binbuf_helper.tcl @@ -0,0 +1,17 @@ +package require Tclpd 0.3.0 +package require TclpdLib 0.20 + +proc binbuf_helper::constructor {self args} { + pd::add_outlet $self list +} + +proc binbuf_helper::0_bang {self} { + set binbuf [pd::get_binbuf $self] + foreach atom $binbuf { + foreach {atomtype atomvalue} $atom break + pd::outlet $self 0 list [list [list symbol atomtype] [list symbol $atomtype]] + pd::outlet $self 0 list [list [list symbol atomvalue] [list symbol $atomvalue]] + } +} + +pd::class binbuf_helper -- cgit v1.2.1