[PPL-devel] [GIT] ppl/ppl(master): Added a test for operator-(var, expr) and operator-( expr, var).

Enea Zaffanella zaffanella at cs.unipr.it
Sun Mar 22 19:43:56 CET 2009


Module: ppl/ppl
Branch: master
Commit: 19f0a1a2a915daddcbbcfea41844d51049eed5ae
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=19f0a1a2a915daddcbbcfea41844d51049eed5ae

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Sun Mar 22 19:05:01 2009 +0100

Added a test for operator-(var, expr) and operator-(expr, var).

---

 tests/Polyhedron/linearexpression1.cc |   42 +++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/tests/Polyhedron/linearexpression1.cc b/tests/Polyhedron/linearexpression1.cc
index 84a7f16..b980221 100644
--- a/tests/Polyhedron/linearexpression1.cc
+++ b/tests/Polyhedron/linearexpression1.cc
@@ -87,9 +87,51 @@ test02() {
   return ok1 && ok2;
 }
 
+bool
+test03() {
+  Variable A(15);
+  Variable B(10);
+
+  Linear_Expression e1 = A;
+  Linear_Expression e2 = B;
+
+  Linear_Expression known_result1 = e1 - e2;
+
+  bool ok1 = EQUIVALENT(A - B, known_result1)
+    && EQUIVALENT(Linear_Expression(A) - B, known_result1)
+    && EQUIVALENT(A - Linear_Expression(B), known_result1)
+    && EQUIVALENT(Linear_Expression(A) - Linear_Expression(B), known_result1);
+
+  nout << "*** known_result1 ***" << endl
+       << known_result1 << endl;
+
+  Linear_Expression known_result2 = e2 - e1;
+
+  bool ok2 = EQUIVALENT(B - A, known_result2)
+    && EQUIVALENT(Linear_Expression(B) - A, known_result2)
+    && EQUIVALENT(B - Linear_Expression(A), known_result2)
+    && EQUIVALENT(Linear_Expression(B) - Linear_Expression(A), known_result2);
+
+  nout << "*** known_result2 ***" << endl
+       << known_result2 << endl;
+
+  Linear_Expression known_result3 = e1 - e1;
+
+  bool ok3 = EQUIVALENT(A - A, known_result3)
+    && EQUIVALENT(Linear_Expression(A) - A, known_result3)
+    && EQUIVALENT(A - Linear_Expression(A), known_result3)
+    && EQUIVALENT(Linear_Expression(A) - Linear_Expression(A), known_result3);
+
+  nout << "*** known_result3 ***" << endl
+       << known_result3 << endl;
+
+  return ok1 && ok2 && ok3;
+}
+
 } // namespace
 
 BEGIN_MAIN
   DO_TEST(test01);
   DO_TEST(test02);
+  DO_TEST(test03);
 END_MAIN




More information about the PPL-devel mailing list