From dcc387ff0f273230312e671e7f58c1191263d961 Mon Sep 17 00:00:00 2001
From: Johannes Mey <johannes.mey@tu-dresden.de>
Date: Thu, 17 Jan 2019 18:53:13 +0100
Subject: [PATCH] tests for eris

---
 .../mquat/solving/HandwrittenTestSuite.java   |  12 ++
 .../src/test/resources/test_eris_02.txt       |  59 +++++++++
 .../src/test/resources/test_eris_03.txt       |  59 +++++++++
 .../src/test/resources/test_eris_04.txt       | 116 ++++++++++++++++++
 4 files changed, 246 insertions(+)
 create mode 100644 jastadd-mquat-solver/src/test/resources/test_eris_02.txt
 create mode 100644 jastadd-mquat-solver/src/test/resources/test_eris_03.txt
 create mode 100644 jastadd-mquat-solver/src/test/resources/test_eris_04.txt

diff --git a/jastadd-mquat-solver/src/test/java/de/tudresden/inf/st/mquat/solving/HandwrittenTestSuite.java b/jastadd-mquat-solver/src/test/java/de/tudresden/inf/st/mquat/solving/HandwrittenTestSuite.java
index 83a3065..eb97289 100644
--- a/jastadd-mquat-solver/src/test/java/de/tudresden/inf/st/mquat/solving/HandwrittenTestSuite.java
+++ b/jastadd-mquat-solver/src/test/java/de/tudresden/inf/st/mquat/solving/HandwrittenTestSuite.java
@@ -208,4 +208,16 @@ public abstract class HandwrittenTestSuite {
     Assignment a0 = assertAssignment(modelAndSolution, 0, "ap4", "r0");
     Assignment a1 = assertAssignment(modelAndSolution, 1, "ap2", "r0");
   }
+
+  @Test
+  public void test_multi_eris_02() throws IOException, Parser.Exception, SolvingException {
+    Tuple<Root, Solution> modelAndSolution = loadAndSolve("test_eris_02.txt");
+    assertValidSolution(modelAndSolution);
+  }
+
+  @Test
+  public void test_multi_eris_04() throws IOException, Parser.Exception, SolvingException {
+    Tuple<Root, Solution> modelAndSolution = loadAndSolve("test_eris_04.txt");
+    assertValidSolution(modelAndSolution);
+  }
 }
diff --git a/jastadd-mquat-solver/src/test/resources/test_eris_02.txt b/jastadd-mquat-solver/src/test/resources/test_eris_02.txt
new file mode 100644
index 0000000..697cdd8
--- /dev/null
+++ b/jastadd-mquat-solver/src/test/resources/test_eris_02.txt
@@ -0,0 +1,59 @@
+
+container resource type AccessPath {
+    property dynamic [boolean]
+    property attributeCount [#]
+    property attributeNull [boolean]
+    property attributeUndefined [boolean]
+    property dynamicAttributeSize [boolean]
+    property indexAttributeCount [boolean]
+    property indexOrderPreserving [boolean]
+}
+
+
+resource ap1:AccessPath * 5 {
+    dynamic              = 0
+    attributeCount       = 1
+    attributeNull        = 0
+    attributeUndefined   = 0
+    dynamicAttributeSize = 0
+    indexAttributeCount  = 0
+    indexOrderPreserving = 0
+}
+
+resource ap2:AccessPath * 5 {
+    dynamic              = 0
+    attributeCount       = 999
+    attributeNull        = 1
+    attributeUndefined   = 1
+    dynamicAttributeSize = 0
+    indexAttributeCount  = 0
+    indexOrderPreserving = 0
+}
+
+
+
+property runtime [ms]
+
+meta scan
+
+
+component node0_lp0_10 {
+
+    using property runtime
+
+    contract ap1 {
+        requires resource access_pattern of type AccessPath with {
+        }
+        requiring access_pattern.attributeCount >= 1
+        requiring access_pattern.attributeNull = 1
+        providing runtime = (scan * 2.1)
+    }
+
+}
+
+
+request for node0_lp0_10 {
+    meta scan = 3
+}
+
+minimize sum(runtime)
diff --git a/jastadd-mquat-solver/src/test/resources/test_eris_03.txt b/jastadd-mquat-solver/src/test/resources/test_eris_03.txt
new file mode 100644
index 0000000..5066c4e
--- /dev/null
+++ b/jastadd-mquat-solver/src/test/resources/test_eris_03.txt
@@ -0,0 +1,59 @@
+
+container resource type AccessPathObject {
+    property dynamic [boolean]
+    property attributeCount [#]
+    property attributeNull [boolean]
+    property attributeUndefined [boolean]
+    property dynamicAttributeSize [boolean]
+    property indexAttributeCount [boolean]
+    property indexOrderPreserving [boolean]
+}
+
+
+resource ap1:AccessPathObject * 5 {
+    dynamic              = 0
+    attributeCount       = 1
+    attributeNull        = 0
+    attributeUndefined   = 0
+    dynamicAttributeSize = 0
+    indexAttributeCount  = 0
+    indexOrderPreserving = 0
+}
+
+resource ap2:AccessPathObject * 5 {
+    dynamic              = 0
+    attributeCount       = 999
+    attributeNull        = 1
+    attributeUndefined   = 1
+    dynamicAttributeSize = 0
+    indexAttributeCount  = 0
+    indexOrderPreserving = 0
+}
+
+
+
+property runtime [ms]
+
+meta scan
+
+
+component node0_lp0_10 {
+
+    using property runtime
+
+    contract ap1 {
+        requires resource access_pattern of type AccessPath with {
+        }
+        requiring access_pattern.attributeCount >= 1
+        requiring access_pattern.attributeNull = 1
+        providing runtime = (scan * 2.1)
+    }
+
+}
+
+
+request for node0_lp0_10 {
+    meta scan = 3
+}
+
+minimize sum(runtime)
diff --git a/jastadd-mquat-solver/src/test/resources/test_eris_04.txt b/jastadd-mquat-solver/src/test/resources/test_eris_04.txt
new file mode 100644
index 0000000..1f7f6b8
--- /dev/null
+++ b/jastadd-mquat-solver/src/test/resources/test_eris_04.txt
@@ -0,0 +1,116 @@
+
+container resource type ComputeNode {
+    // empty, just a dummy type
+}
+resource r0:ComputeNode * 5 {
+    // empty
+}
+
+property runtime [ms]
+property system [boolean]
+
+meta scan
+
+component lp0_node0_row0 {
+
+    using property runtime
+    using property system
+
+    contract ap1 {
+        requires resource compute_resource_0 of type ComputeNode with {
+            // no hardware requirements
+        }
+        providing runtime = (scan * 2.1)
+    }
+
+    contract ap2 {
+        requires resource compute_resource_0 of type ComputeNode with {
+            // no hardware requirements
+        }
+        providing runtime = 2
+    }
+
+    contract ap3 {
+        requires resource compute_resource_0 of type ComputeNode with {
+            // no hardware requirements
+        }
+        providing runtime = 7
+    }
+
+    contract ap4 {
+        requires resource compute_resource_0 of type ComputeNode with {
+            // no hardware requirements
+        }
+        providing runtime = 7
+        providing system = 1
+
+        providing attributeCount       = 1
+        providing attributeNull        = 0
+        providing attributeUndefined   = 0
+        providing dynamicAttributeSize = 0
+        providing indexAttributeCount  = 0
+        providing indexOrderPreserving = 0
+    }
+
+}
+
+component lp0_node0_row1 {
+
+    using property runtime
+    using property system
+
+    contract ap1 {
+        requires resource compute_resource_0 of type ComputeNode with {
+            // no hardware requirements
+        }
+        providing runtime = (scan * 2.1)
+    }
+
+    contract ap2 {
+        requires resource compute_resource_0 of type ComputeNode with {
+            // no hardware requirements
+        }
+        providing runtime = 2
+    }
+
+    contract ap3 {
+        requires resource compute_resource_0 of type ComputeNode with {
+            // no hardware requirements
+        }
+        providing runtime = 7
+    }
+
+    contract ap4 {
+        requires resource compute_resource_0 of type ComputeNode with {
+            // no hardware requirements
+        }
+        providing runtime = 7
+        providing system = 1
+
+        providing attributeCount       = 1
+        providing attributeNull        = 0
+        providing attributeUndefined   = 0
+        providing dynamicAttributeSize = 0
+        providing indexAttributeCount  = 0
+        providing indexOrderPreserving = 0
+    }
+
+}
+
+request for lp0_node0_row0 {
+    requiring system = 1
+    meta scan = 3
+}
+request for lp0_node0_row0 {
+    meta scan = 3
+}
+
+request for lp0_node0_row1 {
+    requiring system = 1
+    meta scan = 2
+}
+request for lp0_node0_row1 {
+    meta scan = 2
+}
+
+minimize sum(runtime)
-- 
GitLab