Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added test descriptions and another "flip" test
  • Loading branch information
dwarring committed Oct 22, 2014
1 parent 489ebb2 commit 49ce219
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions integration/advent2010-day08.t
Expand Up @@ -4,21 +4,29 @@ use v6;

use Test;

plan 7;
plan 8;

is do {flip "hello"}, "olleh";
is do {join ", ", reverse <ab cd ef>}, "ef, cd, ab";
is do {flip "hello"}, "olleh", 'string reversal';
is do {join ", ", reverse <ab cd ef>}, "ef, cd, ab", 'list reversal';

my %capitals = France => "Paris", UK => "London";
is_deeply %capitals.invert, ("Paris" => "France", "London" => "UK").list.item;
is_deeply %capitals.invert, ("Paris" => "France", "London" => "UK").list.item, 'hash inversion';

my %original := %capitals;
my %inverse;
%inverse.push( %original.invert );

is_deeply %inverse, {"Paris" => "France", "London" => "UK"};
is_deeply %inverse, {"Paris" => "France", "London" => "UK"}, 'hash inversion, non-distructive';

my %h;
%h.push('foo' => 1); is_deeply %h, {foo => 1};
%h.push('foo' => 2); is_deeply %h, {foo => [1, 2]};
%h.push('foo' => 3); is_deeply %h, {foo => [1, 2, 3]};

%h.push('foo' => 1);
is_deeply %h, {foo => 1}, 'hash element push';

%h.push('foo' => 2);
is_deeply %h, {foo => [1, 2]}, 'hash element push';

%h.push('foo' => 3);
is_deeply %h, {foo => [1, 2, 3]}, 'hash element push';

is_deeply flip(<a b c>.list), "c b a", 'flip coercement (list)';

0 comments on commit 49ce219

Please sign in to comment.