use of com.rockwellcollins.atc.tcg.TcgException in project AGREE by loonwerks.
the class TcgXmlWriter method writeTest.
private void writeTest(String name, String description, Counterexample cex) {
try {
out.println(" <Test name=\"" + escapeXml(name) + "\">");
out.println(" <Description>" + escapeXml(description) + "</Description>");
out.println(" <Length>" + cex.getLength() + "</Length>");
writeCounterexample(cex);
out.println(" </Test>");
} catch (Exception e) {
throw new TcgException("Error writing XML Test Suite", e);
}
}
use of com.rockwellcollins.atc.tcg.TcgException in project AGREE by loonwerks.
the class TcgXmlWriter method writeSignal.
private void writeSignal(int k, Signal<Value> signal) throws Exception {
String name = escapeXml(signal.getName());
// TODO: fix this with the type map!
Type type;
if (signal.getValues().isEmpty()) {
throw new TcgException("Unable to assertain signal type in XmlWriter");
} else {
Map.Entry<Integer, Value> entry = signal.getValues().entrySet().iterator().next();
Value v = entry.getValue();
if (v instanceof IntegerValue) {
type = NamedType.INT;
} else if (v instanceof RealValue) {
type = NamedType.REAL;
} else if (v instanceof BooleanValue) {
type = NamedType.BOOL;
} else {
throw new TcgException("Unexpected signal type in XmlWriter");
}
}
out.println(" <Signal name=\"" + name + "\" type=\"" + type + "\">");
for (int i = 0; i < k; i++) {
out.println(" <Value time=\"" + i + "\">" + formatValue(signal.getValue(i)) + "</Value>");
}
out.println(" </Signal>");
}
use of com.rockwellcollins.atc.tcg.TcgException in project AGREE by loonwerks.
the class TcgXmlWriter method begin.
private void begin(String name, String description, String implUnderTest) {
try {
out.println("<?xml version=\"1.0\"?>");
out.println("<TestSuite xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
out.println(" <SuiteName>" + escapeXml(name) + "</SuiteName>");
out.println(" <SuiteDescription>" + escapeXml(description) + "</SuiteDescription>");
out.println(" <ImplementationUnderTest>" + escapeXml(implUnderTest) + "</ImplementationUnderTest>");
out.println(" <Tests>");
} catch (Exception e) {
throw new TcgException("Error writing XML Test Suite", e);
}
}
use of com.rockwellcollins.atc.tcg.TcgException in project AGREE by loonwerks.
the class OpenHandler method loadTests.
private TestSuite loadTests() throws TcgException {
try {
Shell activeShell = getWindow().getShell();
syncExec(() -> {
location = TcgPreferenceUtils.getTestCaseOpenFileDialog(activeShell, null);
});
if (location != null) {
InputStream targetStream = new FileInputStream(location);
TestSuite ts = new TestSuite();
TcgXmlReader reader = new TcgXmlReader(targetStream);
reader.readSuite(ts);
ts.setState(TestSuite.State.LOADED);
return ts;
} else {
return null;
}
} catch (IOException e) {
throw new TcgException("Error loading test file", e);
}
}
use of com.rockwellcollins.atc.tcg.TcgException in project AGREE by loonwerks.
the class VerifyHandler method writeIntermediateFiles.
private void writeIntermediateFiles(Program program, Program ufcProgram) {
if (Debug) {
try {
System.out.println("writing ufc obligations...");
writeLustre("orig.lus", program);
writeLustre("tcg.lus", ufcProgram);
} catch (FileNotFoundException ff) {
throw new TcgException("couldn't write .lus files in VerifyHandler", ff);
}
}
}
Aggregations