|
#!/usr/bin/perl
BEGIN { use_ok( 'List::Comprehensions' ); }
my @c1 = comp1 { [ @_ ] } [0..4], [0..4], [0..4];
no warnings 'once' ;
no strict 'vars' ;
my @c2 = comp2 { [ $i , $j , $k ] }
i => [0..4],
j => [0..4],
k => [0..4];
my ( $i , $j , $k ) = ( 'lexical' , 'values' , 'before' );
my @c3 = comp2 { [ $i , $j , $k ] }
i => [0..4],
j => [0..4],
k => [0..4];
cmp_ok( $i , 'eq' , 'lexical' );
cmp_ok( $j , 'eq' , 'values' );
cmp_ok( $k , 'eq' , 'before' );
my @c4 = ();
for $i ( 0..4 ) {
for $j ( 0..4 ) {
for $k ( 0..4 ) {
push @c4 , [ $i , $j , $k ];
}
}
}
is_deeply(\ @c1 , \ @c2 );
is_deeply(\ @c2 , \ @c3 );
is_deeply(\ @c3 , \ @c4 );
|