use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class Instrumentor method instrument.
public Model instrument(Model vdm_model, List<String> threats, boolean blameAssignment, boolean componentLevel) {
Model instrumented_model = null;
retrieve_component_and_channels(vdm_model, threats, blameAssignment, componentLevel);
return instrumented_model;
}
use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class VDM2Lustre method visit.
public Model visit(Model vdm_model) {
Model dataFlowModel = new Model();
// I) Naming Model *.lus
String program_name = vdm_model.getName() + ".lus";
dataFlowModel.setName(program_name);
// II) Copying exiting DataFlow code
LustreProgram lustre_program = vdm_model.getDataflowCode();
if (lustre_program == null) {
lustre_program = new LustreProgram();
}
visit(vdm_model, lustre_program);
dataFlowModel.setDataflowCode(lustre_program);
return dataFlowModel;
}
use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class VerdictLustreTranslatorIT method testLustreFile.
public static void testLustreFile(Path path) {
try {
// Unmarshal a model from the original Lustre file
Model originalModel = VerdictLustreTranslator.unmarshalFromLustre(path.toFile());
// Marshal the original model to a temporary Lustre file
File tempFile = File.createTempFile(path.getFileName().toString(), ".lus");
VerdictLustreTranslator.marshalToLustre(originalModel, tempFile);
Assertions.assertThat(tempFile).exists();
tempFile.deleteOnExit();
// Unmarshal another model from the temporary Lustre file and compare it to the original
// model to check the fidelity of the marshalToLustre method
Model anotherModel = VerdictLustreTranslator.unmarshalFromLustre(tempFile);
anotherModel.setName(originalModel.getName());
try {
Assertions.assertThat(anotherModel).usingRecursiveComparison().isEqualTo(originalModel);
} catch (AssertionError e) {
System.err.println("Found non-fidelity of translation in " + path);
// Save both temporary Lustre and temporary XML files for easier debugging
tempFile = File.createTempFile(path.getFileName().toString(), ".lus");
VerdictLustreTranslator.marshalToLustre(originalModel, tempFile);
tempFile = File.createTempFile(path.getFileName().toString(), ".xml");
VerdictLustreTranslator.marshalToXml(originalModel, tempFile);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class VerdictLustreTranslatorTest method testMarshalToLustre1.
@Test
public void testMarshalToLustre1() throws IOException {
Model controlModel = VdmTranslator.unmarshalFromXml(new File("src/test/resources/vdm-input1.xml"));
File testFile = File.createTempFile("vdm-model", ".lus");
testFile.deleteOnExit();
VerdictLustreTranslator.marshalToLustre(controlModel, testFile);
Assertions.assertThat(testFile).exists();
File controlFile = new File("src/test/resources/lustre-output1.lus");
Assertions.assertThat(testFile).hasSameTextualContentAs(controlFile);
}
use of verdict.vdm.vdm_model.Model in project VERDICT by ge-high-assurance.
the class VerdictLustreTranslatorTest method testUnmarshalFromInclude.
@Ignore
@Test
public void testUnmarshalFromInclude() throws IOException {
File testFile = new File("src/test/resources/include-vdm-model.lus");
Model testModel = VerdictLustreTranslator.unmarshalFromLustre(testFile);
testModel.setName("vdm-model.lus");
Model controlModel = VdmTest.createControlModel();
Assertions.assertThat(testModel).usingRecursiveComparison().isEqualTo(controlModel);
}
Aggregations