read me terminé + nouveau test
This commit is contained in:
@@ -3,7 +3,7 @@ package src.fr.test;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -43,6 +43,7 @@ public class test {
|
||||
PartType IH= new PartTypeImpl("IH", Interior);
|
||||
PartType IS= new PartTypeImpl("IS", Interior);
|
||||
|
||||
|
||||
CompatibilityManager cm;
|
||||
|
||||
|
||||
@@ -208,6 +209,27 @@ public class test {
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(ED110));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_contradiction(){
|
||||
CompatibilityManager cm2 = new CompatibilityManagerImpl();
|
||||
PartType eg= new PartTypeImpl("Eg", Engine);
|
||||
PartType tr= new PartTypeImpl("Tr", Transmission);
|
||||
|
||||
Set<PartType> egIncompatibilities = new HashSet<PartType>();
|
||||
egIncompatibilities.add(tr);
|
||||
cm.addIncompatibilities(eg, egIncompatibilities);
|
||||
|
||||
Set<PartType> efRequirement = new HashSet<PartType>();
|
||||
efRequirement.add(eg);
|
||||
cm.addRequirements(tr, efRequirement);
|
||||
|
||||
|
||||
assertFalse(cm.getIncompatibilities(eg).contains(eg));
|
||||
assertTrue(cm.getRequirements(tr).contains(eg));
|
||||
assertTrue(cm.getIncompatibilities(tr).contains(tr)); //tr Require eg, eg Incompatible tr, -> eg Incompatible eg
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isComplete_empty_config(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
@@ -285,4 +307,29 @@ public class test {
|
||||
assertFalse(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_contradiction_config(){
|
||||
CompatibilityManager cm2 = new CompatibilityManagerImpl();
|
||||
PartType eg= new PartTypeImpl("Eg", Engine);
|
||||
PartType tr= new PartTypeImpl("Tr", Transmission);
|
||||
PartType ex= new PartTypeImpl("Ex", Exterior);
|
||||
PartType in= new PartTypeImpl("In", Interior);
|
||||
|
||||
Set<PartType> egIncompatibilities = new HashSet<PartType>();
|
||||
egIncompatibilities.add(tr);
|
||||
cm.addIncompatibilities(eg, egIncompatibilities);
|
||||
|
||||
Set<PartType> efRequirement = new HashSet<PartType>();
|
||||
efRequirement.add(eg);
|
||||
cm.addRequirements(eg, efRequirement);
|
||||
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(eg);
|
||||
config1.selectPart(tr);
|
||||
config1.selectPart(ex);
|
||||
config1.selectPart(in);
|
||||
|
||||
assertFalse(config1.isValid());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user