test V1
This commit is contained in:
@@ -99,8 +99,121 @@ public class test {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test_1_Incompatibilities_1(){
|
||||
assertTrue(true);
|
||||
public void test_Incompatibilities_Simple_1(){
|
||||
assertTrue(cm.getIncompatibilities(TA5.getType()).contains(EG100.getType()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void test_multiple_Incompatibilities_Simple_2(){
|
||||
assertTrue(
|
||||
cm.getIncompatibilities(TSF7.getType()).contains(EG100.getType())&&
|
||||
cm.getIncompatibilities(TSF7.getType()).contains(EG133.getType())&&
|
||||
cm.getIncompatibilities(TSF7.getType()).contains(ED110.getType())
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Requirements_3(){
|
||||
assertTrue(cm.getRequirements(EH120.getType()).contains(TC120.getType()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* A <-> B
|
||||
* if A -> B then B -> A
|
||||
*/
|
||||
@Test
|
||||
public void test_Incompatibilities_Complex_4(){
|
||||
System.out.println("size EG100 incompatibilities : "+cm.getIncompatibilities(EG100.getType()).size());
|
||||
assertTrue(cm.getIncompatibilities(EG100.getType()).contains(IS.getType()));
|
||||
assertTrue(cm.getIncompatibilities(EG100.getType()).contains(XS.getType()));
|
||||
}
|
||||
|
||||
/*
|
||||
* if A require B
|
||||
* then A is incompatible with all incompatible of B
|
||||
*/
|
||||
@Test
|
||||
public void test_Require_Incompatibilities_Complex_5(){
|
||||
assertTrue(cm.getIncompatibilities(XS.getType()).contains(EG100.getType()));
|
||||
System.out.println("size XS incompatibilities : " + cm.getIncompatibilities(XS.getType()).size());
|
||||
assertTrue(cm.getIncompatibilities(XS.getType()).contains(TM5.getType()));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Require Require Require
|
||||
* if A -> B && B -> C then A -> C
|
||||
*/
|
||||
@Test
|
||||
public void test_Incompatibilities_Complex_7(){
|
||||
cm.addRequirements(TC120.getType(), Set.of(XC.getType()));
|
||||
assertTrue(cm.getRequirements(TC120.getType()).contains(XC.getType()));
|
||||
assertTrue(cm.getRequirements(EH120.getType()).contains(XC.getType()));
|
||||
cm.removeRequirement(TC120.getType(), XC.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Empty_Requirements_5(){
|
||||
assertTrue(cm.getRequirements(ED180.getType()).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Remove_and_restore_Incompatibilities_6(){
|
||||
assertTrue(cm.getIncompatibilities(XM.getType()).contains(EG100.getType()));
|
||||
cm.removeIncompatibility(XM.getType(), EG100.getType());
|
||||
assertFalse(cm.getIncompatibilities(XM.getType()).contains(EG100.getType()));
|
||||
Set<PartType> setEG100 = new HashSet<PartType>();
|
||||
setEG100.add(EG100.getType());
|
||||
cm.addIncompatibilities(XM.getType(), setEG100);
|
||||
assertTrue(cm.getIncompatibilities(XM.getType()).contains(EG100.getType()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Remove_Empty_7(){
|
||||
assertTrue(cm.getIncompatibilities(EH120.getType()).isEmpty());
|
||||
cm.removeIncompatibility(EH120.getType(), EG100.getType());
|
||||
assertTrue(cm.getIncompatibilities(EH120.getType()).isEmpty()); }
|
||||
|
||||
@Test
|
||||
public void test_Remove_and_restore_Requirements_8(){
|
||||
assertTrue(cm.getRequirements(EH120.getType()).contains(TC120.getType()));
|
||||
cm.removeRequirement(EH120.getType(), TC120.getType());
|
||||
assertFalse(cm.getRequirements(EH120.getType()).contains(TC120.getType()));
|
||||
Set<PartType> setTC120 = new HashSet<PartType>();
|
||||
setTC120.add(TC120.getType());
|
||||
cm.addRequirements(EH120.getType(), setTC120);
|
||||
assertTrue(cm.getRequirements(EH120.getType()).contains(TC120.getType()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_remove_incompatibilities_but_no_removable(){
|
||||
assertTrue(cm.getIncompatibilities(EG100.getType()).contains(IS.getType()));
|
||||
cm.removeIncompatibility(EG100.getType(), IS.getType());
|
||||
assertTrue(cm.getIncompatibilities(EG100.getType()).contains(IS.getType()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Add_and_restore_Incompatibilities_9(){
|
||||
assertTrue(cm.getIncompatibilities(TSF7.getType()).contains(EG100.getType()));
|
||||
assertTrue(cm.getIncompatibilities(TSF7.getType()).contains(EG133.getType()));
|
||||
assertTrue(cm.getIncompatibilities(TSF7.getType()).contains(ED110.getType()));
|
||||
cm.removeIncompatibility(TSF7.getType(), EG100.getType());
|
||||
assertFalse(cm.getIncompatibilities(TSF7.getType()).contains(EG100.getType()));
|
||||
assertTrue(cm.getIncompatibilities(TSF7.getType()).contains(EG133.getType()));
|
||||
assertTrue(cm.getIncompatibilities(TSF7.getType()).contains(ED110.getType()));
|
||||
Set<PartType> setEG100 = new HashSet<PartType>();
|
||||
setEG100.add(EG100.getType());
|
||||
cm.addIncompatibilities(TSF7.getType(), setEG100);
|
||||
assertTrue(cm.getIncompatibilities(TSF7.getType()).contains(EG100.getType()));
|
||||
assertTrue(cm.getIncompatibilities(TSF7.getType()).contains(EG133.getType()));
|
||||
assertTrue(cm.getIncompatibilities(TSF7.getType()).contains(ED110.getType()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user