forked from JavaTX/JavaCompilerCore
82 lines
2.2 KiB
Java
82 lines
2.2 KiB
Java
package KomplexeMenge;
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
import de.dhbwstuttgart.typeinference.Menge;
|
|
import de.dhbwstuttgart.typeinference.OderMenge;
|
|
import de.dhbwstuttgart.typeinference.UndMenge;
|
|
|
|
public class KarthesischesProduktTest {
|
|
|
|
@Test
|
|
public void test() {
|
|
OderMenge<String> oM1 = new OderMenge<>();
|
|
OderMenge<String> oM2 = new OderMenge<>();
|
|
UndMenge<String> oM3 = new UndMenge<>();
|
|
oM1.addItem("Menge 1, Item 1");
|
|
oM1.addItem("Menge 1, Item 2");
|
|
oM2.addItem("Menge 2, Item 1");
|
|
oM2.addItem("Menge 2, Item 2");
|
|
oM3.addItems(oM1);
|
|
oM3.addItems(oM2);
|
|
System.out.println(oM3.cartesianProduct());
|
|
assertTrue(oM3.cartesianProduct().size()==4);
|
|
}
|
|
|
|
@Test
|
|
public void test2(){
|
|
UndMenge<String> oM1 = new UndMenge<>();
|
|
UndMenge<String> oM2 = new UndMenge<>();
|
|
UndMenge<String> oM3 = new UndMenge<>();
|
|
oM1.addItem("Menge 1, Item 1");
|
|
oM1.addItem("Menge 1, Item 2");
|
|
oM2.addItem("Menge 2, Item 1");
|
|
oM2.addItem("Menge 2, Item 2");
|
|
oM3.addItems(oM1);
|
|
oM3.addItems(oM2);
|
|
System.out.println("undMenge:"+oM3.cartesianProduct());
|
|
assertTrue(oM3.cartesianProduct().size()==1);
|
|
}
|
|
|
|
@Test
|
|
public void test3(){
|
|
OderMenge<String> oM1 = new OderMenge<>();
|
|
UndMenge<String> oM2 = new UndMenge<>();
|
|
UndMenge<String> oM3 = new UndMenge<>();
|
|
oM1.addItem("Menge 1, Item 1");
|
|
oM1.addItem("Menge 1, Item 2");
|
|
oM2.addItem("Menge 2, Item 1");
|
|
oM2.addItem("Menge 2, Item 2");
|
|
oM3.addItems(oM1);
|
|
oM3.addItems(oM2);
|
|
//System.out.println("undMenge:"+oM3.cartesianProduct());
|
|
assertTrue(oM3.cartesianProduct().size()==2);
|
|
}
|
|
|
|
@Test
|
|
public void test4(){
|
|
OderMenge<String> oM1 = new OderMenge<>();
|
|
UndMenge<String> oM2 = new UndMenge<>();
|
|
UndMenge<String> oM3 = new UndMenge<>();
|
|
oM2.addItem("Menge 2, Item 1");
|
|
oM2.addItem("Menge 2, Item 2");
|
|
oM3.addItems(oM1);
|
|
oM3.addItems(oM2);
|
|
//System.out.println("undMenge:"+oM3.cartesianProduct());
|
|
assertTrue(oM3.cartesianProduct().size()==0);
|
|
}
|
|
|
|
@Test
|
|
public void test5(){
|
|
OderMenge<String> oM1 = new OderMenge<>();
|
|
UndMenge<String> oM2 = new UndMenge<>();
|
|
UndMenge<String> oM3 = new UndMenge<>();
|
|
oM3.addItems(oM1);
|
|
oM3.addItems(oM2);
|
|
//System.out.println("undMenge:"+oM3.cartesianProduct());
|
|
assertTrue(oM3.cartesianProduct().size()==0);
|
|
}
|
|
}
|