1Devel::Cover::Truth_TabUlsee(r3)Contributed Perl DocumenDteavteilo:n:Cover::Truth_Table(3)
2
3
4
6 Devel::Cover::Truth_Table - Create and manipulate truth tables for
7 coverage objects.
8
10 use Devel::Cover::Truth_Table;
11
12 # $a || $b
13 my $or_tt = Devel::Cover::Truth_Table->new_primitive('or_3', 0, 1, 1);
14
15 # $c && $d
16 my $and_tt = Devel::Cover::Truth_Table->new_primitive('and_3', 1, 0, 1);
17
18 # merge contents of $and_tt into right column of $or_tt, to create
19 # $a || ($c && $d)
20 $or_tt->right_merge($and_tt);
21
22 # get a (sorted) textual representation
23 my @text = $or_tt->sort->text;
24 print "$_\n" foreach @text;
25
26 __END__
27 A B C |exp|hit
28 --------------
29 0 0 X | 0 |---
30 0 1 0 | 0 |---
31 0 1 1 | 1 |+++
32 1 X X | 1 |+++
33 --------------
34
36 This module provides methods for creating and merging conditional
37 primitives ("$a && $b", "$c || $d", etc.) into more complex composite
38 expressions.
39
41 new_primitive($op, @coverage)
42 Create a new truth table based on one of the built-in primitives, which
43 are the subclasses of Devel::Cover::DB::Condition. $op is one of the
44 following:
45
46 and_3
47 "and" or "&&" with three conditional paths.
48
49 or_3
50 "or" or "||" with three conditional paths.
51
52 or_2
53 "or" or "||" with two conditional paths. (i.e., when the right hand
54 side of the expression is a constant)
55
56 xor_4
57 "xor" with four conditional paths.
58
59 @coverage is a list booleans identifying which of the possible paths
60 have been covered.
61
62 sort()
63 Sorts a truth table (in place) and returns the sorted object.
64
65 text()
66 Format a truth table to an array of strings for printing.
67
68 html()
69 Format a truth table in HTML.
70
71 error()
72 percentage()
73 Determines the proportion of possible conditions that have coverage.
74
75 right_merge($sub_table)
76 Merge entries from $sub_table into right column of table.
77
78 left_merge($sub_table)
79 Merge entries from $sub_table into left column of table.
80
82 Devel::Cover
83
85 None that I'm aware of...
86
88 Version 0.66 - 12th April 2010
89
91 Copyright 2002 Michael Carman <mjcarman@mchsi.com>
92
93 This software is free. It is licensed under the same terms as Perl
94 itself. The latest version should be available from:
95 http://www.pjcj.net
96
97
98
99perl v5.12.3 2010-04-12 Devel::Cover::Truth_Table(3)