Esempio n. 1
0
class TestCPUMMV:

    """Smoke test for mm-v."""

    cpu = None
    source = None

    def setup(self):
        """Init state."""
        self.cpu = CPUMMV(protect_memory=False)
        self.source = ("[config]\n" +
                       "input=0x100,0x105\n" +
                       "output=0x10a\n" +
                       "[code]\n" +
                       "01 0100 0105\n" +
                       "00 010a 0100\n" +
                       "05 0100 0105\n" +
                       "86 0017\n" +
                       "02 0103 0103; never be used\n" +
                       "02 010a 001d\n" +
                       "99\n" +
                       "0000000002\n" +
                       "[input]\n" +
                       "100 200\n")

    def test_smoke(self, tmpdir):
        """Smoke test."""
        self.cpu.load_program(self.source.split('\n'))
        out = tmpdir.join("output.txt")
        with open(str(out), 'w') as output:
            self.cpu.run(output=output)

        assert out.read() == "298\n"
Esempio n. 2
0
 def setup(self):
     """Init state."""
     self.cpu = CPUMMV(protect_memory=False)
     self.source = ("[config]\n" +
                    "input=0x100,0x105\n" +
                    "output=0x10a\n" +
                    "[code]\n" +
                    "01 0100 0105\n" +
                    "00 010a 0100\n" +
                    "05 0100 0105\n" +
                    "86 0017\n" +
                    "02 0103 0103; never be used\n" +
                    "02 010a 001d\n" +
                    "99\n" +
                    "0000000002\n" +
                    "[input]\n" +
                    "100 200\n")