From 87a21f781c4249813648cefe56306eea0d6e0580 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Sun, 26 Jul 2020 17:46:58 -0400 Subject: [PATCH] add tests --- scripts/regression_tests.pd | 4 ++- .../regression_tests/pow~_negative_numbers.pd | 27 +++++++++++++++++++ .../wrap~_compatibility_bug.pd | 2 +- scripts/utils/sigtofloat~.pd | 26 +++++++++--------- 4 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 scripts/regression_tests/pow~_negative_numbers.pd diff --git a/scripts/regression_tests.pd b/scripts/regression_tests.pd index 097fcc19b..3f2c6cc91 100644 --- a/scripts/regression_tests.pd +++ b/scripts/regression_tests.pd @@ -1,4 +1,4 @@ -#N canvas 340 157 750 572 12; +#N canvas 225 102 750 572 12; #X obj 465 281 r \$0-result; #X obj 212 239 bng 31 250 50 0 empty empty Run_all 39 13 0 12 -262144 -1 -1; @@ -59,6 +59,7 @@ is handy for some binbuf tests.; #X obj 198 2031 rtest type_hint_coverage; #X obj 198 2086 rtest route_reject_bang; #X obj 198 2141 rtest text_sort; +#X obj 198 2196 rtest pow~_negative_numbers; #X connect 0 0 27 0; #X connect 1 0 4 0; #X connect 2 0 42 0; @@ -103,3 +104,4 @@ is handy for some binbuf tests.; #X connect 50 0 51 0; #X connect 51 0 52 0; #X connect 52 0 53 0; +#X connect 53 0 54 0; diff --git a/scripts/regression_tests/pow~_negative_numbers.pd b/scripts/regression_tests/pow~_negative_numbers.pd new file mode 100644 index 000000000..96bf34e6a --- /dev/null +++ b/scripts/regression_tests/pow~_negative_numbers.pd @@ -0,0 +1,27 @@ +#N canvas 320 117 911 463 12; +#X obj 41 28 inlet; +#X obj 41 404 outlet; +#X msg 41 56 bang; +#X msg 41 135 -2; +#X obj 41 164 ../utils/sigtofloat~ pow~ 2; +#X obj 41 193 == 4; +#X obj 41 222 list append pow~ should handle negative numbers correctly +for integer powers; +#X obj 41 85 trigger bang bang; +#X msg 461 135 -2; +#X obj 461 164 ../utils/sigtofloat~ pow~ 2.5; +#X obj 461 222 list append pow~ should output zero for negative numbers +when given a non-integer power; +#X obj 461 193 == 0; +#X connect 0 0 2 0; +#X connect 2 0 7 0; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 6 0 1 0; +#X connect 7 0 3 0; +#X connect 7 1 8 0; +#X connect 8 0 9 0; +#X connect 9 0 11 0; +#X connect 10 0 1 0; +#X connect 11 0 10 0; diff --git a/scripts/regression_tests/wrap~_compatibility_bug.pd b/scripts/regression_tests/wrap~_compatibility_bug.pd index d5fb2e3fb..ceacda737 100644 --- a/scripts/regression_tests/wrap~_compatibility_bug.pd +++ b/scripts/regression_tests/wrap~_compatibility_bug.pd @@ -1,4 +1,4 @@ -#N canvas 78 98 647 470 12; +#N canvas 79 122 647 470 12; #X obj 18 15 inlet; #X obj 508 171 ../utils/sigtofloat~ wrap~; #X floatatom 508 200 5 0 0 0 - - -, f 5; diff --git a/scripts/utils/sigtofloat~.pd b/scripts/utils/sigtofloat~.pd index 91c1059ad..6fdc6302e 100644 --- a/scripts/utils/sigtofloat~.pd +++ b/scripts/utils/sigtofloat~.pd @@ -1,6 +1,5 @@ -#N canvas 738 437 450 381 12; +#N canvas 739 461 450 381 12; #X obj 26 20 inlet; -#X obj 149 160 \$1; #X obj 149 134 sig~; #X obj 149 189 snapshot~; #X obj 26 76 t b b a b; @@ -14,15 +13,16 @@ float is converted to leftmost signal inlet. A single block is computed to generate the float output.; #X obj 149 218 outlet; -#X connect 0 0 4 0; -#X connect 1 0 3 0; -#X connect 2 0 1 0; -#X connect 3 0 12 0; -#X connect 4 0 8 0; -#X connect 4 1 7 0; -#X connect 4 2 2 0; -#X connect 4 3 5 0; -#X connect 5 0 6 0; +#X obj 149 160 \$@; +#X connect 0 0 3 0; +#X connect 1 0 12 0; +#X connect 2 0 11 0; +#X connect 3 0 7 0; +#X connect 3 1 6 0; +#X connect 3 2 1 0; +#X connect 3 3 4 0; +#X connect 4 0 5 0; +#X connect 7 0 8 0; +#X connect 7 1 2 0; #X connect 8 0 9 0; -#X connect 8 1 3 0; -#X connect 9 0 10 0; +#X connect 12 0 2 0; -- GitLab