From 50304109782e46e8d7826096dd6f1a68c7d9c9e8 Mon Sep 17 00:00:00 2001 From: Florian Steurer Date: Tue, 29 Mar 2016 19:07:54 +0200 Subject: [PATCH] finitclosure tests angepasst --- test/unify/FiniteClosureTest.java | 37 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/test/unify/FiniteClosureTest.java b/test/unify/FiniteClosureTest.java index 7322e857..6512243c 100644 --- a/test/unify/FiniteClosureTest.java +++ b/test/unify/FiniteClosureTest.java @@ -98,10 +98,8 @@ public class FiniteClosureTest { /* * Test Case 4: - * TODO ist das ergebnis korrekt oder müssen die ? ext Ts raus weil der allgemeienste Typ T ausreicht? * smaller(Set) = - * { HashSet, Set, TreeSet, LinkedHashSet, - * HashSet, Set, TreeSet, LinkedHashSet } + * { HashSet, Set, TreeSet, LinkedHashSet } */ Type t = tf.getPlaceholderType("T"); @@ -109,14 +107,9 @@ public class FiniteClosureTest { Type hashSetT = tf.getSimpleType("HashSet", t); Type treeSetT = tf.getSimpleType("TreeSet", t); Type linkedHashSetT = tf.getSimpleType("LinkedHashSet", t); - Type hashSetExtT = tf.getSimpleType("HashSet", t); - Type treeSetExtT = tf.getSimpleType("TreeSet", t); - Type linkedHashSetExtT = tf.getSimpleType("LinkedHashSet", t); - Type setExtT = tf.getSimpleType("Set", t); expectedResult = new HashSet<>(Arrays.stream(new Type[] { - setT, hashSetT, treeSetT, linkedHashSetT, - setExtT, hashSetExtT, treeSetExtT, linkedHashSetExtT + setT, hashSetT, treeSetT, linkedHashSetT }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setT)); @@ -153,19 +146,28 @@ public class FiniteClosureTest { /* * Test Case 6: - * - * smaller(Set, Set, TreeSet, LinkedHashSet, - * HashSet, Set, TreeSet, LinkedHashSet } + * TODO probleme wenn Set weil T auch in der Klassendeklaration class Set verwendet wird. + * smaller(Set, Set, TreeSet, LinkedHashSet, + * HashSet, Set, TreeSet, LinkedHashSet } * */ - + Type t1 = tf.getPlaceholderType("T1"); + Type extT1 = tf.getExtendsType(t1); + Type setExtT1 = tf.getSimpleType("Set", extT1); + Type hashSetExtT1 = tf.getSimpleType("HashSet", extT1); + Type treeSetExtT1 = tf.getSimpleType("TreeSet", extT1); + Type linkedHashSetExtT1 = tf.getSimpleType("LinkedHashSet", extT1); + Type setT1 = tf.getSimpleType("Set", t1); + Type hashSetT1 = tf.getSimpleType("HashSet", t1); + Type treeSetT1 = tf.getSimpleType("TreeSet", t1); + Type linkedHashSetT1 = tf.getSimpleType("LinkedHashSet", t1); expectedResult = new HashSet<>(Arrays.stream(new Type[] { - setT, hashSetT, treeSetT, linkedHashSetT, - setExtT, hashSetExtT, treeSetExtT, linkedHashSetExtT + setT1, hashSetT1, treeSetT1, linkedHashSetT1, + setExtT1, hashSetExtT1, treeSetExtT1, linkedHashSetExtT1 }).collect(Collectors.toSet())); - Assert.assertEquals(expectedResult, fc.smaller(setExtT)); + Assert.assertEquals(expectedResult, fc.smaller(setExtT1)); /* * Test Case 7: @@ -656,7 +658,6 @@ public class FiniteClosureTest { @Test public void testGetGenericType() { - // TODO }