Revision 4bc771cd tests/test_chain_gadget.py

View differences:

tests/test_chain_gadget.py
2 2
    ATTR_EDGE_TYPE, ATTR_TIMER, DEFAULT_MRAI_TIMER
3 3

  
4 4

  
5
def test_mini_chain():
6
    """
7
    test the smallest possible chain, i.e., with only a single ring. The
8
    topology is the following
9
          1
10
       2     0
11
    with the following edges:
12
    - inner ring: (1, 0), (2, 1)
13
    - first node to all inner nodes 1: (2, 0)
14
    """
15
    g = gen_chain_gadget(1, 1, False, "T", "transit", True)
16
    timers = {2: DEFAULT_MRAI_TIMER, 1: DEFAULT_MRAI_TIMER,
17
              0: DEFAULT_MRAI_TIMER/2}
18
    assert(g.number_of_nodes() == 3)
19
    assert((1, 0) in g.edges)
20
    assert((2, 1) in g.edges)
21
    assert((2, 0) in g.edges)
22
    for i in range(g.number_of_nodes()):
23
        assert(g.nodes[i][ATTR_NODE_TYPE] == "T")
24
        assert(g.nodes[i][ATTR_TIMER] == timers[i])
25
    for e in g.edges:
26
        assert(g.edges[e][ATTR_EDGE_TYPE] == "transit")
27

  
28

  
5 29
def test_simplest_chain():
6 30
    """
7 31
    test one of the simplest possible chains, i.e., the one without outer nodes

Also available in: Unified diff