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 cov‐
7 erage 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 prim‐
37 itives ("$a && $b", "$c ⎪⎪ $d", etc.) into more complex composite
38 expressions.
39
41 new_primitive($op, @coverage)
42
43 Create a new truth table based on one of the built-in primitives, which
44 are the subclasses of Devel::Cover::DB::Condition. $op is one of the
45 following:
46
47 and_3
48 "and" or "&&" with three conditional paths.
49
50 or_3
51 "or" or "⎪⎪" with three conditional paths.
52
53 or_2
54 "or" or "⎪⎪" with two conditional paths. (i.e., when the right hand
55 side of the expression is a constant)
56
57 xor_4
58 "xor" with four conditional paths.
59
60 @coverage is a list booleans identifying which of the possible paths
61 have been covered.
62
63 sort()
64
65 Sorts a truth table (in place) and returns the sorted object.
66
67 text()
68
69 Format a truth table to an array of strings for printing.
70
71 html()
72
73 Format a truth table in HTML.
74
75 error()
76
77 percentage()
78
79 Determines the proportion of possible conditions that have coverage.
80
81 right_merge($sub_table)
82
83 Merge entries from $sub_table into right column of table.
84
85 left_merge($sub_table)
86
87 Merge entries from $sub_table into left column of table.
88
90 Devel::Cover
91
93 None that I'm aware of...
94
96 Version 0.61 - 10th January 2007
97
99 Copyright 2002 Michael Carman <mjcarman@mchsi.com>
100
101 This software is free. It is licensed under the same terms as Perl
102 itself. The latest version should be available from:
103 http://www.pjcj.net
104
105
106
107perl v5.8.8 2007-01-10 Devel::Cover::Truth_Table(3)