Search in sources :

Example 11 with Model

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;
}
Also used : Model(verdict.vdm.vdm_model.Model)

Example 12 with 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;
}
Also used : LustreProgram(verdict.vdm.vdm_lustre.LustreProgram) Model(verdict.vdm.vdm_model.Model)

Example 13 with Model

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);
    }
}
Also used : Model(verdict.vdm.vdm_model.Model) IOException(java.io.IOException) File(java.io.File)

Example 14 with Model

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);
}
Also used : Model(verdict.vdm.vdm_model.Model) File(java.io.File) VdmTest(com.ge.verdict.vdm.VdmTest) Test(org.junit.Test)

Example 15 with Model

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);
}
Also used : Model(verdict.vdm.vdm_model.Model) File(java.io.File) Ignore(org.junit.Ignore) VdmTest(com.ge.verdict.vdm.VdmTest) Test(org.junit.Test)

Aggregations

Model (verdict.vdm.vdm_model.Model)31 File (java.io.File)18 Test (org.junit.Test)7 Agree2Vdm (com.ge.research.osate.verdict.aadl2vdm.Agree2Vdm)4 VdmTest (com.ge.verdict.vdm.VdmTest)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 Ignore (org.junit.Ignore)4 Vdm2Csv (com.ge.research.osate.verdict.vdm2csv.Vdm2Csv)3 VDM2Lustre (edu.uiowa.clc.verdict.lustre.VDM2Lustre)3 CommandLine (org.apache.commons.cli.CommandLine)3 CostModel (com.ge.verdict.synthesis.CostModel)2 BlameAssignment (edu.uiowa.clc.verdict.blm.BlameAssignment)2 JAXBContext (jakarta.xml.bind.JAXBContext)2 JAXBException (jakarta.xml.bind.JAXBException)2 Aadl2Vdm (com.ge.research.osate.verdict.aadl2vdm.Aadl2Vdm)1 GSNInterface (com.ge.verdict.gsn.GSNInterface)1 SecurityGSNInterface (com.ge.verdict.gsn.SecurityGSNInterface)1 VerdictTestInstrumentor (com.ge.verdict.test.instrumentor.VerdictTestInstrumentor)1 Instrumentor (edu.uiowa.clc.verdict.crv.Instrumentor)1