forked from JavaTX/JavaCompilerCore
finitclosure tests angepasst
This commit is contained in:
parent
23142adc70
commit
5030410978
@ -98,10 +98,8 @@ public class FiniteClosureTest {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Test Case 4:
|
* Test Case 4:
|
||||||
* TODO ist das ergebnis korrekt oder müssen die ? ext Ts raus weil der allgemeienste Typ T ausreicht?
|
|
||||||
* smaller(Set<T>) =
|
* smaller(Set<T>) =
|
||||||
* { HashSet<T>, Set<T>, TreeSet<T>, LinkedHashSet<T>,
|
* { HashSet<T>, Set<T>, TreeSet<T>, LinkedHashSet<T> }
|
||||||
* HashSet<? ext T>, Set<? ext T>, TreeSet<? ext T>, LinkedHashSet<? ext T> }
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Type t = tf.getPlaceholderType("T");
|
Type t = tf.getPlaceholderType("T");
|
||||||
@ -109,14 +107,9 @@ public class FiniteClosureTest {
|
|||||||
Type hashSetT = tf.getSimpleType("HashSet", t);
|
Type hashSetT = tf.getSimpleType("HashSet", t);
|
||||||
Type treeSetT = tf.getSimpleType("TreeSet", t);
|
Type treeSetT = tf.getSimpleType("TreeSet", t);
|
||||||
Type linkedHashSetT = tf.getSimpleType("LinkedHashSet", 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[] {
|
expectedResult = new HashSet<>(Arrays.stream(new Type[] {
|
||||||
setT, hashSetT, treeSetT, linkedHashSetT,
|
setT, hashSetT, treeSetT, linkedHashSetT
|
||||||
setExtT, hashSetExtT, treeSetExtT, linkedHashSetExtT
|
|
||||||
}).collect(Collectors.toSet()));
|
}).collect(Collectors.toSet()));
|
||||||
|
|
||||||
Assert.assertEquals(expectedResult, fc.smaller(setT));
|
Assert.assertEquals(expectedResult, fc.smaller(setT));
|
||||||
@ -153,19 +146,28 @@ public class FiniteClosureTest {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Test Case 6:
|
* Test Case 6:
|
||||||
*
|
* TODO probleme wenn Set<? extends T> weil T auch in der Klassendeklaration class Set<T> verwendet wird.
|
||||||
* smaller(Set<? ext T) =
|
* smaller(Set<? ext T1) =
|
||||||
* { HashSet<T>, Set<T>, TreeSet<T>, LinkedHashSet<T>,
|
* { HashSet<T1>, Set<T1>, TreeSet<T1>, LinkedHashSet<T1>,
|
||||||
* HashSet<? ext T>, Set<? ext T>, TreeSet<? ext T>, LinkedHashSet<? ext T> }
|
* 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[] {
|
expectedResult = new HashSet<>(Arrays.stream(new Type[] {
|
||||||
setT, hashSetT, treeSetT, linkedHashSetT,
|
setT1, hashSetT1, treeSetT1, linkedHashSetT1,
|
||||||
setExtT, hashSetExtT, treeSetExtT, linkedHashSetExtT
|
setExtT1, hashSetExtT1, treeSetExtT1, linkedHashSetExtT1
|
||||||
}).collect(Collectors.toSet()));
|
}).collect(Collectors.toSet()));
|
||||||
|
|
||||||
Assert.assertEquals(expectedResult, fc.smaller(setExtT));
|
Assert.assertEquals(expectedResult, fc.smaller(setExtT1));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test Case 7:
|
* Test Case 7:
|
||||||
@ -656,7 +658,6 @@ public class FiniteClosureTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetGenericType() {
|
public void testGetGenericType() {
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user