|
@@ -31,255 +31,168 @@ class TestSingleMnemonics {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testBSET() throws SyntaxError {
|
|
|
- BSET mno = new BSET("BSET");
|
|
|
- assertEquals(0x51, mno.getByte());
|
|
|
+ void testPUSH() throws SyntaxError {
|
|
|
+ PUSH mno = new PUSH("PUSH");
|
|
|
+ assertEquals(0x5f, mno.getByte());
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- BSET mno1 = new BSET("BSET akfhaskh");
|
|
|
+ PUSH mno1 = new PUSH("PUSH akfhaskh");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- BSET mno1 = new BSET("BSET 12");
|
|
|
+ PUSH mno1 = new PUSH("PUSH 12");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- BSET mno1 = new BSET("BSET :label");
|
|
|
+ PUSH mno1 = new PUSH("PUSH :label");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testSETB() throws SyntaxError {
|
|
|
- SETB mno = new SETB("SETB");
|
|
|
- assertEquals(0x61, mno.getByte());
|
|
|
+ void testPOP() throws SyntaxError {
|
|
|
+ POP mno = new POP("POP");
|
|
|
+ assertEquals(0x6f, mno.getByte());
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETB mno1 = new SETB("SETB akfhaskh");
|
|
|
+ POP mno1 = new POP("POP akfhaskh");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETB mno1 = new SETB("SETB 12");
|
|
|
+ POP mno1 = new POP("POP 12");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETB mno1 = new SETB("SETB :label");
|
|
|
+ POP mno1 = new POP("POP :label");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testCSET() throws SyntaxError {
|
|
|
- CSET mno = new CSET("CSET");
|
|
|
- assertEquals(0x52, mno.getByte());
|
|
|
+ void testINC() throws SyntaxError {
|
|
|
+ INC mno = new INC("INC");
|
|
|
+ assertEquals(0x71, mno.getByte());
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- CSET mno1 = new CSET("CSET akfhaskh");
|
|
|
+ INC mno1 = new INC("INC akfhaskh");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- CSET mno1 = new CSET("CSET 12");
|
|
|
+ INC mno1 = new INC("INC 12");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- CSET mno1 = new CSET("CSET :label");
|
|
|
+ INC mno1 = new INC("INC :label");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testSETC() throws SyntaxError {
|
|
|
- SETC mno = new SETC("SETC");
|
|
|
- assertEquals(0x62, mno.getByte());
|
|
|
+ void testDEC() throws SyntaxError {
|
|
|
+ DEC mno = new DEC("DEC");
|
|
|
+ assertEquals(0x72, mno.getByte());
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETC mno1 = new SETC("SETC akfhaskh");
|
|
|
+ DEC mno1 = new DEC("DEC akfhaskh");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETC mno1 = new SETC("SETC 12");
|
|
|
+ DEC mno1 = new DEC("DEC 12");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETC mno1 = new SETC("SETC :label");
|
|
|
+ DEC mno1 = new DEC("DEC :label");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testDSET() throws SyntaxError {
|
|
|
- DSET mno = new DSET("DSET");
|
|
|
- assertEquals(0x53, mno.getByte());
|
|
|
+ void testADD() throws SyntaxError {
|
|
|
+ ADD mno = new ADD("ADD");
|
|
|
+ assertEquals(0x73, mno.getByte());
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- DSET mno1 = new DSET("DSET akfhaskh");
|
|
|
+ ADD mno1 = new ADD("DEC akfhaskh");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- DSET mno1 = new DSET("DSET 12");
|
|
|
+ ADD mno1 = new ADD("ADD 12");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
|
|
|
Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- DSET mno1 = new DSET("DSET :label");
|
|
|
+ ADD mno1 = new ADD("ADD :label");
|
|
|
mno1.checkArgument();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testSETD() throws SyntaxError {
|
|
|
- SETD mno = new SETD("SETD");
|
|
|
- assertEquals(0x63, mno.getByte());
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETD mno1 = new SETD("SETD akfhaskh");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETD mno1 = new SETD("SETD 12");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETD mno1 = new SETD("SETD :label");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ void testSUB() throws SyntaxError {
|
|
|
+ SUB mno = new SUB("SUB");
|
|
|
+ assertEquals(0x74, mno.getByte());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testESET() throws SyntaxError {
|
|
|
- ESET mno = new ESET("ESET");
|
|
|
- assertEquals(0x5d, mno.getByte());
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- ESET mno1 = new ESET("ESET akfhaskh");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- ESET mno1 = new ESET("ESET 12");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- ESET mno1 = new ESET("ESET :label");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ void testMUL() throws SyntaxError {
|
|
|
+ MUL mno = new MUL("MUL");
|
|
|
+ assertEquals(0x75, mno.getByte());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testSETE() throws SyntaxError {
|
|
|
- SETE mno = new SETE("SETE");
|
|
|
- assertEquals(0x6D, mno.getByte());
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETE mno1 = new SETE("SETE akfhaskh");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETE mno1 = new SETE("SETE 12");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETE mno1 = new SETE("SETE :label");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ void testDIV() throws SyntaxError {
|
|
|
+ DIV mno = new DIV("DIV");
|
|
|
+ assertEquals(0x76, mno.getByte());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testFSET() throws SyntaxError {
|
|
|
- FSET mno = new FSET("FSET");
|
|
|
- assertEquals(0x5e, mno.getByte());
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- FSET mno1 = new FSET("FSET akfhaskh");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- FSET mno1 = new FSET("FSET 12");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- FSET mno1 = new FSET("FSET :label");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ void testAND() throws SyntaxError {
|
|
|
+ AND mno = new AND("AND");
|
|
|
+ assertEquals(0x77, mno.getByte());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testSETF() throws SyntaxError {
|
|
|
- SETF mno = new SETF("SETF");
|
|
|
- assertEquals(0x6E, mno.getByte());
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETF mno1 = new SETF("SETF akfhaskh");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETF mno1 = new SETF("SETF 12");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- SETF mno1 = new SETF("SETF :label");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ void testOR() throws SyntaxError {
|
|
|
+ OR mno = new OR("OR");
|
|
|
+ assertEquals(0x78, mno.getByte());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testPUSH() throws SyntaxError {
|
|
|
- PUSH mno = new PUSH("PUSH");
|
|
|
- assertEquals(0x5f, mno.getByte());
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- PUSH mno1 = new PUSH("PUSH akfhaskh");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- PUSH mno1 = new PUSH("PUSH 12");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
-
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- PUSH mno1 = new PUSH("PUSH :label");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ void testXOR() throws SyntaxError {
|
|
|
+ XOR mno = new XOR("XOR");
|
|
|
+ assertEquals(0x79, mno.getByte());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testPOP() throws SyntaxError {
|
|
|
- POP mno = new POP("POP");
|
|
|
- assertEquals(0x6f, mno.getByte());
|
|
|
+ void testNOT() throws SyntaxError {
|
|
|
+ NOT mno = new NOT("NOT");
|
|
|
+ assertEquals(0x7a, mno.getByte());
|
|
|
+ }
|
|
|
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- POP mno1 = new POP("POP akfhaskh");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ @Test
|
|
|
+ void testMOD() throws SyntaxError {
|
|
|
+ MOD mno = new MOD("MOD");
|
|
|
+ assertEquals(0x7b, mno.getByte());
|
|
|
+ }
|
|
|
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- POP mno1 = new POP("POP 12");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ @Test
|
|
|
+ void testBYTE() throws SyntaxError {
|
|
|
+ BYTE mno = new BYTE("BYTE");
|
|
|
+ assertEquals(0x7c, mno.getByte());
|
|
|
+ }
|
|
|
|
|
|
- Assertions.assertThrows(SyntaxError.class, () -> {
|
|
|
- POP mno1 = new POP("POP :label");
|
|
|
- mno1.checkArgument();
|
|
|
- });
|
|
|
+ @Test
|
|
|
+ void testBSUBA() throws SyntaxError {
|
|
|
+ BSUBA mno = new BSUBA("BSUBA");
|
|
|
+ assertEquals(0x7d, mno.getByte());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -287,37 +200,46 @@ class TestSingleMnemonics {
|
|
|
Mnemonic mnemonic = MnemonicFactory.getMnemonic("SWAP", 0);
|
|
|
assertEquals(SWAP.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("BSET", 0);
|
|
|
- assertEquals(BSET.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("PUSH", 0);
|
|
|
+ assertEquals(PUSH.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("CSET", 0);
|
|
|
- assertEquals(CSET.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("INC", 0);
|
|
|
+ assertEquals(INC.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("DSET", 0);
|
|
|
- assertEquals(DSET.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("DEC", 0);
|
|
|
+ assertEquals(DEC.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("ESET", 0);
|
|
|
- assertEquals(ESET.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("ADD", 0);
|
|
|
+ assertEquals(ADD.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("FSET", 0);
|
|
|
- assertEquals(FSET.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("SUB", 0);
|
|
|
+ assertEquals(SUB.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("PUSH", 0);
|
|
|
- assertEquals(PUSH.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("MUL", 0);
|
|
|
+ assertEquals(MUL.class, mnemonic.getClass());
|
|
|
+
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("DIV", 0);
|
|
|
+ assertEquals(DIV.class, mnemonic.getClass());
|
|
|
+
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("AND", 0);
|
|
|
+ assertEquals(AND.class, mnemonic.getClass());
|
|
|
+
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("OR", 0);
|
|
|
+ assertEquals(OR.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("SETB", 0);
|
|
|
- assertEquals(SETB.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("XOR", 0);
|
|
|
+ assertEquals(XOR.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("SETC", 0);
|
|
|
- assertEquals(SETC.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("NOT", 0);
|
|
|
+ assertEquals(NOT.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("SETD", 0);
|
|
|
- assertEquals(SETD.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("MOD", 0);
|
|
|
+ assertEquals(MOD.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("SETE", 0);
|
|
|
- assertEquals(SETE.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("BYTE", 0);
|
|
|
+ assertEquals(BYTE.class, mnemonic.getClass());
|
|
|
|
|
|
- mnemonic = MnemonicFactory.getMnemonic("SETF", 0);
|
|
|
- assertEquals(SETF.class, mnemonic.getClass());
|
|
|
+ mnemonic = MnemonicFactory.getMnemonic("BSUBA", 0);
|
|
|
+ assertEquals(BSUBA.class, mnemonic.getClass());
|
|
|
}
|
|
|
}
|