|
@@ -13,6 +13,7 @@ import de.mcs.tools.sps.exceptions.SyntaxError;
|
|
class TestDOUT {
|
|
class TestDOUT {
|
|
|
|
|
|
private static final int BYTE_VALUE = 0x54;
|
|
private static final int BYTE_VALUE = 0x54;
|
|
|
|
+ private static final int PORT_BYTE_VALUE = 0x10;
|
|
private final String MNEMONIC = "DOUT";
|
|
private final String MNEMONIC = "DOUT";
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -31,6 +32,18 @@ class TestDOUT {
|
|
mnemonic.checkArgument();
|
|
mnemonic.checkArgument();
|
|
assertEquals(BYTE_VALUE + 0x04, mnemonic.getByte());
|
|
assertEquals(BYTE_VALUE + 0x04, mnemonic.getByte());
|
|
|
|
|
|
|
|
+ mnemonic = new DOUT(MNEMONIC + " #0x04");
|
|
|
|
+ mnemonic.checkArgument();
|
|
|
|
+ assertEquals(PORT_BYTE_VALUE + 0x04, mnemonic.getByte());
|
|
|
|
+
|
|
|
|
+ mnemonic = new DOUT(MNEMONIC + " #0x00");
|
|
|
|
+ mnemonic.checkArgument();
|
|
|
|
+ assertEquals(PORT_BYTE_VALUE + 0x00, mnemonic.getByte());
|
|
|
|
+
|
|
|
|
+ mnemonic = new DOUT(MNEMONIC + " #0x0f");
|
|
|
|
+ mnemonic.checkArgument();
|
|
|
|
+ assertEquals(PORT_BYTE_VALUE + 0x0f, mnemonic.getByte());
|
|
|
|
+
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
DOUT mno1 = new DOUT(MNEMONIC + " 0x05");
|
|
DOUT mno1 = new DOUT(MNEMONIC + " 0x05");
|
|
mno1.checkArgument();
|
|
mno1.checkArgument();
|
|
@@ -40,6 +53,11 @@ class TestDOUT {
|
|
DOUT mno1 = new DOUT(MNEMONIC + " 0x10");
|
|
DOUT mno1 = new DOUT(MNEMONIC + " 0x10");
|
|
mno1.checkArgument();
|
|
mno1.checkArgument();
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ Assertions.assertThrows(IllegalArgument.class, () -> {
|
|
|
|
+ DOUT mno1 = new DOUT(MNEMONIC + " #0x10");
|
|
|
|
+ mno1.checkArgument();
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -47,6 +65,9 @@ class TestDOUT {
|
|
Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC, 0);
|
|
Mnemonic mnemonic = MnemonicFactory.getMnemonic(MNEMONIC, 0);
|
|
assertEquals(DOUT.class, mnemonic.getClass());
|
|
assertEquals(DOUT.class, mnemonic.getClass());
|
|
|
|
|
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " #0x04", 0);
|
|
|
|
+ assertEquals(DOUT.class, mnemonic.getClass());
|
|
|
|
+
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
|
|
MnemonicFactory.getMnemonic(MNEMONIC + " 0x00", 0);
|
|
});
|
|
});
|
|
@@ -58,8 +79,8 @@ class TestDOUT {
|
|
mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
|
|
mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0x02", 0);
|
|
assertEquals(BYTE_VALUE + 0x02, mnemonic.getByte());
|
|
assertEquals(BYTE_VALUE + 0x02, mnemonic.getByte());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 3", 0);
|
|
|
|
- assertEquals(BYTE_VALUE + 3, mnemonic.getByte());
|
|
|
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " #3", 0);
|
|
|
|
+ assertEquals(PORT_BYTE_VALUE + 3, mnemonic.getByte());
|
|
|
|
|
|
mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000100", 0);
|
|
mnemonic = MnemonicFactory.getMnemonic(MNEMONIC + " 0b00000100", 0);
|
|
assertEquals(BYTE_VALUE + 4, mnemonic.getByte());
|
|
assertEquals(BYTE_VALUE + 4, mnemonic.getByte());
|