finitclosure tests angepasst

This commit is contained in:
Florian Steurer 2016-03-29 19:07:54 +02:00
parent 23142adc70
commit 5030410978

View File

@ -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<T>) =
* { HashSet<T>, Set<T>, TreeSet<T>, LinkedHashSet<T>,
* HashSet<? ext T>, Set<? ext T>, TreeSet<? ext T>, LinkedHashSet<? ext T> }
* { HashSet<T>, Set<T>, TreeSet<T>, LinkedHashSet<T> }
*/
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<? ext T) =
* { HashSet<T>, Set<T>, TreeSet<T>, LinkedHashSet<T>,
* HashSet<? ext T>, Set<? ext T>, TreeSet<? ext T>, LinkedHashSet<? ext T> }
* TODO probleme wenn Set<? extends T> weil T auch in der Klassendeklaration class Set<T> verwendet wird.
* smaller(Set<? ext T1) =
* { HashSet<T1>, Set<T1>, TreeSet<T1>, LinkedHashSet<T1>,
* HashSet<? ext T1>, Set<? ext T1>, TreeSet<? ext T1>, LinkedHashSet<? ext T1> }
*
*/
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
}