better explanation of testing in the documentation
@ -6,9 +6,12 @@ import de.neemann.digital.gui.components.graphics.GraphicDialog;
|
||||
import de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog;
|
||||
import de.neemann.digital.gui.components.table.TableDialog;
|
||||
import de.neemann.digital.gui.components.testing.TestCaseDescriptionDialog;
|
||||
import de.neemann.digital.gui.components.testing.ValueTableDialog;
|
||||
import de.neemann.digital.integration.GuiTester;
|
||||
import de.neemann.digital.integration.Resources;
|
||||
import de.neemann.digital.integration.TestInGUI;
|
||||
import de.neemann.digital.lang.Lang;
|
||||
import de.neemann.digital.testing.TestCaseElement;
|
||||
import de.neemann.gui.language.Language;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@ -164,12 +167,46 @@ public class ScreenShots {
|
||||
.add(new GuiTester.WindowCheck<>(Main.class, (gt, w) -> w.setSize(WIN_DX, WIN_DY)))
|
||||
.delay(500)
|
||||
.add(new ScreenShot<>(Main.class))
|
||||
.add(new TestInGUI.SetMouseToElement((v) -> v.equalsDescription(TestCaseElement.TESTCASEDESCRIPTION)))
|
||||
.mouseClick(InputEvent.BUTTON3_MASK)
|
||||
.delay(500)
|
||||
.add(new GuiTester.WindowCheck<>(AttributeDialog.class, (gt, w) -> {
|
||||
Point p = w.getLocation();
|
||||
p.y -= 50;
|
||||
p.x -= 70;
|
||||
w.setLocation(p);
|
||||
}))
|
||||
.delay(500)
|
||||
.press("TAB", "SPACE")
|
||||
.delay(500)
|
||||
.add(new GuiTester.WindowCheck<>(TestCaseDescriptionDialog.class, (gt, w) -> {
|
||||
Point p = w.getLocation();
|
||||
p.y -= 50;
|
||||
p.x -= 50;
|
||||
w.setLocation(p);
|
||||
w.getContentPane().setPreferredSize(new Dimension(400, 300));
|
||||
w.pack();
|
||||
}))
|
||||
.delay(500)
|
||||
.add(new ScreenShot<>(TestCaseDescriptionDialog.class).useParent().useParent())
|
||||
.add(new GuiTester.CloseTopMost())
|
||||
.add(new GuiTester.CloseTopMost())
|
||||
.press("F8")
|
||||
.add(new GuiTester.WindowCheck<>(ValueTableDialog.class, (gt, w) -> {
|
||||
Point p = w.getLocation();
|
||||
p.y += 90;
|
||||
w.setLocation(p);
|
||||
w.getContentPane().setPreferredSize(new Dimension(400, 300));
|
||||
w.pack();
|
||||
}))
|
||||
.add(new ScreenShot<>(ValueTableDialog.class).useParent())
|
||||
.execute();
|
||||
new GuiTester("dig/test/docu/rcAdder.dig", "rcAdder.dig")
|
||||
.add(new GuiTester.WindowCheck<>(Main.class, (gt, w) -> w.setSize(WIN_DX, WIN_DY)))
|
||||
.delay(500)
|
||||
.add(new ScreenShot<>(Main.class))
|
||||
.add(new ClickAtCircuit(600, 380, InputEvent.BUTTON3_MASK))
|
||||
.add(new TestInGUI.SetMouseToElement((v) -> v.equalsDescription(TestCaseElement.TESTCASEDESCRIPTION)))
|
||||
.mouseClick(InputEvent.BUTTON3_MASK)
|
||||
.delay(500)
|
||||
.add(new GuiTester.WindowCheck<>(AttributeDialog.class, (gt, w) -> {
|
||||
Point p = w.getLocation();
|
||||
|
@ -879,7 +879,7 @@ public class TestInGUI extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private static class SetMouseToElement extends GuiTester.WindowCheck<Main> {
|
||||
public static class SetMouseToElement extends GuiTester.WindowCheck<Main> {
|
||||
private final Circuit.ElementFilter filter;
|
||||
|
||||
public SetMouseToElement(Circuit.ElementFilter filter) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
<string>A</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="320" y="180"/>
|
||||
<pos x="320" y="160"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
@ -91,6 +91,10 @@
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="320" y="160"/>
|
||||
<p2 x="340" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="620" y="160"/>
|
||||
<p2 x="640" y="160"/>
|
||||
@ -99,14 +103,14 @@
|
||||
<p1 x="420" y="180"/>
|
||||
<p2 x="440" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="180"/>
|
||||
<p2 x="360" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="180"/>
|
||||
<p2 x="560" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="180"/>
|
||||
<p2 x="360" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="100"/>
|
||||
<p2 x="460" y="100"/>
|
||||
@ -139,6 +143,10 @@
|
||||
<p1 x="540" y="140"/>
|
||||
<p2 x="560" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="160"/>
|
||||
<p2 x="340" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="200"/>
|
||||
<p2 x="340" y="220"/>
|
||||
|
@ -6,12 +6,12 @@
|
||||
<visualElement>
|
||||
<elementName>XOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="600" y="240"/>
|
||||
<pos x="620" y="240"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="600" y="320"/>
|
||||
<pos x="620" y="320"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
@ -56,36 +56,36 @@
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="560" y="240"/>
|
||||
<p2 x="580" y="320"/>
|
||||
<p1 x="600" y="280"/>
|
||||
<p2 x="560" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="280"/>
|
||||
<p2 x="560" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="320"/>
|
||||
<p1 x="560" y="280"/>
|
||||
<p2 x="600" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="600" y="320"/>
|
||||
<p2 x="620" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="240"/>
|
||||
<p2 x="560" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="560" y="240"/>
|
||||
<p2 x="600" y="240"/>
|
||||
<p2 x="620" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="660" y="260"/>
|
||||
<p1 x="680" y="260"/>
|
||||
<p2 x="720" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="660" y="340"/>
|
||||
<p1 x="680" y="340"/>
|
||||
<p2 x="720" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="280"/>
|
||||
<p2 x="600" y="280"/>
|
||||
<p1 x="600" y="280"/>
|
||||
<p2 x="620" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="360"/>
|
||||
@ -93,7 +93,15 @@
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="560" y="360"/>
|
||||
<p2 x="600" y="360"/>
|
||||
<p2 x="620" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="560" y="240"/>
|
||||
<p2 x="560" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="560" y="320"/>
|
||||
<p2 x="560" y="360"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 46 KiB |
BIN
src/test/resources/docu/images/de/scr24.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
src/test/resources/docu/images/de/scr25.png
Normal file
After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 46 KiB |
BIN
src/test/resources/docu/images/en/scr24.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
src/test/resources/docu/images/en/scr25.png
Normal file
After Width: | Height: | Size: 56 KiB |
@ -164,13 +164,25 @@
|
||||
Der Volladdierer addiert die drei Bits 'A', 'B' und 'Ci' und gibt die Summe an 'S' und 'Co' aus.
|
||||
</par>
|
||||
<par><image src="scr22.png"/></par>
|
||||
<par>
|
||||
Um die korrekte Funktion des Volladdierers zu überprüfen, sollte ein Testfall angelegt werden.
|
||||
Im Testfall wird die Warheitstabelle hinterlegt, welche die Schaltung erfüllen soll. Auf diese Weise
|
||||
kann automatisch überprüft werden, ob das tatsächlich der Fall ist.
|
||||
</par>
|
||||
<par><image src="scr23.png"/></par>
|
||||
<par>
|
||||
Über den Testfall-Editor oder den Testknopf in der Toolbar können die Tests ausgeführt werden.
|
||||
Die in der Tabelle grün hinterlegten Felder zeigen an, dass die Ausgabe der Schaltung mit der Vorgabe
|
||||
in der Wertetabelle des Testfalls übereinstimmt.
|
||||
</par>
|
||||
<par><image src="scr24.png"/></par>
|
||||
<par>
|
||||
Nun lassen sich die Volladdierer zu einem so gen. Ripple-Carry Addierer zusammensetzen. Dabei wird
|
||||
der Carry-Ausgang einer Addition als Carry-Eingang an die Addition des nächst höherwertigen Bits
|
||||
weitergegeben, genau so, wie es bei der schriftlichen Addition üblich ist. Dieser 4-Bit Addierer soll
|
||||
auf korrekte Funktion überprüft werden. Dazu wurde ein Testfall eingefügt.
|
||||
auf korrekte Funktion überprüft werden. Dazu wurde auch hier ein Testfall eingefügt.
|
||||
</par>
|
||||
<par><image src="scr23.png"/></par>
|
||||
<par><image src="scr25.png"/></par>
|
||||
<par>
|
||||
Dieser Testfall führt einen 100% Test durch, was nur bei relativ einfachen Schaltungen möglich ist:
|
||||
Alle möglichen 512 Eingangskombinationen werden an die
|
||||
|
@ -149,13 +149,25 @@
|
||||
The full adder adds the three bits 'A', 'B' and 'Ci' and gives the sum to the outputs 'S' and 'Co'.
|
||||
</par>
|
||||
<par><image src="scr22.png"/></par>
|
||||
<par>
|
||||
In order to check the correct function of the full adder, a test case should be added. In the test case,
|
||||
the truth table is stored, which should fulfill the circuit. In this way it can be automatically
|
||||
checked whether this is the case.
|
||||
</par>
|
||||
<par><image src="scr23.png"/></par>
|
||||
<par>
|
||||
The tests can be executed via the test case editor or the test button in the toolbar.
|
||||
The table cells highlighted in green indicate that the output of the circuit matches
|
||||
the truth table given in the test case.
|
||||
</par>
|
||||
<par><image src="scr24.png"/></par>
|
||||
<par>
|
||||
Now the full adders can be put together to form a so-called ripple-carry adder.
|
||||
In this case, the carry output of an addition is forwarded as a carry input to the addition of the
|
||||
next higher-order bit, just as it is usual in pencil-and-paper addition.
|
||||
This 4-bit adder should be tested for correct function. For this purpose a test case was inserted.
|
||||
</par>
|
||||
<par><image src="scr23.png"/></par>
|
||||
<par><image src="scr25.png"/></par>
|
||||
<par>
|
||||
This test case performs a 100% test, which is possible only with relatively simple circuits: all
|
||||
possible 512 input combinations are applied to the circuit, and it is checked whether the output
|
||||
|