From add6855399c9655c1c19e1240b7bfbe2c9c726e2 Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Wed, 26 Mar 2014 20:21:16 -0700 Subject: [PATCH] Add tests for changing default radix --- py65/tests/test_monitor.py | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/py65/tests/test_monitor.py b/py65/tests/test_monitor.py index 8827acc..39b7e92 100644 --- a/py65/tests/test_monitor.py +++ b/py65/tests/test_monitor.py @@ -677,6 +677,48 @@ class MonitorTests(unittest.TestCase): out = stdout.getvalue() self.assertTrue(out.startswith("radix [H|D|O|B]")) + def test_radix_no_arg_displays_radix(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_radix('') + out = stdout.getvalue() + self.assertTrue(out.startswith("Default radix is Hexadecimal")) + + def test_radix_invalid_radix_error(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_radix('f') + out = stdout.getvalue() + self.assertTrue(out.startswith("Illegal radix: f")) + + def test_radix_sets_binary(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_radix('b') + out = stdout.getvalue() + self.assertTrue(out.startswith("Default radix is Binary")) + + def test_radix_sets_decimal(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_radix('d') + out = stdout.getvalue() + self.assertTrue(out.startswith("Default radix is Decimal")) + + def test_radix_sets_hexadecimal(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_radix('h') + out = stdout.getvalue() + self.assertTrue(out.startswith("Default radix is Hexadecimal")) + + def test_radix_sets_octal(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.do_radix('o') + out = stdout.getvalue() + self.assertTrue(out.startswith("Default radix is Octal")) + # registers def test_shortcut_for_registers(self):