예제 #1
0
파일: test_monitor.py 프로젝트: offe/py65
    def test_load(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)

        f = tempfile.NamedTemporaryFile()
        f.write(chr(0xAA) + chr(0xBB) + chr(0xCC)) 
        f.flush()
        
        mon.do_load("'%s' a600" % f.name)
        self.assertEqual([0xAA, 0xBB, 0xCC], mon._mpu.memory[0xA600:0xA603])
        self.assertEqual('Wrote +3 bytes from $a600 to $a602\n',
                         stdout.getvalue())
        f.close()                     
예제 #2
0
    def test_load(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)

        f = tempfile.NamedTemporaryFile()
        f.write(b'\xaa\xbb\xcc')
        f.flush()
        
        mon.do_load("'%s' a600" % f.name)
        self.assertEqual([0xAA, 0xBB, 0xCC], mon._mpu.memory[0xA600:0xA603])
        self.assertEqual('Wrote +3 bytes from $a600 to $a602\n',
                         stdout.getvalue())
        f.close()                     
예제 #3
0
    def test_load(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)

        filename = tempfile.mktemp()
        try:
            f = open(filename, "wb")
            f.write(b"\xaa\xbb\xcc")
            f.close()

            mon.do_load("'%s' a600" % filename)
            self.assertEqual("Wrote +3 bytes from $a600 to $a602\n", stdout.getvalue())
            self.assertEqual([0xAA, 0xBB, 0xCC], mon._mpu.memory[0xA600:0xA603])
        finally:
            os.unlink(filename)
예제 #4
0
    def test_load(self):
        stdout = StringIO()
        mon = Monitor(stdout=stdout)

        filename = tempfile.mktemp()
        try:
            f = open(filename, 'wb')
            f.write(chr(0xAA) + chr(0xBB) + chr(0xCC))
            f.close()

            mon.do_load("'%s' a600" % filename)
            self.assertEqual('Wrote +3 bytes from $a600 to $a602\n',
                             stdout.getvalue())
            self.assertEqual([0xAA, 0xBB, 0xCC],
                             mon._mpu.memory[0xA600:0xA603])
        finally:
            os.unlink(filename)
예제 #5
0
 def test_load_with_more_than_two_args_syntax_error(self):
     stdout = StringIO()
     mon = Monitor(stdout=stdout)
     mon.do_load('one two three')
     out = stdout.getvalue()
     self.assertTrue(out.startswith('Syntax error'))
예제 #6
0
 def test_load_with_more_than_two_args_syntax_error(self):
     stdout = StringIO()
     mon = Monitor(stdout=stdout)
     mon.do_load('one two three')
     out = stdout.getvalue()
     self.assertTrue(out.startswith('Syntax error'))