Skip to content

Commit

Permalink
Remove trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Jul 28, 2018
1 parent c928f51 commit ecf4693
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions S09-multidim/methods.t
Expand Up @@ -6,14 +6,14 @@ plan 80;
# Object array
{
my @arr := Array.new(:shape(2;2));

is @arr.shape, (2;2), 'shape is set on array';
is @arr.elems, 2, 'elems is size of first dimensions';

ok @arr.eager === @arr, 'eager is identity on a shaped array';
lives-ok { @arr.sink }, 'sink lives on a shaped array';
is @arr.is-lazy, False, 'shaped array knows it is not lazy';

throws-like { @arr.push(1) }, X::IllegalOnFixedDimensionArray, operation => 'push';
throws-like { @arr.append(1) }, X::IllegalOnFixedDimensionArray, operation => 'append';
throws-like { @arr.pop() }, X::IllegalOnFixedDimensionArray, operation => 'pop';
Expand All @@ -23,7 +23,7 @@ plan 80;
throws-like { @arr.splice(1) }, X::IllegalOnFixedDimensionArray, operation => 'splice';
throws-like { @arr.reverse }, X::IllegalOnFixedDimensionArray, operation => 'reverse';
throws-like { @arr.rotate(1) }, X::IllegalOnFixedDimensionArray, operation => 'rotate';

@arr[0;0] = 'a';
@arr[0;1] = 'b';
@arr[1;0] = 'c';
Expand All @@ -36,18 +36,18 @@ plan 80;
'.pairs on a 2x2 array gives list of pairs mapping indice lists to values';
is @arr.antipairs, ('a' => (0, 0), 'b' => (0, 1), 'c' => (1, 0), 'd' => (1, 1)),
'.antipairs on a 2x2 array gives list of pairs mapping values to indice lists';

is Array.new(:shape(4)).keys, (0, 1, 2, 3), '.keys on 1-dim gives list of indices';

my $iter = @arr.iterator;
is $iter.pull-one, 'a', '.iterator gives iterator walking leaves (1)';
is $iter.pull-one, 'b', '.iterator gives iterator walking leaves (2)';
is $iter.pull-one, 'c', '.iterator gives iterator walking leaves (3)';
is $iter.pull-one, 'd', '.iterator gives iterator walking leaves (4)';
ok $iter.pull-one =:= IterationEnd, '.iterator gives iterator walking leaves (5)';

is @arr.flat, <a b c d>, '.flat gives the leaves';

is @arr.combinations, <a b c d>.combinations, '.combinations is over leaves';
is @arr.permutations, <a b c d>.permutations, '.permutations is over leaves';
ok 'a' le @arr.pick le 'd', '.pick is over leaves (1)';
Expand All @@ -58,7 +58,7 @@ plan 80;
is @arr.map(* x 2), <aa bb cc dd>, '.map is over leaves';
is @arr.sort, <a b c d>, '.sort is over leaves';
is @arr.Slip, <a b c d>.Slip, '.Slip is over leaves';

is @arr.gist, '[[a b] [c d]]', '.gist represents structure';
is @arr.perl, 'Array.new(:shape(2, 2), ["a", "b"], ["c", "d"])',
'.perl retains structure';
Expand All @@ -72,14 +72,14 @@ plan 80;
# Native array
{
my @arr := array[int].new(:shape(2;2));

is @arr.shape, (2;2), 'shape is set on array (native)';
is @arr.elems, 2, 'elems is size of first dimensions (native)';

ok @arr.eager === @arr, 'eager is identity on a shaped array (native)';
lives-ok { @arr.sink }, 'sink lives on a shaped array (native)';
is @arr.is-lazy, False, 'shaped array knows it is not lazy (native)';

throws-like { @arr.push(1) }, X::IllegalOnFixedDimensionArray, operation => 'push';
throws-like { @arr.append(1) }, X::IllegalOnFixedDimensionArray, operation => 'append';
throws-like { @arr.pop() }, X::IllegalOnFixedDimensionArray, operation => 'pop';
Expand All @@ -89,7 +89,7 @@ plan 80;
throws-like { @arr.splice(1) }, X::IllegalOnFixedDimensionArray, operation => 'splice';
throws-like { @arr.reverse }, X::IllegalOnFixedDimensionArray, operation => 'reverse';
throws-like { @arr.rotate(1) }, X::IllegalOnFixedDimensionArray, operation => 'rotate';

@arr[0;0] = 42;
@arr[0;1] = 43;
@arr[1;0] = 44;
Expand All @@ -103,18 +103,18 @@ plan 80;
'.pairs on a 2x2 array gives list of pairs mapping indice lists to values (native)';
is @arr.antipairs, (42 => (0, 0), 43 => (0, 1), 44 => (1, 0), 45 => (1, 1)),
'.antipairs on a 2x2 array gives list of pairs mapping values to indice lists (native)';

is array[int].new(:shape(4)).keys, (0, 1, 2, 3), '.keys on 1-dim gives list of indices (native)';

my $iter = @arr.iterator;
is $iter.pull-one, 42, '.iterator gives iterator walking leaves (native) (1)';
is $iter.pull-one, 43, '.iterator gives iterator walking leaves (native) (2)';
is $iter.pull-one, 44, '.iterator gives iterator walking leaves (native) (3)';
is $iter.pull-one, 45, '.iterator gives iterator walking leaves (native) (4)';
ok $iter.pull-one =:= IterationEnd, '.iterator gives iterator walking leaves (native) (5)';

is @arr.flat, (42, 43, 44, 45), '.flat gives the leaves (native)';

is @arr.combinations, (42, 43, 44, 45).combinations, '.combinations is over leaves (native)';
is @arr.permutations, (42, 43, 44, 45).permutations, '.permutations is over leaves (native)';
ok 42 <= @arr.pick <= 45, '.pick is over leaves (native) (1)';
Expand Down

0 comments on commit ecf4693

Please sign in to comment.