Created
July 10, 2012 07:58
-
-
Save pjlsergeant/3081936 to your computer and use it in GitHub Desktop.
Idea for inline-testing and contracts for Perl method creation
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
| method implication => | |
| applies => sub { | |
| my ( $class, %args ) = @_; | |
| return $args{'lhs'} <= $args{'rhs'}; | |
| }, | |
| to => { | |
| lhs => { isa => 'Bool', required => 1 }, | |
| rhs => { isa => 'Bool', required => 1 }, | |
| }, | |
| yielding => 'Bool', | |
| such_that => [ | |
| { given => { lhs => 0, rhs => 0 }, then => 1 }, | |
| { given => { lhs => 0, rhs => 1 }, then => 1 }, | |
| { given => { lhs => 1, rhs => 0 }, then => 0 }, | |
| { given => { lhs => 1, rhs => 1 }, then => 1 }, | |
| ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment