[PPL-devel] [GIT] ppl/ppl(master): Expected result adapted to the different types of coefficients.
Roberto Bagnara
bagnara at cs.unipr.it
Sun May 3 15:19:43 CEST 2009
Module: ppl/ppl
Branch: master
Commit: 56888c3225c8fc78186bb4428cd1a50b1541c796
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=56888c3225c8fc78186bb4428cd1a50b1541c796
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Sun May 3 15:19:10 2009 +0200
Expected result adapted to the different types of coefficients.
---
tests/Octagonal_Shape/wrap1.cc | 45 +++++++++++++++++++++++++++------------
1 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/tests/Octagonal_Shape/wrap1.cc b/tests/Octagonal_Shape/wrap1.cc
index 502b2e9..6cc6e8f 100644
--- a/tests/Octagonal_Shape/wrap1.cc
+++ b/tests/Octagonal_Shape/wrap1.cc
@@ -39,17 +39,24 @@ test01() {
oct.wrap_assign(vars, BITS_8, UNSIGNED, OVERFLOW_WRAPS);
- print_constraints(oct, "*** oct.wrap_assign() ***");
-
TOctagonal_Shape known_result(2);
- known_result.refine_with_constraint(x >= 0);
- known_result.refine_with_constraint(x <= 255);
- known_result.refine_with_constraint(y >= 64);
- known_result.refine_with_constraint(y <= 192);
- known_result.refine_with_constraint(+x-y <= 160);
- known_result.refine_with_constraint(-x+y <= 160);
- known_result.refine_with_constraint(+x+y >= 96);
- known_result.refine_with_constraint(+x+y <= 416);
+ typedef TOctagonal_Shape::coefficient_type T;
+ if (!std::numeric_limits<T>::is_bounded
+ || (std::numeric_limits<T>::max() >= 510
+ && std::numeric_limits<T>::min() <= -510)) {
+ known_result.refine_with_constraint(x >= 0);
+ known_result.refine_with_constraint(x <= 255);
+ known_result.refine_with_constraint(y >= 64);
+ known_result.refine_with_constraint(y <= 192);
+ known_result.refine_with_constraint(+x-y <= 160);
+ known_result.refine_with_constraint(-x+y <= 160);
+ known_result.refine_with_constraint(+x+y >= 96);
+ known_result.refine_with_constraint(+x+y <= 416);
+ }
+ else {
+ known_result.refine_with_constraint(x >= 0);
+ known_result.refine_with_constraint(y >= 0);
+ }
bool ok = (oct == known_result);
@@ -77,10 +84,20 @@ test02() {
oct.wrap_assign(vars, BITS_8, UNSIGNED, OVERFLOW_WRAPS, &cs);
TOctagonal_Shape known_result(2);
- known_result.refine_with_constraint(x >= 0);
- known_result.refine_with_constraint(y >= 96);
- known_result.refine_with_constraint(-x+y >= 96);
- known_result.refine_with_constraint(+x+y <= 160);
+ typedef TOctagonal_Shape::coefficient_type_base T;
+ if (!std::numeric_limits<T>::is_bounded
+ || (std::numeric_limits<T>::max() >= 510
+ && std::numeric_limits<T>::min() <= -510)) {
+ known_result.refine_with_constraint(x >= 0);
+ known_result.refine_with_constraint(y >= 96);
+ known_result.refine_with_constraint(-x+y >= 96);
+ known_result.refine_with_constraint(+x+y <= 160);
+ }
+ else {
+ known_result.refine_with_constraint(x >= 0);
+ known_result.refine_with_constraint(y >= 0);
+ known_result.refine_with_constraint(+x-y <= 0);
+ }
bool ok = (oct == known_result);
More information about the PPL-devel
mailing list