Skip to content
Snippets Groups Projects
Commit 386d4d6c authored by Johannes Kung's avatar Johannes Kung
Browse files

Fixed broken tests due to renambed processor attributes

parent ab5674b3
No related branches found
No related tags found
1 merge request!39Moved printing functionality out from Processor class + minor refactor of...
Pipeline #133084 failed
...@@ -201,14 +201,14 @@ def test_add_remove_memory_breakpoint(): ...@@ -201,14 +201,14 @@ def test_add_remove_memory_breakpoint():
mem = Memory(in_s, out_s, ctrl_s, adr_s, 8) mem = Memory(in_s, out_s, ctrl_s, adr_s, 8)
cpu.add_module(mem) cpu.add_module(mem)
assert len(cpu.breakpoints) == 0 assert len(cpu._breakpoints) == 0
assert cpu.breakpoint_id_counter == 1 assert cpu._breakpoint_id_counter == 1
cpu.add_memory_breakpoint("Memory", 1, 1) cpu.add_memory_breakpoint("Memory", 1, 1)
assert cpu.breakpoint_id_counter == 2 assert cpu._breakpoint_id_counter == 2
assert len(cpu.breakpoints) == 1 assert len(cpu._breakpoints) == 1
assert cpu.remove_breakpoint(1) == True assert cpu.remove_breakpoint(1) == True
assert cpu.breakpoints == {} assert cpu._breakpoints == {}
assert len(cpu.breakpoints) == 0 assert len(cpu._breakpoints) == 0
def test_stop_on_memory_breakpoint(): def test_stop_on_memory_breakpoint():
...@@ -223,7 +223,7 @@ def test_stop_on_memory_breakpoint(): ...@@ -223,7 +223,7 @@ def test_stop_on_memory_breakpoint():
mem = Memory(in_s, out_s, ctrl_s, adr_s, 8) mem = Memory(in_s, out_s, ctrl_s, adr_s, 8)
cpu.add_module(mem) cpu.add_module(mem)
assert mem._memory == [0 for _ in range(8)] assert mem._memory == [0 for _ in range(8)]
assert cpu.clock == 0 assert cpu._clock == 0
in_s.update_value(1) in_s.update_value(1)
ctrl_s.update_value(True) ctrl_s.update_value(True)
...@@ -235,7 +235,7 @@ def test_stop_on_memory_breakpoint(): ...@@ -235,7 +235,7 @@ def test_stop_on_memory_breakpoint():
cpu.run_continuously() cpu.run_continuously()
assert mem._memory == [0, 0, 1, 0, 0, 0, 0, 0] assert mem._memory == [0, 0, 1, 0, 0, 0, 0, 0]
assert cpu.is_stopped == True assert cpu.is_stopped == True
assert cpu.clock == 2 assert cpu._clock == 2
mem._memory = [0 for _ in range(8)] mem._memory = [0 for _ in range(8)]
in_s.update_value(1) in_s.update_value(1)
...@@ -257,14 +257,14 @@ def test_add_remove_state_breakpoint(): ...@@ -257,14 +257,14 @@ def test_add_remove_state_breakpoint():
lc = LC(s, s, s, s) lc = LC(s, s, s, s)
cpu.add_module(lc) cpu.add_module(lc)
assert len(cpu.breakpoints) == 0 assert len(cpu._breakpoints) == 0
assert cpu.breakpoint_id_counter == 1 assert cpu._breakpoint_id_counter == 1
cpu.add_state_breakpoint("LC", "value", 1) cpu.add_state_breakpoint("LC", "value", 1)
assert len(cpu.breakpoints) == 1 assert len(cpu._breakpoints) == 1
assert cpu.breakpoint_id_counter == 2 assert cpu._breakpoint_id_counter == 2
assert cpu.remove_breakpoint(1) == True assert cpu.remove_breakpoint(1) == True
assert cpu.breakpoints == {} assert cpu._breakpoints == {}
assert len(cpu.breakpoints) == 0 assert len(cpu._breakpoints) == 0
def test_stop_on_state_breakpoint(): def test_stop_on_state_breakpoint():
......
...@@ -35,22 +35,22 @@ class DummyModule(Module): ...@@ -35,22 +35,22 @@ class DummyModule(Module):
def test_reset(): def test_reset():
cpu = Processor() cpu = Processor()
cpu.signal_history = ["this", "should", "be", "removed"] cpu._signal_history = ["this", "should", "be", "removed"]
dummy = DummyModule() dummy = DummyModule()
cpu.clock = 100 cpu._clock = 100
cpu.removed_cycles = 1337 cpu._removed_cycles = 1337
cpu.module_history.append(dummy.get_state()) cpu._module_history.append(dummy.get_state())
cpu.signal_history.clear() cpu._signal_history.clear()
cpu.removed_cycles = 0 cpu._removed_cycles = 0
cpu.assembly_cycles = [i for i in range(9)] cpu._assembly_cycles = [i for i in range(9)]
cpu.add_module(dummy) cpu.add_module(dummy)
cpu.reset() cpu.reset()
assert dummy.name == "dummy" assert dummy.name == "dummy"
assert dummy.a == 0 assert dummy.a == 0
assert dummy.b == "" assert dummy.b == ""
assert dummy.c == [] assert dummy.c == []
assert cpu.clock == 0 assert cpu._clock == 0
assert cpu.removed_cycles == 0 assert cpu._removed_cycles == 0
assert cpu.module_history == [] assert cpu._module_history == []
assert cpu.signal_history == [] assert cpu._signal_history == []
assert cpu.assembly_cycles == [0] assert cpu._assembly_cycles == [0]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment