Пример #1
0
class TestCPUMMM:

    """Smoke test for mm-m."""

    cpu = None
    source = None

    def setup(self):
        """Init state."""
        self.cpu = CPUMMM(protect_memory=False)
        self.source = ("[config]\n" +
                       "input=0x100,0x102\n" +
                       "output=0x104\n" +
                       "[code]\n" +
                       "00 0 0 0100\n" +
                       "03 0 0 000C\n" +
                       "04 0 0 000E\n" +
                       "02 1 0 0102\n" +
                       "23 1 1; coment never be used\n" +
                       "10 1 0 0104\n" +
                       "99 0 0\n" +
                       "; -----------\n"
                       "ffffffeb\n" +
                       "00000032\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() == "40000\n"
Пример #2
0
 def setup(self):
     """Init state."""
     self.cpu = CPUMMM(protect_memory=False)
     self.source = ("[config]\n" +
                    "input=0x100,0x102\n" +
                    "output=0x104\n" +
                    "[code]\n" +
                    "00 0 0 0100\n" +
                    "03 0 0 000C\n" +
                    "04 0 0 000E\n" +
                    "02 1 0 0102\n" +
                    "23 1 1; coment never be used\n" +
                    "10 1 0 0104\n" +
                    "99 0 0\n" +
                    "; -----------\n"
                    "ffffffeb\n" +
                    "00000032\n" +
                    "[input]\n" +
                    "100 200\n")