Search in sources :

Example 1 with RuleGoalAssumption

use of de.be4.classicalb.core.parser.rules.RulesMachineRunConfiguration.RuleGoalAssumption in project probparsers by bendisposto.

the class RulesMachineFilesTest method testRulesMachineConfiguration.

@Test
public void testRulesMachineConfiguration() throws Exception {
    File file = new File("src/test/resources/rules/project/RulesMachineConfigurationTest.rmch");
    ParsingBehaviour parsingBehaviour = new ParsingBehaviour();
    parsingBehaviour.setAddLineNumbers(true);
    parsingBehaviour.setPrologOutput(true);
    RulesProject project = new RulesProject();
    project.parseProject(file);
    project.checkAndTranslateProject();
    RulesMachineRunConfiguration rulesMachineRunConfiguration = project.getRulesMachineRunConfiguration();
    Set<RuleGoalAssumption> rulesGoalAssumptions = rulesMachineRunConfiguration.getRulesGoalAssumptions();
    assertEquals(2, rulesGoalAssumptions.size());
    for (Iterator<RuleGoalAssumption> iterator = rulesGoalAssumptions.iterator(); iterator.hasNext(); ) {
        RuleGoalAssumption next = iterator.next();
        if ("rule1".equals(next.getRuleName())) {
            assertEquals(new HashSet<Integer>(Arrays.asList(1)), next.getErrorTypesAssumedToSucceed());
            assertEquals(true, next.isCheckedForCounterexamples());
            assertEquals("rule1", next.getRuleOperation().getName());
        } else {
            assertEquals("rule2", next.getRuleName());
            assertEquals(new HashSet<Integer>(Arrays.asList(1)), next.getErrorTypesAssumedToFail());
            assertEquals(false, next.isCheckedForCounterexamples());
        }
    }
}
Also used : RuleGoalAssumption(de.be4.classicalb.core.parser.rules.RulesMachineRunConfiguration.RuleGoalAssumption) File(java.io.File) ParsingBehaviour(de.be4.classicalb.core.parser.ParsingBehaviour) Test(org.junit.Test)

Aggregations

ParsingBehaviour (de.be4.classicalb.core.parser.ParsingBehaviour)1 RuleGoalAssumption (de.be4.classicalb.core.parser.rules.RulesMachineRunConfiguration.RuleGoalAssumption)1 File (java.io.File)1 Test (org.junit.Test)1