1Devel::Cover::Truth_TabUlsee(r3)Contributed Perl DocumenDteavteilo:n:Cover::Truth_Table(3)
2
3
4

NAME

6       Devel::Cover::Truth_Table - Truth tables for coverage objects.
7

VERSION

9       version 1.36
10

SYNOPSIS

12         use Devel::Cover::Truth_Table;
13
14         # $a || $b
15         my $or_tt  = Devel::Cover::Truth_Table->new_primitive('or_3', 0, 1, 1);
16
17         # $c && $d
18         my $and_tt = Devel::Cover::Truth_Table->new_primitive('and_3', 1, 0, 1);
19
20         # merge contents of $and_tt into right column of $or_tt, to create
21         # $a || ($c && $d)
22         $or_tt->right_merge($and_tt);
23
24         # get a (sorted) textual representation
25         my @text = $or_tt->sort->text;
26         print "$_\n" foreach @text;
27
28         __END__
29         A B C |exp|hit
30         --------------
31         0 0 X | 0 |---
32         0 1 0 | 0 |---
33         0 1 1 | 1 |+++
34         1 X X | 1 |+++
35         --------------
36

DESCRIPTION

38       This module provides methods for creating and merging conditional
39       primitives ("$a && $b", "$c || $d", etc.) into more complex composite
40       expressions.
41

METHODS

43   new_primitive($op, @coverage)
44       Create a new truth table based on one of the built-in primitives, which
45       are the subclasses of Devel::Cover::DB::Condition. $op is one of the
46       following:
47
48       and_3
49           "and" or "&&" with three conditional paths.
50
51       or_3
52           "or" or "||" with three conditional paths.
53
54       or_2
55           "or" or "||" with two conditional paths. (i.e., when the right hand
56           side of the expression is a constant)
57
58       xor_4
59           "xor" with four conditional paths.
60
61       @coverage is a list booleans identifying which of the possible paths
62       have been covered.
63
64   sort()
65       Sorts a truth table (in place) and returns the sorted object.
66
67   text()
68       Format a truth table to an array of strings for printing.
69
70   html()
71       Format a truth table in HTML.
72
73   error()
74   percentage()
75       Determines the proportion of possible conditions that have coverage.
76
77   right_merge($sub_table)
78       Merge entries from $sub_table into right column of table.
79
80   left_merge($sub_table)
81       Merge entries from $sub_table into left column of table.
82

SEE ALSO

84       Devel::Cover
85

BUGS

87       None that I'm aware of...
88

LICENSE

90       Copyright 2002 Michael Carman <mjcarman@mchsi.com>
91
92       This software is free. It is licensed under the same terms as Perl
93       itself. The latest version should be available from:
94       http://www.pjcj.net
95
96
97
98perl v5.32.0                      2020-07-28      Devel::Cover::Truth_Table(3)
Impressum