[PPL-devel] [GIT] ppl/ppl(master): Added Java interface tests for termination_test_MS,
Patricia Hill
p.m.hill at leeds.ac.uk
Tue Mar 30 12:32:18 CEST 2010
Module: ppl/ppl
Branch: master
Commit: d083ca77b75e1ddf570221c57680a00cd0a35b52
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=d083ca77b75e1ddf570221c57680a00cd0a35b52
Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date: Tue Mar 30 11:30:48 2010 +0100
Added Java interface tests for termination_test_MS,
termination_test_PR, termination_test_MS_2 and
termination_test_PR_2
---
interfaces/Java/tests/NNC_Polyhedron_test1.java | 31 ++++++++++++++++++++
.../ppl_interface_generator_java_test_java_code.m4 | 26 ++++++++++++++++
2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/interfaces/Java/tests/NNC_Polyhedron_test1.java b/interfaces/Java/tests/NNC_Polyhedron_test1.java
index d3efe92..4de59cb 100644
--- a/interfaces/Java/tests/NNC_Polyhedron_test1.java
+++ b/interfaces/Java/tests/NNC_Polyhedron_test1.java
@@ -82,6 +82,37 @@ static {
return cs.isEmpty();
}
+ public static boolean test03() {
+ // Test termination methods.
+ Variable X1 = new Variable(0);
+ Variable X2 = new Variable(1);
+ Variable XP1 = new Variable(2);
+ Variable XP2 = new Variable(3);
+ NNC_Polyhedron ph = new NNC_Polyhedron(4, Degenerate_Element.UNIVERSE);
+ Coefficient coeff_1 = new Coefficient(1);
+ Coefficient coeff_0 = new Coefficient(0);
+ Linear_Expression le_X1 = new Linear_Expression_Variable(X1);
+ Linear_Expression le_X2 = new Linear_Expression_Variable(X2);
+ Linear_Expression le_XP1 = new Linear_Expression_Variable(XP1);
+ Linear_Expression le_XP2 = new Linear_Expression_Variable(XP2);
+ Linear_Expression le_1 = new Linear_Expression_Coefficient(coeff_1);
+ Linear_Expression le_0 = new Linear_Expression_Coefficient(coeff_0);
+ Linear_Expression le_X1_difference_XP1 = le_X1.sum(le_XP1);
+ Constraint c_XP2_eq_1
+ = new Constraint(le_XP2, Relation_Symbol.EQUAL, le_1);
+ Constraint c_X1_geq_1
+ = new Constraint(le_X1, Relation_Symbol.GREATER_OR_EQUAL, le_1);
+ Constraint c_X1_minus_XP1_geq_1
+ = new Constraint(le_X1_difference_XP1, Relation_Symbol.GREATER_OR_EQUAL, le_1);
+ Constraint c_X2_leq_0
+ = new Constraint(le_X2, Relation_Symbol.LESS_OR_EQUAL, le_0);
+ ph.add_constraint(c_XP2_eq_1);
+ ph.add_constraint(c_X1_geq_1);
+ ph.add_constraint(c_X1_minus_XP1_geq_1);
+ ph.add_constraint(c_X2_leq_0);
+ return Termination.termination_test_MS_NNC_Polyhedron(ph);
+ }
+
public static void main(String[] args) {
Parma_Polyhedra_Library.initialize_library();
boolean test_result_ok =
diff --git a/interfaces/Java/tests/ppl_interface_generator_java_test_java_code.m4 b/interfaces/Java/tests/ppl_interface_generator_java_test_java_code.m4
index 764edf5..f605d58 100644
--- a/interfaces/Java/tests/ppl_interface_generator_java_test_java_code.m4
+++ b/interfaces/Java/tests/ppl_interface_generator_java_test_java_code.m4
@@ -897,4 +897,30 @@ m4_define(`ppl_free_ at CLASS@_code',
')
+m4_define(`ppl_termination_test_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS at _codexxx',
+ `dnl
+{
+ PPL_Test.print_if_noisy("Testing termination_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS@: ");
+ @TOPOLOGY@@CLASS@ gd1 = new @TOPOLOGY@@CLASS@(@CONSTRAINER at s1);
+ boolean term = Termination.termination_test_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS@(gd1);
+ report_success_or_failure(gd1.OK() && term);
+ gd1.free();
+}
+
+')
+
+m4_define(`ppl_termination_test_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS at _2_codexxx',
+ `dnl
+{
+ PPL_Test.print_if_noisy("Testing termination_test_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS@: ");
+ @TOPOLOGY@@CLASS@ gd1 = new @TOPOLOGY@@CLASS@(@CONSTRAINER at s1);
+ @TOPOLOGY@@CLASS@ gd2 = new @TOPOLOGY@@CLASS@(@CONSTRAINER at s2);
+ boolean term = Termination.termination_test_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS at _2(gd1, gd2);
+ report_success_or_failure(gd1.OK() && gd2.OK() && term);
+ gd1.free();
+ gd2.free();
+}
+
+')
+
m4_divert`'dnl
More information about the PPL-devel
mailing list