Esempio n. 1
0
    def testFill(self):

        params = dict(R=0, S=6, Z=0, F=0)

        e = OpcodeEffect("read: #R #F write: #S #Z #F:0")
        reads, writes, values = e.filled(params)
        self.assertEquals(reads, set(["B", "C", "FZ", "H", "L"]))
        self.assertEquals(writes, set(["mem", "B", "FZ"]))
        self.assertEquals(values, dict(FZ="0"))
Esempio n. 2
0
    def testBasic(self):
        e = OpcodeEffect("read: write:")
        reads, writes, values = e.filled(None)
        self.assertFalse(reads)
        self.assertFalse(writes)
        self.assertFalse(values)

        e = OpcodeEffect("read: A HL write: BC HL")
        reads, writes, values = e.filled(None)
        self.assertEquals(reads, set(["A", "H", "L"]))
        self.assertEquals(writes, set(["B", "C", "H", "L"]))
        self.assertFalse(values)

        e = OpcodeEffect("read: FC FN write: FN:0 FZ mem FC:1")
        reads, writes, values = e.filled(None)
        self.assertEquals(reads, set(["FC", "FN"]))
        self.assertEquals(writes, set(["FN", "FZ", "FC", "mem"]))
        self.assertEquals(values, dict(FN="0", FC="1"))