Beispiel #1
0
def atypes_node_remove_test():
  mem = MockMemory()
  text = 'hello, world!'
  mem.w_cstr(12, text)
  node = Node(mem, 0x80)
  node.setup(0x60, 0x100, NodeType.NT_DEVICE, -5, 12)
  node.remove()
Beispiel #2
0
def atypes_node_remove_test():
    mem = MockMemory()
    text = 'hello, world!'
    mem.w_cstr(12, text)
    node = Node(mem, 0x80)
    node.setup(0x60, 0x100, NodeType.NT_DEVICE, -5, 12)
    node.remove()
Beispiel #3
0
def machine_mem_cstr_test():
    mem = MockMemory()
    data = "hello, world"
    mem.w_cstr(0, data)
    assert mem.r_cstr(0) == data
    empty = ""
    mem.w_cstr(100, empty)
    assert mem.r_cstr(100) == empty
Beispiel #4
0
def atypes_node_str_test():
    mem = MockMemory()
    text = 'hello, world!'
    mem.w_cstr(12, text)
    node = Node(mem, 0x42)
    node.setup(0x1234, 0x5678, NodeType.NT_DEVICE, -5, 12)
    assert str(node) == \
        "[Node:@000042,p=005678,s=001234,NT_DEVICE,-5,'hello, world!']"
Beispiel #5
0
def machine_mem_cstr_test():
  mem = MockMemory()
  data = "hello, world"
  mem.w_cstr(0, data)
  assert mem.r_cstr(0) == data
  empty = ""
  mem.w_cstr(100, empty)
  assert mem.r_cstr(100) == empty
Beispiel #6
0
def atypes_node_str_test():
  mem = MockMemory()
  text = 'hello, world!'
  mem.w_cstr(12, text)
  node = Node(mem, 0x42)
  node.setup(0x1234, 0x5678, NodeType.NT_DEVICE, -5, 12)
  assert str(node) == \
      "[Node:@000042,p=005678,s=001234,NT_DEVICE,-5,'hello, world!']"
Beispiel #7
0
def libtypes_node_remove_test():
    mem = MockMemory()
    text = "hello, world!"
    mem.w_cstr(12, text)
    node = Node(mem,
                0x80,
                succ=0x60,
                pred=0x100,
                type=NodeType.NT_DEVICE,
                pri=-5,
                name=12)
    node.remove()
Beispiel #8
0
def mem_cache_cstr_read_test():
  mem = MockMemory()
  data = "hello, world"
  mem.w_cstr(0x100, data)
  assert mem.r_cstr(0x100) == data
  empty = ""
  mem.w_cstr(0x120, empty)
  assert mem.r_cstr(0x120) == empty
  # to cache
  cmem = MemoryCache(0x100, 0x100)
  cmem.read_cache(mem)
  assert cmem.r_cstr(0x100) == data
  assert cmem.r_cstr(0x120) == empty
Beispiel #9
0
def mem_cache_cstr_read_test():
    mem = MockMemory()
    data = "hello, world"
    mem.w_cstr(0x100, data)
    assert mem.r_cstr(0x100) == data
    empty = ""
    mem.w_cstr(0x120, empty)
    assert mem.r_cstr(0x120) == empty
    # to cache
    cmem = MemoryCache(0x100, 0x100)
    cmem.read_cache(mem)
    assert cmem.r_cstr(0x100) == data
    assert cmem.r_cstr(0x120) == empty
Beispiel #10
0
def atypes_node_setup_test():
    mem = MockMemory()
    text = 'hello, world!'
    mem.w_cstr(12, text)
    node = Node(mem, 0x42)
    node.setup(1234, 5678, NodeType.NT_DEVICE, -5, 12)
    # check node
    assert node.get_succ() == 1234
    assert node.get_pred() == 5678
    assert int(node.get_type()) == NodeType.NT_DEVICE
    assert node.get_pri() == -5
    assert node.get_name(True) == 12
    assert node.get_name() == text
    node.set_type(NodeType(NodeType.NT_DEVICE))
Beispiel #11
0
def libtypes_node_str_test():
    mem = MockMemory()
    text = "hello, world!"
    mem.w_cstr(12, text)
    node = Node(mem,
                0x42,
                succ=0x1234,
                pred=0x5678,
                type=NodeType.NT_DEVICE,
                pri=-5,
                name=12)
    assert str(
        node
    ) == "[Node:@000042,p=005678,s=001234,NT_DEVICE,-5,'hello, world!']"
Beispiel #12
0
def atypes_node_setup_test():
  mem = MockMemory()
  text = 'hello, world!'
  mem.w_cstr(12, text)
  node = Node(mem, 0x42)
  node.setup(1234, 5678, NodeType.NT_DEVICE, -5, 12)
  # check node
  assert node.get_succ() == 1234
  assert node.get_pred() == 5678
  assert int(node.get_type()) == NodeType.NT_DEVICE
  assert node.get_pri() == -5
  assert node.get_name(True) == 12
  assert node.get_name() == text
  node.set_type(NodeType(NodeType.NT_DEVICE))
Beispiel #13
0
def libtypes_node_base_test():
    mem = MockMemory()
    text = "hello, world!"
    mem.w_cstr(12, text)
    node = Node(mem, 0x42)
    # set node
    node.succ.aptr = 1234
    node.pred.aptr = 5678
    node.type.val = NodeType.NT_LIBRARY
    node.pri.val = -3
    node.name.aptr = 12
    # check node
    assert node.succ.aptr == 1234
    assert node.pred.aptr == 5678
    assert node.type.val == NodeType.NT_LIBRARY
    assert node.pri.val == -3
    assert node.name.aptr == 12
    assert node.name.str == text
Beispiel #14
0
def atypes_node_base_test():
    mem = MockMemory()
    text = 'hello, world!'
    mem.w_cstr(12, text)
    node = Node(mem, 0x42)
    # set node
    node.set_succ(1234)
    node.set_pred(5678)
    node.set_type(NodeType.NT_LIBRARY)
    node.set_pri(-3)
    node.set_name(12)
    # check node
    assert node.get_succ() == 1234
    assert node.get_pred() == 5678
    assert int(node.get_type()) == NodeType.NT_LIBRARY
    assert node.get_type() == NodeType(NodeType.NT_LIBRARY)
    assert node.get_pri() == -3
    assert node.get_name(True) == 12
    assert node.get_name() == text
Beispiel #15
0
def libtypes_node_setup_test():
    mem = MockMemory()
    text = "hello, world!"
    mem.w_cstr(12, text)
    node = Node(mem,
                0x42,
                succ=1234,
                pred=5678,
                type=NodeType.NT_DEVICE,
                pri=-5,
                name=12)
    # check node
    assert node.succ.aptr == 1234
    assert node.pred.aptr == 5678
    assert node.type.val == NodeType.NT_DEVICE
    assert node.pri.val == -5
    assert node.name.aptr == 12
    assert node.name.str == text
    node.type.val = NodeType.NT_DEVICE
Beispiel #16
0
def atypes_node_base_test():
  mem = MockMemory()
  text = 'hello, world!'
  mem.w_cstr(12, text)
  node = Node(mem, 0x42)
  # set node
  node.set_succ(1234)
  node.set_pred(5678)
  node.set_type(NodeType.NT_LIBRARY)
  node.set_pri(-3)
  node.set_name(12)
  # check node
  assert node.get_succ() == 1234
  assert node.get_pred() == 5678
  assert int(node.get_type()) == NodeType.NT_LIBRARY
  assert node.get_type() == NodeType(NodeType.NT_LIBRARY)
  assert node.get_pri() == -3
  assert node.get_name(True) == 12
  assert node.get_name() == text