mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 07:28:20 -04:00
renamed some classes
This commit is contained in:
parent
cf5c8ea056
commit
4ae8ec9c36
@ -27,7 +27,7 @@ import de.neemann.digital.draw.shapes.ShapeFactory;
|
|||||||
import de.neemann.digital.gui.sync.NoSync;
|
import de.neemann.digital.gui.sync.NoSync;
|
||||||
import de.neemann.digital.gui.sync.Sync;
|
import de.neemann.digital.gui.sync.Sync;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.digital.testing.TestData;
|
import de.neemann.digital.testing.TestCaseDescription;
|
||||||
import de.neemann.gui.language.Language;
|
import de.neemann.gui.language.Language;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@ -81,7 +81,7 @@ public class Circuit {
|
|||||||
xStream.addImplicitCollection(ElementAttributes.class, "attributes");
|
xStream.addImplicitCollection(ElementAttributes.class, "attributes");
|
||||||
xStream.alias("data", DataField.class);
|
xStream.alias("data", DataField.class);
|
||||||
xStream.registerConverter(new DataFieldConverter());
|
xStream.registerConverter(new DataFieldConverter());
|
||||||
xStream.alias("testData", TestData.class);
|
xStream.alias("testData", TestCaseDescription.class);
|
||||||
xStream.alias("inverterConfig", InverterConfig.class);
|
xStream.alias("inverterConfig", InverterConfig.class);
|
||||||
xStream.addImplicitCollection(InverterConfig.class, "inputs");
|
xStream.addImplicitCollection(InverterConfig.class, "inputs");
|
||||||
xStream.ignoreUnknownElements();
|
xStream.ignoreUnknownElements();
|
||||||
|
@ -18,7 +18,7 @@ import de.neemann.digital.draw.model.ModelCreator;
|
|||||||
import de.neemann.digital.draw.model.ModelEntry;
|
import de.neemann.digital.draw.model.ModelEntry;
|
||||||
import de.neemann.digital.gui.components.CircuitComponent;
|
import de.neemann.digital.gui.components.CircuitComponent;
|
||||||
import de.neemann.digital.gui.components.OrderMerger;
|
import de.neemann.digital.gui.components.OrderMerger;
|
||||||
import de.neemann.digital.gui.components.data.DataSetObserver;
|
import de.neemann.digital.gui.components.data.ValueTableObserver;
|
||||||
import de.neemann.digital.gui.sync.Sync;
|
import de.neemann.digital.gui.sync.Sync;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@ -83,8 +83,8 @@ public class DataShape implements Shape {
|
|||||||
}
|
}
|
||||||
}.order(signals);
|
}.order(signals);
|
||||||
|
|
||||||
DataSetObserver dataSetObserver = new DataSetObserver(microStep, signals, maxSize);
|
ValueTableObserver valueTableObserver = new ValueTableObserver(microStep, signals, maxSize);
|
||||||
logData = dataSetObserver.getLogData();
|
logData = valueTableObserver.getLogData();
|
||||||
model.addObserver(dataSetObserver);
|
model.addObserver(valueTableObserver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import de.neemann.digital.draw.model.RealTimeClock;
|
|||||||
import de.neemann.digital.draw.shapes.Drawable;
|
import de.neemann.digital.draw.shapes.Drawable;
|
||||||
import de.neemann.digital.draw.shapes.ShapeFactory;
|
import de.neemann.digital.draw.shapes.ShapeFactory;
|
||||||
import de.neemann.digital.gui.components.*;
|
import de.neemann.digital.gui.components.*;
|
||||||
import de.neemann.digital.gui.components.data.DataSetDialog;
|
import de.neemann.digital.gui.components.data.GraphDialog;
|
||||||
import de.neemann.digital.gui.components.expression.ExpressionDialog;
|
import de.neemann.digital.gui.components.expression.ExpressionDialog;
|
||||||
import de.neemann.digital.gui.components.modification.Modifications;
|
import de.neemann.digital.gui.components.modification.Modifications;
|
||||||
import de.neemann.digital.gui.components.modification.ModifyAttribute;
|
import de.neemann.digital.gui.components.modification.ModifyAttribute;
|
||||||
@ -1003,9 +1003,9 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
windowPosManager.register("probe", new ProbeDialog(this, model, updateEvent, ordering, modelSync)).setVisible(true);
|
windowPosManager.register("probe", new ProbeDialog(this, model, updateEvent, ordering, modelSync)).setVisible(true);
|
||||||
|
|
||||||
if (settings.get(Keys.SHOW_DATA_GRAPH))
|
if (settings.get(Keys.SHOW_DATA_GRAPH))
|
||||||
windowPosManager.register("dataSet", DataSetDialog.createLiveDialog(this, model, updateEvent == ModelEvent.MICROSTEP, ordering, modelSync)).setVisible(true);
|
windowPosManager.register("dataSet", GraphDialog.createLiveDialog(this, model, updateEvent == ModelEvent.MICROSTEP, ordering, modelSync)).setVisible(true);
|
||||||
if (settings.get(Keys.SHOW_DATA_GRAPH_MICRO))
|
if (settings.get(Keys.SHOW_DATA_GRAPH_MICRO))
|
||||||
windowPosManager.register("dataSetMicro", DataSetDialog.createLiveDialog(this, model, true, ordering, modelSync)).setVisible(true);
|
windowPosManager.register("dataSetMicro", GraphDialog.createLiveDialog(this, model, true, ordering, modelSync)).setVisible(true);
|
||||||
|
|
||||||
if (modelModifier != null)
|
if (modelModifier != null)
|
||||||
modelModifier.preInit(model);
|
modelModifier.preInit(model);
|
||||||
|
@ -11,10 +11,10 @@ import de.neemann.digital.draw.elements.VisualElement;
|
|||||||
import de.neemann.digital.draw.library.ElementNotFoundException;
|
import de.neemann.digital.draw.library.ElementNotFoundException;
|
||||||
import de.neemann.digital.draw.model.InverterConfig;
|
import de.neemann.digital.draw.model.InverterConfig;
|
||||||
import de.neemann.digital.gui.SaveAsHelper;
|
import de.neemann.digital.gui.SaveAsHelper;
|
||||||
import de.neemann.digital.gui.components.testing.TestDataEditor;
|
import de.neemann.digital.gui.components.testing.TestCaseDesctiptionEditor;
|
||||||
import de.neemann.digital.gui.sync.NoSync;
|
import de.neemann.digital.gui.sync.NoSync;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.digital.testing.TestData;
|
import de.neemann.digital.testing.TestCaseDescription;
|
||||||
import de.neemann.gui.*;
|
import de.neemann.gui.*;
|
||||||
import de.neemann.gui.language.Bundle;
|
import de.neemann.gui.language.Bundle;
|
||||||
import de.neemann.gui.language.Language;
|
import de.neemann.gui.language.Language;
|
||||||
@ -53,7 +53,7 @@ public final class EditorFactory {
|
|||||||
add(Rotation.class, RotationEditor.class);
|
add(Rotation.class, RotationEditor.class);
|
||||||
add(IntFormat.class, IntFormatsEditor.class);
|
add(IntFormat.class, IntFormatsEditor.class);
|
||||||
add(Language.class, LanguageEditor.class);
|
add(Language.class, LanguageEditor.class);
|
||||||
add(TestData.class, TestDataEditor.class);
|
add(TestCaseDescription.class, TestCaseDesctiptionEditor.class);
|
||||||
add(FormatToExpression.class, FormatEditor.class);
|
add(FormatToExpression.class, FormatEditor.class);
|
||||||
add(InverterConfig.class, InverterConfigEditor.class);
|
add(InverterConfig.class, InverterConfigEditor.class);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import java.awt.*;
|
|||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class DataSetComponent extends JComponent {
|
public class GraphComponent extends JComponent {
|
||||||
private final DataPlotter plotter;
|
private final DataPlotter plotter;
|
||||||
/**
|
/**
|
||||||
* The data stored in the plotter needs to be seen as part of the model.
|
* The data stored in the plotter needs to be seen as part of the model.
|
||||||
@ -28,7 +28,7 @@ public class DataSetComponent extends JComponent {
|
|||||||
* @param dataSet the dataSet to paint
|
* @param dataSet the dataSet to paint
|
||||||
* @param modelSync lock to access the model
|
* @param modelSync lock to access the model
|
||||||
*/
|
*/
|
||||||
public DataSetComponent(ValueTable dataSet, Sync modelSync) {
|
public GraphComponent(ValueTable dataSet, Sync modelSync) {
|
||||||
plotter = new DataPlotter(dataSet).setModelSync(modelSync);
|
plotter = new DataPlotter(dataSet).setModelSync(modelSync);
|
||||||
addMouseWheelListener(e -> {
|
addMouseWheelListener(e -> {
|
||||||
double f = Math.pow(0.9, e.getWheelRotation());
|
double f = Math.pow(0.9, e.getWheelRotation());
|
@ -28,12 +28,12 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class DataSetDialog extends JDialog implements ModelStateObserver {
|
public class GraphDialog extends JDialog implements ModelStateObserver {
|
||||||
private static final int MAX_SAMPLE_SIZE = 1000;
|
private static final int MAX_SAMPLE_SIZE = 1000;
|
||||||
private final DataSetComponent dsc;
|
private final GraphComponent dsc;
|
||||||
private final JScrollPane scrollPane;
|
private final JScrollPane scrollPane;
|
||||||
private final Sync modelSync;
|
private final Sync modelSync;
|
||||||
private DataSetObserver dataSetObserver;
|
private ValueTableObserver valueTableObserver;
|
||||||
|
|
||||||
private static final Icon ICON_EXPAND = IconCreator.create("View-zoom-fit.png");
|
private static final Icon ICON_EXPAND = IconCreator.create("View-zoom-fit.png");
|
||||||
private static final Icon ICON_ZOOM_IN = IconCreator.create("View-zoom-in.png");
|
private static final Icon ICON_ZOOM_IN = IconCreator.create("View-zoom-in.png");
|
||||||
@ -50,7 +50,7 @@ public class DataSetDialog extends JDialog implements ModelStateObserver {
|
|||||||
* @param modelSync the lock to access the model
|
* @param modelSync the lock to access the model
|
||||||
* @return the created instance
|
* @return the created instance
|
||||||
*/
|
*/
|
||||||
public static DataSetDialog createLiveDialog(Frame owner, Model model, boolean microStep, List<String> ordering, Sync modelSync) {
|
public static GraphDialog createLiveDialog(Frame owner, Model model, boolean microStep, List<String> ordering, Sync modelSync) {
|
||||||
String title;
|
String title;
|
||||||
if (microStep)
|
if (microStep)
|
||||||
title = Lang.get("win_measures_microstep");
|
title = Lang.get("win_measures_microstep");
|
||||||
@ -65,10 +65,10 @@ public class DataSetDialog extends JDialog implements ModelStateObserver {
|
|||||||
}
|
}
|
||||||
}.order(signals);
|
}.order(signals);
|
||||||
|
|
||||||
DataSetObserver dataSetObserver = new DataSetObserver(microStep, signals, MAX_SAMPLE_SIZE);
|
ValueTableObserver valueTableObserver = new ValueTableObserver(microStep, signals, MAX_SAMPLE_SIZE);
|
||||||
ValueTable logData = dataSetObserver.getLogData();
|
ValueTable logData = valueTableObserver.getLogData();
|
||||||
|
|
||||||
return new DataSetDialog(owner, title, model, logData, dataSetObserver, modelSync);
|
return new GraphDialog(owner, title, model, logData, valueTableObserver, modelSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,7 +78,7 @@ public class DataSetDialog extends JDialog implements ModelStateObserver {
|
|||||||
* @param title the frame title
|
* @param title the frame title
|
||||||
* @param logData the data to visualize
|
* @param logData the data to visualize
|
||||||
*/
|
*/
|
||||||
public DataSetDialog(Frame owner, String title, ValueTable logData) {
|
public GraphDialog(Frame owner, String title, ValueTable logData) {
|
||||||
this(owner, title, null, logData, null, NoSync.INST);
|
this(owner, title, null, logData, null, NoSync.INST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,14 +91,14 @@ public class DataSetDialog extends JDialog implements ModelStateObserver {
|
|||||||
* @param logData the data to visualize
|
* @param logData the data to visualize
|
||||||
* @param modelSync used to access the running model
|
* @param modelSync used to access the running model
|
||||||
*/
|
*/
|
||||||
private DataSetDialog(Frame owner, String title, Model model, ValueTable logData, DataSetObserver dataSetObserver, Sync modelSync) {
|
private GraphDialog(Frame owner, String title, Model model, ValueTable logData, ValueTableObserver valueTableObserver, Sync modelSync) {
|
||||||
super(owner, title, false);
|
super(owner, title, false);
|
||||||
this.dataSetObserver = dataSetObserver;
|
this.valueTableObserver = valueTableObserver;
|
||||||
this.modelSync = modelSync;
|
this.modelSync = modelSync;
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
setAlwaysOnTop(true);
|
setAlwaysOnTop(true);
|
||||||
|
|
||||||
dsc = new DataSetComponent(logData, modelSync);
|
dsc = new GraphComponent(logData, modelSync);
|
||||||
scrollPane = new JScrollPane(dsc);
|
scrollPane = new JScrollPane(dsc);
|
||||||
getContentPane().add(scrollPane);
|
getContentPane().add(scrollPane);
|
||||||
dsc.setScrollPane(scrollPane);
|
dsc.setScrollPane(scrollPane);
|
||||||
@ -136,12 +136,12 @@ public class DataSetDialog extends JDialog implements ModelStateObserver {
|
|||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowOpened(WindowEvent e) {
|
public void windowOpened(WindowEvent e) {
|
||||||
modelSync.access(() -> model.addObserver(DataSetDialog.this));
|
modelSync.access(() -> model.addObserver(GraphDialog.this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void windowClosed(WindowEvent e) {
|
public void windowClosed(WindowEvent e) {
|
||||||
modelSync.access(() -> model.removeObserver(DataSetDialog.this));
|
modelSync.access(() -> model.removeObserver(GraphDialog.this));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ public class DataSetDialog extends JDialog implements ModelStateObserver {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JFileChooser fileChooser = new MyFileChooser();
|
JFileChooser fileChooser = new MyFileChooser();
|
||||||
fileChooser.setFileFilter(new FileNameExtensionFilter("Comma Separated Values", "csv"));
|
fileChooser.setFileFilter(new FileNameExtensionFilter("Comma Separated Values", "csv"));
|
||||||
new SaveAsHelper(DataSetDialog.this, fileChooser, "csv")
|
new SaveAsHelper(GraphDialog.this, fileChooser, "csv")
|
||||||
.checkOverwrite(logData::saveCSV);
|
.checkOverwrite(logData::saveCSV);
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_saveData_tt")).createJMenuItem());
|
}.setToolTip(Lang.get("menu_saveData_tt")).createJMenuItem());
|
||||||
@ -174,7 +174,7 @@ public class DataSetDialog extends JDialog implements ModelStateObserver {
|
|||||||
@Override
|
@Override
|
||||||
public void handleEvent(ModelEvent event) {
|
public void handleEvent(ModelEvent event) {
|
||||||
modelSync.access(() -> {
|
modelSync.access(() -> {
|
||||||
dataSetObserver.handleEvent(event);
|
valueTableObserver.handleEvent(event);
|
||||||
});
|
});
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
dsc.revalidate();
|
dsc.revalidate();
|
@ -13,7 +13,7 @@ import java.util.ArrayList;
|
|||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class DataSetObserver implements ModelStateObserver {
|
public class ValueTableObserver implements ModelStateObserver {
|
||||||
|
|
||||||
private final ValueTable logData;
|
private final ValueTable logData;
|
||||||
private final ModelEvent type;
|
private final ModelEvent type;
|
||||||
@ -28,7 +28,7 @@ public class DataSetObserver implements ModelStateObserver {
|
|||||||
* @param signals the signals to log
|
* @param signals the signals to log
|
||||||
* @param maxSize the maximum number of data points to store
|
* @param maxSize the maximum number of data points to store
|
||||||
*/
|
*/
|
||||||
public DataSetObserver(boolean microStep, ArrayList<Signal> signals, int maxSize) {
|
public ValueTableObserver(boolean microStep, ArrayList<Signal> signals, int maxSize) {
|
||||||
this.signals = signals;
|
this.signals = signals;
|
||||||
if (microStep)
|
if (microStep)
|
||||||
this.type = ModelEvent.MICROSTEP;
|
this.type = ModelEvent.MICROSTEP;
|
@ -7,8 +7,8 @@ import de.neemann.digital.gui.components.CircuitComponent;
|
|||||||
import de.neemann.digital.gui.components.modification.ModifyAttribute;
|
import de.neemann.digital.gui.components.modification.ModifyAttribute;
|
||||||
import de.neemann.digital.gui.components.table.ShowStringDialog;
|
import de.neemann.digital.gui.components.table.ShowStringDialog;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
|
import de.neemann.digital.testing.TestCaseDescription;
|
||||||
import de.neemann.digital.testing.TestCaseElement;
|
import de.neemann.digital.testing.TestCaseElement;
|
||||||
import de.neemann.digital.testing.TestData;
|
|
||||||
import de.neemann.digital.testing.Transitions;
|
import de.neemann.digital.testing.Transitions;
|
||||||
import de.neemann.digital.testing.parser.ParserException;
|
import de.neemann.digital.testing.parser.ParserException;
|
||||||
import de.neemann.gui.ErrorMessage;
|
import de.neemann.gui.ErrorMessage;
|
||||||
@ -25,7 +25,7 @@ import java.io.IOException;
|
|||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class TestDataDialog extends JDialog {
|
public class TestCaseDescriptionDialog extends JDialog {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new data dialog
|
* Creates a new data dialog
|
||||||
@ -34,7 +34,7 @@ public class TestDataDialog extends JDialog {
|
|||||||
* @param data the data to edit
|
* @param data the data to edit
|
||||||
* @param element the element to be modified
|
* @param element the element to be modified
|
||||||
*/
|
*/
|
||||||
public TestDataDialog(Component parent, TestData data, VisualElement element) {
|
public TestCaseDescriptionDialog(Component parent, TestCaseDescription data, VisualElement element) {
|
||||||
super(SwingUtilities.getWindowAncestor(parent),
|
super(SwingUtilities.getWindowAncestor(parent),
|
||||||
Lang.get("key_Testdata"),
|
Lang.get("key_Testdata"),
|
||||||
element == null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
|
element == null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
|
||||||
@ -56,7 +56,7 @@ public class TestDataDialog extends JDialog {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
new ShowStringDialog(
|
new ShowStringDialog(
|
||||||
TestDataDialog.this,
|
TestCaseDescriptionDialog.this,
|
||||||
Lang.get("msg_testVectorHelpTitle"),
|
Lang.get("msg_testVectorHelpTitle"),
|
||||||
Lang.get("msg_testVectorHelp"), true)
|
Lang.get("msg_testVectorHelp"), true)
|
||||||
.setVisible(true);
|
.setVisible(true);
|
||||||
@ -75,7 +75,7 @@ public class TestDataDialog extends JDialog {
|
|||||||
text.setText(tr.getCompletedText());
|
text.setText(tr.getCompletedText());
|
||||||
}
|
}
|
||||||
} catch (ParserException | IOException | PinException e1) {
|
} catch (ParserException | IOException | PinException e1) {
|
||||||
new ErrorMessage(e1.getMessage()).show(TestDataDialog.this);
|
new ErrorMessage(e1.getMessage()).show(TestCaseDescriptionDialog.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ public class TestDataDialog extends JDialog {
|
|||||||
cc.getMain().startTests();
|
cc.getMain().startTests();
|
||||||
}
|
}
|
||||||
} catch (ParserException | IOException e1) {
|
} catch (ParserException | IOException e1) {
|
||||||
new ErrorMessage(e1.getMessage()).show(TestDataDialog.this);
|
new ErrorMessage(e1.getMessage()).show(TestCaseDescriptionDialog.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.createJButton());
|
}.createJButton());
|
||||||
@ -109,11 +109,11 @@ public class TestDataDialog extends JDialog {
|
|||||||
&& !initialDataString.equals(data.getDataString())
|
&& !initialDataString.equals(data.getDataString())
|
||||||
&& parent instanceof CircuitComponent) {
|
&& parent instanceof CircuitComponent) {
|
||||||
CircuitComponent cc = (CircuitComponent) parent;
|
CircuitComponent cc = (CircuitComponent) parent;
|
||||||
cc.modify(new ModifyAttribute<>(element, TestCaseElement.TESTDATA, new TestData(data)));
|
cc.modify(new ModifyAttribute<>(element, TestCaseElement.TESTDATA, new TestCaseDescription(data)));
|
||||||
}
|
}
|
||||||
dispose();
|
dispose();
|
||||||
} catch (ParserException | IOException e1) {
|
} catch (ParserException | IOException e1) {
|
||||||
new ErrorMessage(e1.getMessage()).show(TestDataDialog.this);
|
new ErrorMessage(e1.getMessage()).show(TestCaseDescriptionDialog.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.createJButton());
|
}.createJButton());
|
@ -6,7 +6,7 @@ import de.neemann.digital.draw.elements.VisualElement;
|
|||||||
import de.neemann.digital.gui.Main;
|
import de.neemann.digital.gui.Main;
|
||||||
import de.neemann.digital.gui.components.EditorFactory;
|
import de.neemann.digital.gui.components.EditorFactory;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.digital.testing.TestData;
|
import de.neemann.digital.testing.TestCaseDescription;
|
||||||
import de.neemann.gui.ToolTipAction;
|
import de.neemann.gui.ToolTipAction;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@ -16,10 +16,10 @@ import java.awt.event.ActionEvent;
|
|||||||
/**
|
/**
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class TestDataEditor extends EditorFactory.LabelEditor<TestData> {
|
public class TestCaseDesctiptionEditor extends EditorFactory.LabelEditor<TestCaseDescription> {
|
||||||
|
|
||||||
private final TestData data;
|
private final TestCaseDescription data;
|
||||||
private final Key<TestData> key;
|
private final Key<TestCaseDescription> key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new editor
|
* Creates a new editor
|
||||||
@ -27,13 +27,13 @@ public class TestDataEditor extends EditorFactory.LabelEditor<TestData> {
|
|||||||
* @param data the data to edit
|
* @param data the data to edit
|
||||||
* @param key the data key
|
* @param key the data key
|
||||||
*/
|
*/
|
||||||
public TestDataEditor(TestData data, Key<TestData> key) {
|
public TestCaseDesctiptionEditor(TestCaseDescription data, Key<TestCaseDescription> key) {
|
||||||
this.data = new TestData(data);
|
this.data = new TestCaseDescription(data);
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TestData getValue() {
|
public TestCaseDescription getValue() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class TestDataEditor extends EditorFactory.LabelEditor<TestData> {
|
|||||||
panel.add(new ToolTipAction(Lang.get("btn_edit")) {
|
panel.add(new ToolTipAction(Lang.get("btn_edit")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
new TestDataDialog(panel, data, null).setVisible(true);
|
new TestCaseDescriptionDialog(panel, data, null).setVisible(true);
|
||||||
}
|
}
|
||||||
}.createJButton());
|
}.createJButton());
|
||||||
|
|
||||||
@ -52,8 +52,8 @@ public class TestDataEditor extends EditorFactory.LabelEditor<TestData> {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
getAttributeDialog().fireOk();
|
getAttributeDialog().fireOk();
|
||||||
VisualElement visualElement = TestDataEditor.this.getAttributeDialog().getVisualElement();
|
VisualElement visualElement = TestCaseDesctiptionEditor.this.getAttributeDialog().getVisualElement();
|
||||||
TestDataDialog dialog = new TestDataDialog(getAttributeDialog().getDialogParent(), data, visualElement);
|
TestCaseDescriptionDialog dialog = new TestCaseDescriptionDialog(getAttributeDialog().getDialogParent(), data, visualElement);
|
||||||
Main main = getAttributeDialog().getMain();
|
Main main = getAttributeDialog().getMain();
|
||||||
if (main != null)
|
if (main != null)
|
||||||
main.getWindowPosManager().register("testdata", dialog);
|
main.getWindowPosManager().register("testdata", dialog);
|
@ -10,7 +10,7 @@ import de.neemann.digital.draw.elements.PinException;
|
|||||||
import de.neemann.digital.draw.library.ElementLibrary;
|
import de.neemann.digital.draw.library.ElementLibrary;
|
||||||
import de.neemann.digital.draw.library.ElementNotFoundException;
|
import de.neemann.digital.draw.library.ElementNotFoundException;
|
||||||
import de.neemann.digital.draw.model.ModelCreator;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.gui.components.data.DataSetDialog;
|
import de.neemann.digital.gui.components.data.GraphDialog;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.digital.testing.*;
|
import de.neemann.digital.testing.*;
|
||||||
import de.neemann.gui.ErrorMessage;
|
import de.neemann.gui.ErrorMessage;
|
||||||
@ -66,22 +66,22 @@ public class TestResultDialog extends JDialog {
|
|||||||
for (TestSet ts : tsl) {
|
for (TestSet ts : tsl) {
|
||||||
Model model = new ModelCreator(circuit, library).createModel(false);
|
Model model = new ModelCreator(circuit, library).createModel(false);
|
||||||
|
|
||||||
TestExecuter testExecuter = new TestExecuter(ts.data).create(model);
|
TestExecutor testExecutor = new TestExecutor(ts.data).create(model);
|
||||||
|
|
||||||
if (testExecuter.getException() != null)
|
if (testExecutor.getException() != null)
|
||||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorWhileExecutingTests_N0", ts.name)).addCause(testExecuter.getException()).setComponent(this));
|
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorWhileExecutingTests_N0", ts.name)).addCause(testExecutor.getException()).setComponent(this));
|
||||||
|
|
||||||
JTable table = new JTable(new ValueTableModel(testExecuter.getResult()));
|
JTable table = new JTable(new ValueTableModel(testExecutor.getResult()));
|
||||||
table.setDefaultRenderer(Value.class, new ValueRenderer());
|
table.setDefaultRenderer(Value.class, new ValueRenderer());
|
||||||
table.setDefaultRenderer(Integer.class, new NumberRenderer());
|
table.setDefaultRenderer(Integer.class, new NumberRenderer());
|
||||||
final Font font = table.getFont();
|
final Font font = table.getFont();
|
||||||
table.getColumnModel().getColumn(0).setMaxWidth(font.getSize() * 4);
|
table.getColumnModel().getColumn(0).setMaxWidth(font.getSize() * 4);
|
||||||
table.setRowHeight(font.getSize() * 6 / 5);
|
table.setRowHeight(font.getSize() * 6 / 5);
|
||||||
resultTableData.add(testExecuter.getResult());
|
resultTableData.add(testExecutor.getResult());
|
||||||
|
|
||||||
String tabName;
|
String tabName;
|
||||||
Icon tabIcon;
|
Icon tabIcon;
|
||||||
if (testExecuter.allPassed()) {
|
if (testExecutor.allPassed()) {
|
||||||
tabName = Lang.get("msg_test_N_Passed", ts.name);
|
tabName = Lang.get("msg_test_N_Passed", ts.name);
|
||||||
tabIcon = ICON_PASSED;
|
tabIcon = ICON_PASSED;
|
||||||
} else {
|
} else {
|
||||||
@ -89,11 +89,11 @@ public class TestResultDialog extends JDialog {
|
|||||||
tabIcon = ICON_FAILED;
|
tabIcon = ICON_FAILED;
|
||||||
errorTabIndex = i;
|
errorTabIndex = i;
|
||||||
}
|
}
|
||||||
if (testExecuter.toManyResults())
|
if (testExecutor.toManyResults())
|
||||||
tabName += " " + Lang.get("msg_test_missingLines");
|
tabName += " " + Lang.get("msg_test_missingLines");
|
||||||
|
|
||||||
tp.addTab(tabName, tabIcon, new JScrollPane(table));
|
tp.addTab(tabName, tabIcon, new JScrollPane(table));
|
||||||
if (testExecuter.toManyResults())
|
if (testExecutor.toManyResults())
|
||||||
tp.setToolTipTextAt(i, new LineBreaker().toHTML().breakLines(Lang.get("msg_test_missingLines_tt")));
|
tp.setToolTipTextAt(i, new LineBreaker().toHTML().breakLines(Lang.get("msg_test_missingLines_tt")));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ public class TestResultDialog extends JDialog {
|
|||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
int tab = tp.getSelectedIndex();
|
int tab = tp.getSelectedIndex();
|
||||||
if (tab < 0) tab = 0;
|
if (tab < 0) tab = 0;
|
||||||
new DataSetDialog(owner, Lang.get("win_testdata_N", tp.getTitleAt(tab)), resultTableData.get(tab)).setVisible(true);
|
new GraphDialog(owner, Lang.get("win_testdata_N", tp.getTitleAt(tab)), resultTableData.get(tab)).setVisible(true);
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_showDataAsGraph_tt"));
|
}.setToolTip(Lang.get("menu_showDataAsGraph_tt"));
|
||||||
view.add(asGraph.createJMenuItem());
|
view.add(asGraph.createJMenuItem());
|
||||||
@ -125,12 +125,12 @@ public class TestResultDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A TestSet contains the {@link TestData} and the name of the TestData.
|
* A TestSet contains the {@link TestCaseDescription} and the name of the TestData.
|
||||||
* Is only a value bean
|
* Is only a value bean
|
||||||
*/
|
*/
|
||||||
public static class TestSet implements Comparable<TestSet> {
|
public static class TestSet implements Comparable<TestSet> {
|
||||||
|
|
||||||
private final TestData data;
|
private final TestCaseDescription data;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,7 +139,7 @@ public class TestResultDialog extends JDialog {
|
|||||||
* @param data the TestData
|
* @param data the TestData
|
||||||
* @param name the name of the data, eg. the used label
|
* @param name the name of the data, eg. the used label
|
||||||
*/
|
*/
|
||||||
public TestSet(TestData data, String name) {
|
public TestSet(TestCaseDescription data, String name) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import java.util.ArrayList;
|
|||||||
public class LineListenerResolveDontCare implements LineListener {
|
public class LineListenerResolveDontCare implements LineListener {
|
||||||
|
|
||||||
private final LineListener parent;
|
private final LineListener parent;
|
||||||
private final ArrayList<TestExecuter.TestSignal> inputs;
|
private final ArrayList<TestExecutor.TestSignal> inputs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance
|
* Create a new instance
|
||||||
@ -20,33 +20,33 @@ public class LineListenerResolveDontCare implements LineListener {
|
|||||||
* @param parent the parent listener
|
* @param parent the parent listener
|
||||||
* @param inputs the input test signals
|
* @param inputs the input test signals
|
||||||
*/
|
*/
|
||||||
public LineListenerResolveDontCare(LineListener parent, ArrayList<TestExecuter.TestSignal> inputs) {
|
public LineListenerResolveDontCare(LineListener parent, ArrayList<TestExecutor.TestSignal> inputs) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.inputs = inputs;
|
this.inputs = inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(Value[] rowWithDontCare) {
|
public void add(Value[] row) {
|
||||||
ArrayList<Integer> dcIndex = null;
|
ArrayList<Integer> dcIndex = null;
|
||||||
for (TestExecuter.TestSignal in : inputs) {
|
for (TestExecutor.TestSignal in : inputs) {
|
||||||
if (rowWithDontCare[in.getIndex()].getType() == Value.Type.DONTCARE) {
|
if (row[in.getIndex()].getType() == Value.Type.DONTCARE) {
|
||||||
if (dcIndex == null)
|
if (dcIndex == null)
|
||||||
dcIndex = new ArrayList<>();
|
dcIndex = new ArrayList<>();
|
||||||
dcIndex.add(in.getIndex());
|
dcIndex.add(in.getIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dcIndex == null)
|
if (dcIndex == null)
|
||||||
parent.add(rowWithDontCare);
|
parent.add(row);
|
||||||
else {
|
else {
|
||||||
int count = 1 << dcIndex.size();
|
int count = 1 << dcIndex.size();
|
||||||
for (int n = 0; n < count; n++) {
|
for (int n = 0; n < count; n++) {
|
||||||
int mask = 1;
|
int mask = 1;
|
||||||
for (int in : dcIndex) {
|
for (int in : dcIndex) {
|
||||||
boolean val = (n & mask) != 0;
|
boolean val = (n & mask) != 0;
|
||||||
rowWithDontCare[in] = new Value(val ? 1 : 0);
|
row[in] = new Value(val ? 1 : 0);
|
||||||
mask *= 2;
|
mask *= 2;
|
||||||
}
|
}
|
||||||
parent.add(rowWithDontCare);
|
parent.add(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,18 +13,18 @@ import java.util.ArrayList;
|
|||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class TestData {
|
public class TestCaseDescription {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default instance
|
* the default instance
|
||||||
*/
|
*/
|
||||||
public static final TestData DEFAULT = new TestData("");
|
public static final TestCaseDescription DEFAULT = new TestCaseDescription("");
|
||||||
|
|
||||||
private String dataString;
|
private String dataString;
|
||||||
private transient LineEmitter lines;
|
private transient LineEmitter lines;
|
||||||
private transient ArrayList<String> names;
|
private transient ArrayList<String> names;
|
||||||
|
|
||||||
TestData(String data) {
|
TestCaseDescription(String data) {
|
||||||
this.dataString = data;
|
this.dataString = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ public class TestData {
|
|||||||
*
|
*
|
||||||
* @param valueToCopy the instance to copy
|
* @param valueToCopy the instance to copy
|
||||||
*/
|
*/
|
||||||
public TestData(TestData valueToCopy) {
|
public TestCaseDescription(TestCaseDescription valueToCopy) {
|
||||||
this(valueToCopy.dataString);
|
this(valueToCopy.dataString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,9 +95,9 @@ public class TestData {
|
|||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
TestData testData = (TestData) o;
|
TestCaseDescription testCaseDescription = (TestCaseDescription) o;
|
||||||
|
|
||||||
return dataString != null ? dataString.equals(testData.dataString) : testData.dataString == null;
|
return dataString != null ? dataString.equals(testCaseDescription.dataString) : testCaseDescription.dataString == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -15,7 +15,7 @@ public class TestCaseElement implements Element {
|
|||||||
/**
|
/**
|
||||||
* the used {@link ElementAttributes} key
|
* the used {@link ElementAttributes} key
|
||||||
*/
|
*/
|
||||||
public static final Key<TestData> TESTDATA = new Key<>("Testdata", TestData.DEFAULT);
|
public static final Key<TestCaseDescription> TESTDATA = new Key<>("Testdata", TestCaseDescription.DEFAULT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TestCaseElement description
|
* The TestCaseElement description
|
||||||
|
@ -16,12 +16,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the test results created by a single {@link TestData} instance.
|
* Stores the test results created by a single {@link TestCaseDescription} instance.
|
||||||
* The class also performs the tests.
|
* The class also performs the tests.
|
||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class TestExecuter {
|
public class TestExecutor {
|
||||||
private static final int MAX_RESULTS = 1 << 10;
|
private static final int MAX_RESULTS = 1 << 10;
|
||||||
private static final int ERR_RESULTS = MAX_RESULTS * 2;
|
private static final int ERR_RESULTS = MAX_RESULTS * 2;
|
||||||
|
|
||||||
@ -37,13 +37,13 @@ public class TestExecuter {
|
|||||||
/**
|
/**
|
||||||
* Creates a new testing result
|
* Creates a new testing result
|
||||||
*
|
*
|
||||||
* @param testData the testing data
|
* @param testCaseDescription the testing data
|
||||||
* @throws TestingDataException DataException
|
* @throws TestingDataException DataException
|
||||||
*/
|
*/
|
||||||
public TestExecuter(TestData testData) throws TestingDataException {
|
public TestExecutor(TestCaseDescription testCaseDescription) throws TestingDataException {
|
||||||
names = testData.getNames();
|
names = testCaseDescription.getNames();
|
||||||
results = new ValueTable(names);
|
results = new ValueTable(names);
|
||||||
lines = testData.getLines();
|
lines = testCaseDescription.getLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,7 +54,7 @@ public class TestExecuter {
|
|||||||
* @throws TestingDataException DataException
|
* @throws TestingDataException DataException
|
||||||
* @throws NodeException NodeException
|
* @throws NodeException NodeException
|
||||||
*/
|
*/
|
||||||
public TestExecuter create(Model model) throws TestingDataException, NodeException {
|
public TestExecutor create(Model model) throws TestingDataException, NodeException {
|
||||||
allPassed = true;
|
allPassed = true;
|
||||||
HashSet<String> usedSignals = new HashSet<>();
|
HashSet<String> usedSignals = new HashSet<>();
|
||||||
|
|
@ -4,7 +4,7 @@ import de.neemann.digital.data.Value;
|
|||||||
import de.neemann.digital.data.ValueTable;
|
import de.neemann.digital.data.ValueTable;
|
||||||
import de.neemann.digital.draw.graphics.Export;
|
import de.neemann.digital.draw.graphics.Export;
|
||||||
import de.neemann.digital.draw.graphics.GraphicsImage;
|
import de.neemann.digital.draw.graphics.GraphicsImage;
|
||||||
import de.neemann.digital.gui.components.data.DataSetObserver;
|
import de.neemann.digital.gui.components.data.ValueTableObserver;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
@ -14,7 +14,7 @@ import java.io.StringWriter;
|
|||||||
/**
|
/**
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class TestData extends TestCase {
|
public class TestCaseDescription extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a 4 bit counter build from JK flip flops 16 ticks.
|
* Runs a 4 bit counter build from JK flip flops 16 ticks.
|
||||||
@ -27,7 +27,7 @@ public class TestData extends TestCase {
|
|||||||
|
|
||||||
// check recorded data
|
// check recorded data
|
||||||
ValueTable dataSet = toBreakRunner.getModel()
|
ValueTable dataSet = toBreakRunner.getModel()
|
||||||
.getObserver(DataSetObserver.class)
|
.getObserver(ValueTableObserver.class)
|
||||||
.getLogData();
|
.getLogData();
|
||||||
|
|
||||||
assertEquals(31, dataSet.getRows());
|
assertEquals(31, dataSet.getRows());
|
@ -4,8 +4,8 @@ import de.neemann.digital.core.Model;
|
|||||||
import de.neemann.digital.draw.elements.VisualElement;
|
import de.neemann.digital.draw.elements.VisualElement;
|
||||||
import de.neemann.digital.draw.model.ModelCreator;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.testing.TestCaseElement;
|
import de.neemann.digital.testing.TestCaseElement;
|
||||||
import de.neemann.digital.testing.TestData;
|
import de.neemann.digital.testing.TestCaseDescription;
|
||||||
import de.neemann.digital.testing.TestExecuter;
|
import de.neemann.digital.testing.TestExecutor;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -66,10 +66,10 @@ public class TestExamples extends TestCase {
|
|||||||
if (el.equalsDescription(TestCaseElement.TESTCASEDESCRIPTION)) {
|
if (el.equalsDescription(TestCaseElement.TESTCASEDESCRIPTION)) {
|
||||||
|
|
||||||
String label = el.getElementAttributes().getCleanLabel();
|
String label = el.getElementAttributes().getCleanLabel();
|
||||||
TestData td = el.getElementAttributes().get(TestCaseElement.TESTDATA);
|
TestCaseDescription td = el.getElementAttributes().get(TestCaseElement.TESTDATA);
|
||||||
|
|
||||||
Model model = new ModelCreator(br.getCircuit(), br.getLibrary()).createModel(false);
|
Model model = new ModelCreator(br.getCircuit(), br.getLibrary()).createModel(false);
|
||||||
TestExecuter tr = new TestExecuter(td).create(model);
|
TestExecutor tr = new TestExecutor(td).create(model);
|
||||||
|
|
||||||
if (label.contains("Failing"))
|
if (label.contains("Failing"))
|
||||||
assertFalse(dig.getName() + ":" + label, tr.allPassed());
|
assertFalse(dig.getName() + ":" + label, tr.allPassed());
|
||||||
|
@ -15,7 +15,7 @@ public class TestDataTest extends TestCase {
|
|||||||
private static final String DATA3 = "A B\n0 0\n0 1\n1 0\n1 U";
|
private static final String DATA3 = "A B\n0 0\n0 1\n1 0\n1 U";
|
||||||
|
|
||||||
public void testSetDataNonParseable() throws Exception {
|
public void testSetDataNonParseable() throws Exception {
|
||||||
TestData td = new TestData(DATA1);
|
TestCaseDescription td = new TestCaseDescription(DATA1);
|
||||||
|
|
||||||
LineCollector cl = new LineCollector(td.getLines());
|
LineCollector cl = new LineCollector(td.getLines());
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public class TestDataTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testSetDataParseable() throws Exception {
|
public void testSetDataParseable() throws Exception {
|
||||||
TestData td = new TestData(DATA1);
|
TestCaseDescription td = new TestCaseDescription(DATA1);
|
||||||
|
|
||||||
LineCollector cl = new LineCollector(td.getLines());
|
LineCollector cl = new LineCollector(td.getLines());
|
||||||
|
|
||||||
|
@ -37,26 +37,26 @@ public class TestResultTest extends TestCase {
|
|||||||
|
|
||||||
public void testResultOk() throws Exception {
|
public void testResultOk() throws Exception {
|
||||||
Model model = getModel("A^B");
|
Model model = getModel("A^B");
|
||||||
TestData data = new TestData(
|
TestCaseDescription data = new TestCaseDescription(
|
||||||
"A B Y\n"
|
"A B Y\n"
|
||||||
+ "0 0 0\n"
|
+ "0 0 0\n"
|
||||||
+ "0 1 1\n"
|
+ "0 1 1\n"
|
||||||
+ "1 0 1\n"
|
+ "1 0 1\n"
|
||||||
+ "1 1 0\n");
|
+ "1 1 0\n");
|
||||||
TestExecuter tr = new TestExecuter(data).create(model);
|
TestExecutor tr = new TestExecutor(data).create(model);
|
||||||
assertEquals(4,tr.getResult().getRows());
|
assertEquals(4,tr.getResult().getRows());
|
||||||
assertTrue(tr.allPassed());
|
assertTrue(tr.allPassed());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testResultError() throws Exception {
|
public void testResultError() throws Exception {
|
||||||
Model model = getModel("A+B");
|
Model model = getModel("A+B");
|
||||||
TestData data = new TestData(
|
TestCaseDescription data = new TestCaseDescription(
|
||||||
"A B Y\n"
|
"A B Y\n"
|
||||||
+ "0 0 0\n"
|
+ "0 0 0\n"
|
||||||
+ "0 1 1\n"
|
+ "0 1 1\n"
|
||||||
+ "1 0 1\n"
|
+ "1 0 1\n"
|
||||||
+ "1 1 0\n");
|
+ "1 1 0\n");
|
||||||
TestExecuter te = new TestExecuter(data).create(model);
|
TestExecutor te = new TestExecutor(data).create(model);
|
||||||
ValueTable tr = te.getResult();
|
ValueTable tr = te.getResult();
|
||||||
assertEquals(4,tr.getRows());
|
assertEquals(4,tr.getRows());
|
||||||
assertFalse(te.allPassed());
|
assertFalse(te.allPassed());
|
||||||
@ -68,13 +68,13 @@ public class TestResultTest extends TestCase {
|
|||||||
|
|
||||||
public void testResultDontCare() throws Exception {
|
public void testResultDontCare() throws Exception {
|
||||||
Model model = getModel("A+B");
|
Model model = getModel("A+B");
|
||||||
TestData data = new TestData(
|
TestCaseDescription data = new TestCaseDescription(
|
||||||
"A B Y\n"
|
"A B Y\n"
|
||||||
+ "0 0 0\n"
|
+ "0 0 0\n"
|
||||||
+ "0 1 1\n"
|
+ "0 1 1\n"
|
||||||
+ "1 0 1\n"
|
+ "1 0 1\n"
|
||||||
+ "1 1 x\n");
|
+ "1 1 x\n");
|
||||||
TestExecuter te = new TestExecuter(data).create(model);
|
TestExecutor te = new TestExecutor(data).create(model);
|
||||||
ValueTable tr = te.getResult();
|
ValueTable tr = te.getResult();
|
||||||
assertEquals(4,tr.getRows());
|
assertEquals(4,tr.getRows());
|
||||||
assertTrue(te.allPassed());
|
assertTrue(te.allPassed());
|
||||||
@ -82,13 +82,13 @@ public class TestResultTest extends TestCase {
|
|||||||
|
|
||||||
public void testResultDontCare2() throws Exception {
|
public void testResultDontCare2() throws Exception {
|
||||||
Model model = getModel("A+B");
|
Model model = getModel("A+B");
|
||||||
TestData data = new TestData(
|
TestCaseDescription data = new TestCaseDescription(
|
||||||
"A B Y\n"
|
"A B Y\n"
|
||||||
+ "0 0 x\n"
|
+ "0 0 x\n"
|
||||||
+ "0 1 1\n"
|
+ "0 1 1\n"
|
||||||
+ "1 0 1\n"
|
+ "1 0 1\n"
|
||||||
+ "1 1 1\n");
|
+ "1 1 1\n");
|
||||||
TestExecuter te = new TestExecuter(data).create(model);
|
TestExecutor te = new TestExecutor(data).create(model);
|
||||||
ValueTable tr = te.getResult();
|
ValueTable tr = te.getResult();
|
||||||
assertEquals(4,tr.getRows());
|
assertEquals(4,tr.getRows());
|
||||||
assertTrue(te.allPassed());
|
assertTrue(te.allPassed());
|
||||||
@ -96,11 +96,11 @@ public class TestResultTest extends TestCase {
|
|||||||
|
|
||||||
public void testResultDontCareInput() throws Exception {
|
public void testResultDontCareInput() throws Exception {
|
||||||
Model model = getModel("A*0+B");
|
Model model = getModel("A*0+B");
|
||||||
TestData data = new TestData(
|
TestCaseDescription data = new TestCaseDescription(
|
||||||
"A B Y\n"
|
"A B Y\n"
|
||||||
+ "x 0 0\n"
|
+ "x 0 0\n"
|
||||||
+ "x 1 1\n");
|
+ "x 1 1\n");
|
||||||
TestExecuter te = new TestExecuter(data).create(model);
|
TestExecutor te = new TestExecutor(data).create(model);
|
||||||
ValueTable tr = te.getResult();
|
ValueTable tr = te.getResult();
|
||||||
assertEquals(4,tr.getRows());
|
assertEquals(4,tr.getRows());
|
||||||
assertTrue(te.allPassed());
|
assertTrue(te.allPassed());
|
||||||
@ -108,11 +108,11 @@ public class TestResultTest extends TestCase {
|
|||||||
|
|
||||||
public void testResultDontCareInput2() throws Exception {
|
public void testResultDontCareInput2() throws Exception {
|
||||||
Model model = getModel("A*0+B*0+C");
|
Model model = getModel("A*0+B*0+C");
|
||||||
TestData data = new TestData(
|
TestCaseDescription data = new TestCaseDescription(
|
||||||
"A B C Y\n"
|
"A B C Y\n"
|
||||||
+ "x x 0 0\n"
|
+ "x x 0 0\n"
|
||||||
+ "x x 1 1\n");
|
+ "x x 1 1\n");
|
||||||
TestExecuter te = new TestExecuter(data).create(model);
|
TestExecutor te = new TestExecutor(data).create(model);
|
||||||
ValueTable tr = te.getResult();
|
ValueTable tr = te.getResult();
|
||||||
assertEquals(8,tr.getRows());
|
assertEquals(8,tr.getRows());
|
||||||
assertTrue(te.allPassed());
|
assertTrue(te.allPassed());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user