Created
July 5, 2010 18:12
-
-
Save schwern/464559 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This would work better with subroutine signatures | |
cases 'test all combinations', { | |
cases => { | |
set_a => sub { return( 5, 5 ) }, | |
set_b => sub { return( 4, 6 ) }, | |
set_c => sub { return( 3, 7 ) }, | |
set_d => sub { return( 2, 8 ) }, | |
}, | |
tests => { | |
'equals 10' => sub { | |
is( $_[0] + $_[1], 10, "sum is ten" ) | |
}, | |
'both vars are true' => sub { | |
my($a, $b) = @_; | |
ok( $a, "var_a is true" ); | |
ok( $b, "var_b is true" ); | |
} | |
} | |
}; | |
or | |
cases 'test all combinations', { | |
cases => { | |
set_a => sub { { a => 5, b => 5 } }, | |
set_b => sub { { a => 4, b => 6 } }, | |
set_c => sub { { a => 3, b => 7 } }, | |
set_d => sub { { a => 2, b => 8 } }, | |
}, | |
tests => { | |
'equals 10' => sub { | |
is( $case{a} + $case{b}, 10, "sum is ten" ) | |
}, | |
'both vars are true' => sub { | |
ok( $case{a}, "var_a is true" ); | |
ok( $case{b}, "var_b is true" ); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment