This is an automatically generated mail to inform you that tests are now available in t/spec/integration/advent2009-day06.t
commit 857b6752c143505e352390e02ab2bfd27fedab96 Author: snarkyboojum <snarkyboo...@c213334d-75ef-0310-aa23-eaa082d1ae64> Date: Wed May 19 06:45:25 2010 +0000 [t/spec/integration/advent2009-day06.t] Initial tests for Perl 6 Advent Calendar Day 6: Going Into Hyperspace git-svn-id: http://svn.pugscode.org/p...@30697 c213334d-75ef-0310-aa23-eaa082d1ae64 diff --git a/t/spec/integration/advent2009-day06.t b/t/spec/integration/advent2009-day06.t index dfb7ea5..0b5e486 100644 --- a/t/spec/integration/advent2009-day06.t +++ b/t/spec/integration/advent2009-day06.t @@ -1,4 +1,27 @@ -# http://perl6advent.wordpress.com/2009/12/20/day-20-little-big-things/ +# http://perl6advent.wordpress.com/2009/12/06/day-6-going-into-hyperspace/ use v6; use Test; + +plan(14); + +my @a = 1, 2, 3, 4; +my @b = 3, 1; +my @c = 3, 1, 3, 1; + +my @a-copy; +my @pi = 0, pi/4, pi/2, pi, 2*pi; +my @pi-sin = @pi>>.sin; + +is (@a <<+>> @c), [4, 3, 6, 5], 'Dwimmy hyperoperator on arrays of the same length'; +is (@a >>+<< @c), [4, 3, 6, 5], 'Non-dwimmy hyperoperator on arrays of the same length'; +is (@a <<+>> @b), [4, 3, 4, 5], 'Dwimmy hyperoperator on arrays of different size'; +dies_ok {...@a >>+<< @b}, 'Non-dwimmy hyperoperator on arrays of different size fails'; +is (@a >>+>> 2), [3, 4, 5, 6], 'Single scalars extend to the right'; +is (3 <<+<< @a), [4, 5, 6, 7], 'Single scalars extend to the left'; +is (~<<@a), ["1", "2", "3", "4"], 'Hyperoperator with prefix operator'; +is (@a-copy = @a; @a-copy>>++; @a-copy), [2, 3, 4, 5], 'Hyperoperator with postfix operator'; +for @pi Z @pi-sin -> $elem, $elem-sin { + is_approx $elem.sin, $elem-sin, 'Hyperoperator used to call .sin on each list element'; +} +is ((-1, 0, 3, 42)>>.Str), ["-1", "0", "3", "42"], 'Hyperoperator used to call .Str on each list element';