]> Dogcows Code - chaz/p5-Acme-Test-LogicalEquivalence/blob - README
Version 0.001
[chaz/p5-Acme-Test-LogicalEquivalence] / README
1 NAME
2
3 Acme::Test::LogicalEquivalence - Test if expressions are logically
4 equivalent
5
6 VERSION
7
8 version 0.001
9
10 SYNOPSIS
11
12 use Test::More;
13 use Acme::Test::LogicalEquivalence qw(is_logically_equivalent);
14
15 # test two expressions with 2 variables using the special vars $a and $b
16 is_logically_equivalent(2, sub { $a && $b }, sub { $b && $a });
17
18 # same as above
19 is_logically_equivalent(2, sub { $_[0] && $_[1] }, sub { $_[1] && $_[0] });
20
21 # you can do as many vars as you like
22 is_logically_equivalent(3, sub { $_[0] || ($_[1] && $_[2]) },
23 sub { ($_[0] || $_[1]) && ($_[0] || $_[2]) });
24
25 done_testing;
26
27 DESCRIPTION
28
29 Some expressions are "logically equivalent" to other expressions, but
30 it may not be easy to tell if one or both of the expressions are
31 reasonably complicated. Or maybe you're like many other people and are
32 too lazy to go through the effort... Either way, why not let your
33 computer prove logical equivalence for you?
34
35 FUNCTIONS
36
37 is_logically_equivalent
38
39 Test logical equivalence of two subroutines.
40
41 my $is_equivalent = is_logically_equivalent($numvars, &sub1, &sub2);
42
43 This will execute both of the subroutines one or more times (depending
44 on how many variables you specify) with different inputs. The
45 subroutines shall be considered logically equivalent if, for all
46 combinations of inputs, they both return the same thing.
47
48 Returns true if the subroutines are logically equivalent, false
49 otherwise.
50
51 SEE ALSO
52
53 * What is logical equivalence? Start here:
54 https://en.wikipedia.org/wiki/Logical_equivalence
55
56 AUTHOR
57
58 Charles McGarvey <chazmcgarvey@brokenzipper.com>
59
60 COPYRIGHT AND LICENSE
61
62 This software is copyright (c) 2016 by Charles McGarvey.
63
64 This is free software; you can redistribute it and/or modify it under
65 the same terms as the Perl 5 programming language system itself.
66
This page took 0.035466 seconds and 4 git commands to generate.