def mem_cache_bstr_write_test(): mem = MemoryCache(0x100, 0x100) data = "hello, world" mem.w_bstr(0x100, data) assert mem.r_bstr(0x100) == data empty = "" mem.w_bstr(0x180, empty) assert mem.r_bstr(0x180) == empty # to main main_mem = MockMemory() mem.write_cache(main_mem) assert main_mem.r_bstr(0x100) == data assert main_mem.r_bstr(0x180) == empty
def mem_cache_bstr_write_test(): mem = MemoryCache(0x100, 0x100) data = "hello, world" mem.w_bstr(0x100, data) assert mem.r_bstr(0x100) == data empty = "" mem.w_bstr(0x180, empty) assert mem.r_bstr(0x180) == empty # to main main_mem = MockMemory() mem.write_cache(main_mem) assert main_mem.r_bstr(0x100) == data assert main_mem.r_bstr(0x180) == empty
def mem_cache_bstr_read_test(): mem = MockMemory() mem = MemoryCache(0x100, 0x100) data = "hello, world" mem.w_bstr(0x100, data) assert mem.r_bstr(0x100) == data empty = "" mem.w_bstr(0x180, empty) assert mem.r_bstr(0x180) == empty # to cache cmem = MemoryCache(0x100, 0x100) cmem.read_cache(mem) assert cmem.r_bstr(0x100) == data assert cmem.r_bstr(0x180) == empty
def mem_cache_bstr_read_test(): mem = MockMemory() mem = MemoryCache(0x100, 0x100) data = "hello, world" mem.w_bstr(0x100, data) assert mem.r_bstr(0x100) == data empty = "" mem.w_bstr(0x180, empty) assert mem.r_bstr(0x180) == empty # to cache cmem = MemoryCache(0x100, 0x100) cmem.read_cache(mem) assert cmem.r_bstr(0x100) == data assert cmem.r_bstr(0x180) == empty