summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Test/Deep/Boolean.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Test/Deep/Boolean.pm')
-rwxr-xr-xMaster/tlpkg/tlperl/lib/Test/Deep/Boolean.pm46
1 files changed, 46 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl/lib/Test/Deep/Boolean.pm b/Master/tlpkg/tlperl/lib/Test/Deep/Boolean.pm
new file mode 100755
index 00000000000..e0204031718
--- /dev/null
+++ b/Master/tlpkg/tlperl/lib/Test/Deep/Boolean.pm
@@ -0,0 +1,46 @@
+use strict;
+use warnings;
+
+package Test::Deep::Boolean;
+
+use Test::Deep::Cmp;
+
+sub init
+{
+ my $self = shift;
+
+ $self->{val} = shift() ? 1 : 0;
+}
+
+sub descend
+{
+ my $self = shift;
+ my $got = shift;
+
+ return !( $got xor $self->{val} );
+}
+
+sub diag_message
+{
+ my $self = shift;
+ my $where = shift;
+ return "Comparing $where as a boolean";
+}
+
+sub renderExp
+{
+ my $self = shift;
+
+ $self->renderGot($self->{val});
+}
+
+sub renderGot
+{
+ my $self = shift;
+
+ my $val = shift;
+
+ return ($val ? "true" : "false")." (".Test::Deep::render_val($val).")";
+}
+
+1;