summaryrefslogtreecommitdiffstats
path: root/t/scripts/Lintian/Relation/07-implies.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:42:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:42:30 +0000
commit75808db17caf8b960b351e3408e74142f4c85aac (patch)
tree7989e9c09a4240248bf4658a22208a0a52d991c4 /t/scripts/Lintian/Relation/07-implies.t
parentInitial commit. (diff)
downloadlintian-75808db17caf8b960b351e3408e74142f4c85aac.tar.xz
lintian-75808db17caf8b960b351e3408e74142f4c85aac.zip
Adding upstream version 2.117.0.upstream/2.117.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/scripts/Lintian/Relation/07-implies.t')
-rw-r--r--t/scripts/Lintian/Relation/07-implies.t46
1 files changed, 46 insertions, 0 deletions
diff --git a/t/scripts/Lintian/Relation/07-implies.t b/t/scripts/Lintian/Relation/07-implies.t
new file mode 100644
index 0000000..85c7f74
--- /dev/null
+++ b/t/scripts/Lintian/Relation/07-implies.t
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use Lintian::Relation;
+
+my @TESTS = (
+ # A, B, A->I(B), A->I_I(B), B->I(A), B->I_I(A), line
+ # - with "I" being "satisfies" and "I_I" being "satisfies_inverse".
+ ['foo (= 1.0)', 'foo (= 2.0)', 0, 1, 0, 1, __LINE__],
+ ['foo (>= 1.0)', 'foo (= 2.0)', 0, 0, 1, 0, __LINE__],
+ ['foo (>= 2.0)', 'foo (>= 1.0)', 1, 0, 0, 0, __LINE__],
+ ['foo (>> 1.0)', 'foo (>= 1.0)', 1, 0, 0, 0, __LINE__],
+ ['foo (>> 2.0)', 'foo (>> 1.0)', 1, 0, 0, 0, __LINE__],
+ ['foo (<= 1.0)', 'foo (<= 2.0)', 1, 0, 0, 0, __LINE__],
+ ['foo (<< 1.0)', 'foo (<= 1.0)', 1, 0, 0, 0, __LINE__],
+ ['foo (<< 1.0)', 'foo (<< 2.0)', 1, 0, 0, 0, __LINE__],
+);
+
+plan tests => scalar(@TESTS) * 4;
+
+for my $test (@TESTS) {
+ my ($a_raw, $b_raw, $a_i_b, $a_ii_b, $b_i_a, $b_ii_a, $lno) = @{$test};
+
+ my $relation_a = Lintian::Relation->new->load($a_raw);
+ my $relation_b = Lintian::Relation->new->load($b_raw);
+
+ is($relation_a->satisfies($relation_b),
+ $a_i_b, "$a_raw satisfies $b_raw (case 1, line $lno)");
+ is($relation_a->satisfies_inverse($relation_b),
+ $a_ii_b,"$test->[0] satisfies inverse $test->[1] (case 2, line $lno)");
+
+ is($relation_b->satisfies($relation_a),
+ $b_i_a,"$b_raw satisfies $a_raw (case 3, line $test->[6])");
+ is($relation_b->satisfies_inverse($relation_a),
+ $b_ii_a, "$b_raw satisfies inverse $a_raw (case 4, line $lno)");
+}
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et