def test_page_index(self): r = MemoryAccess('00001000', 'R', 0) w = MemoryAccess('00002000', 'W', 0) p = MemoryAccess('00001001', 'R', 0) assert r.page_index == 1 assert w.page_index == 2 assert r.page_index == p.page_index
def skip_test_handling_page_table_full(self): Simulation._load_memory_accesses_from_file = stub_empty_method Simulation._load_replacement_algorithm = stub_empty_method s = Simulation('dummy path', 'dummy alg', 4) a = MemoryAccess('00000000', 'R', 0) e = PageTableFullException() s._handle_page_fault(e, a) assert s.page_fault_counter == 1
def read_memory_access_factory(address='00000000'): return MemoryAccess(address, 'R', 0)
def write_memory_access_factory(address='00000000'): return MemoryAccess(address, 'W', 0)
def _parse_memory_access(self, line, index): [address, access_type] = line.split(' ', 1) access = MemoryAccess(address, access_type, index) access = self.alg.preprocess_memory_access(access) self.accesses.put(access)
def test_write_property(self): w = MemoryAccess('00000000', 'W', 0) assert not w.read assert w.write
def test_read_property(self): r = MemoryAccess('00000000', 'R', 0) assert r.read assert not r.write
def test_save_access_index(self): r = MemoryAccess('00000000', 'R', 1) assert r.index == 1