[PPL-devel] [GIT] ppl/ppl(master): Added tests showing a bug in method contains() of weakly-relational shapes.
Enea Zaffanella
zaffanella at cs.unipr.it
Wed May 23 16:36:34 CEST 2012
Module: ppl/ppl
Branch: master
Commit: 5e45d91a1e7eec00093fb90902f3394c9b183935
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=5e45d91a1e7eec00093fb90902f3394c9b183935
Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date: Wed May 23 16:23:01 2012 +0200
Added tests showing a bug in method contains() of weakly-relational shapes.
Method returns a wrong result when the shape is empty and the other
argument is not empty. Tests are based on a bug report from Gianluca Amato.
---
tests/BD_Shape/contains1.cc | 19 +++++++++++++++++++
tests/Octagonal_Shape/contains1.cc | 29 ++++++++++++++++++++++++++---
2 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/tests/BD_Shape/contains1.cc b/tests/BD_Shape/contains1.cc
index 36e2c4f..e434d97 100644
--- a/tests/BD_Shape/contains1.cc
+++ b/tests/BD_Shape/contains1.cc
@@ -172,6 +172,24 @@ test06() {
return !contained;
}
+bool
+test07() {
+ TBD_Shape bds1(3, EMPTY);
+
+ print_constraints(bds1, "*** bds1 ***");
+
+ TBD_Shape bds2(3, UNIVERSE);
+
+ print_constraints(bds2, "*** bds2 ***");
+
+ bool contained = bds1.contains(bds2);
+
+ nout << "*** bds1.contains(bds2) ***" << endl;
+ nout << (contained ? "true" : "false") << endl;
+
+ return !contained;
+}
+
} // namespace
BEGIN_MAIN
@@ -181,4 +199,5 @@ BEGIN_MAIN
DO_TEST(test04);
DO_TEST(test05);
DO_TEST(test06);
+ DO_TEST(test07);
END_MAIN
diff --git a/tests/Octagonal_Shape/contains1.cc b/tests/Octagonal_Shape/contains1.cc
index 21b7c5a..649f3ea 100644
--- a/tests/Octagonal_Shape/contains1.cc
+++ b/tests/Octagonal_Shape/contains1.cc
@@ -245,20 +245,24 @@ test07() {
bool
test08() {
- TOctagonal_Shape oc1(0);
+ TOctagonal_Shape oc1(3, UNIVERSE);
print_constraints(oc1, "*** oc1 ***");
- TOctagonal_Shape oc2(0, EMPTY);
+ TOctagonal_Shape oc2(3, EMPTY);
print_constraints(oc2, "*** oc2 ***");
bool contained = oc1.contains(oc2);
+ bool strictly_contained = oc1.strictly_contains(oc2);
nout << "*** oc1.contains(oc2) ***" << endl;
nout << (contained ? "true" : "false") << endl;
- return contained;
+ nout << "*** oc1.strictly_contains(oc2) ***" << endl;
+ nout << (strictly_contained ? "true" : "false") << endl;
+
+ return contained && strictly_contained;
}
bool
@@ -333,6 +337,24 @@ test11() {
return !contained;
}
+bool
+test12() {
+ TOctagonal_Shape oc1(3, EMPTY);
+
+ print_constraints(oc1, "*** oc1 ***");
+
+ TOctagonal_Shape oc2(3, UNIVERSE);
+
+ print_constraints(oc2, "*** oc2 ***");
+
+ bool contained = oc1.contains(oc2);
+
+ nout << "*** oc1.contains(oc2) ***" << endl;
+ nout << (contained ? "true" : "false") << endl;
+
+ return !contained;
+}
+
} // namespace
BEGIN_MAIN
@@ -347,4 +369,5 @@ BEGIN_MAIN
DO_TEST(test09);
DO_TEST(test10);
DO_TEST(test11);
+ DO_TEST(test12);
END_MAIN
More information about the PPL-devel
mailing list