use of de.neemann.digital.core.Model in project Digital by hneemann.
the class TestResultTest method testResultError.
public void testResultError() throws Exception {
Model model = getModel("A+B");
TestCaseDescription data = new TestCaseDescription("A B Y\n" + "0 0 0\n" + "0 1 1\n" + "1 0 1\n" + "1 1 0\n");
TestExecutor te = new TestExecutor(data).create(model);
ValueTable tr = te.getResult();
assertEquals(4, tr.getRows());
assertFalse(te.allPassed());
assertEquals(true, ((MatchedValue) tr.getValue(0, 2)).isPassed());
assertEquals(true, ((MatchedValue) tr.getValue(1, 2)).isPassed());
assertEquals(true, ((MatchedValue) tr.getValue(2, 2)).isPassed());
assertEquals(false, ((MatchedValue) tr.getValue(3, 2)).isPassed());
}
use of de.neemann.digital.core.Model in project Digital by hneemann.
the class TestResultTest method testResultOk.
public void testResultOk() throws Exception {
Model model = getModel("A^B");
TestCaseDescription data = new TestCaseDescription("A B Y\n" + "0 0 0\n" + "0 1 1\n" + "1 0 1\n" + "1 1 0\n");
TestExecutor tr = new TestExecutor(data).create(model);
assertEquals(4, tr.getResult().getRows());
assertTrue(tr.allPassed());
}
use of de.neemann.digital.core.Model in project Digital by hneemann.
the class TestResultTest method testResultDontCare2.
public void testResultDontCare2() throws Exception {
Model model = getModel("A+B");
TestCaseDescription data = new TestCaseDescription("A B Y\n" + "0 0 x\n" + "0 1 1\n" + "1 0 1\n" + "1 1 1\n");
TestExecutor te = new TestExecutor(data).create(model);
ValueTable tr = te.getResult();
assertEquals(4, tr.getRows());
assertTrue(te.allPassed());
}
use of de.neemann.digital.core.Model in project Digital by hneemann.
the class TestResultTest method testResultDontCare.
public void testResultDontCare() throws Exception {
Model model = getModel("A+B");
TestCaseDescription data = new TestCaseDescription("A B Y\n" + "0 0 0\n" + "0 1 1\n" + "1 0 1\n" + "1 1 x\n");
TestExecutor te = new TestExecutor(data).create(model);
ValueTable tr = te.getResult();
assertEquals(4, tr.getRows());
assertTrue(te.allPassed());
}
use of de.neemann.digital.core.Model in project Digital by hneemann.
the class ValueTableDialog method addTestResult.
/**
* Add test results
*
* @param tsl list of test sets
* @param circuit the circuit
* @param library the library to use
* @return this for chained calls
* @throws NodeException NodeException
* @throws TestingDataException DataException
* @throws PinException PinException
* @throws ElementNotFoundException ElementNotFoundException
*/
public ValueTableDialog addTestResult(ArrayList<TestSet> tsl, Circuit circuit, ElementLibrary library) throws PinException, NodeException, ElementNotFoundException, TestingDataException {
Collections.sort(tsl);
int i = 0;
int errorTabIndex = -1;
for (TestSet ts : tsl) {
Model model = new ModelCreator(circuit, library).createModel(false);
try {
TestExecutor testExecutor = new TestExecutor(ts.data).create(model);
if (testExecutor.getException() != null)
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorWhileExecutingTests_N0", ts.name)).addCause(testExecutor.getException()).setComponent(this));
String tabName;
Icon tabIcon;
if (testExecutor.allPassed()) {
tabName = Lang.get("msg_test_N_Passed", ts.name);
tabIcon = ICON_PASSED;
} else {
tabName = Lang.get("msg_test_N_Failed", ts.name);
tabIcon = ICON_FAILED;
errorTabIndex = i;
}
if (testExecutor.toManyResults())
tabName += " " + Lang.get("msg_test_missingLines");
tp.addTab(tabName, tabIcon, new JScrollPane(createTable(testExecutor.getResult())));
if (testExecutor.toManyResults())
tp.setToolTipTextAt(i, new LineBreaker().toHTML().breakLines(Lang.get("msg_test_missingLines_tt")));
resultTableData.add(testExecutor.getResult());
i++;
} finally {
model.close();
}
}
if (errorTabIndex >= 0)
tp.setSelectedIndex(errorTabIndex);
pack();
setLocationRelativeTo(owner);
return this;
}
Aggregations