Пример #1
0
def test_vertical_active_link_count():
    link_count = sgrid.vertical_active_link_count((3, 4))
    assert 4 == link_count

    link_count = sgrid.vertical_active_link_count((3, 2))
    assert 0 == link_count

    node_status = np.ones((4, 5), dtype=np.int)
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert 9 == link_count

    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    node_status[0, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert 8 == link_count

    node_status[2, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert 6 == link_count

    node_status[2, 2] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert 4 == link_count

    node_status[1, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert 4 == link_count
Пример #2
0
def test_vertical_active_link_count():
    link_count = sgrid.vertical_active_link_count((3, 4))
    assert_equal(4, link_count)

    link_count = sgrid.vertical_active_link_count((3, 2))
    assert_equal(0, link_count)

    node_status = np.ones((4, 5), dtype=np.int)
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(9, link_count)

    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    node_status[0, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(8, link_count)

    node_status[2, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(6, link_count)

    node_status[2, 2] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(4, link_count)

    node_status[1, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(4, link_count)
Пример #3
0
def test_vertical_active_link_count():
    link_count = sgrid.vertical_active_link_count((3, 4))
    assert 4 == link_count

    link_count = sgrid.vertical_active_link_count((3, 2))
    assert 0 == link_count

    node_status = np.ones((4, 5), dtype=np.int)
    link_count = sgrid.vertical_active_link_count((4, 5), node_status=node_status)
    assert 9 == link_count

    link_count = sgrid.vertical_active_link_count((4, 5), node_status=node_status)
    node_status[0, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5), node_status=node_status)
    assert 8 == link_count

    node_status[2, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5), node_status=node_status)
    assert 6 == link_count

    node_status[2, 2] = 0
    link_count = sgrid.vertical_active_link_count((4, 5), node_status=node_status)
    assert 4 == link_count

    node_status[1, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5), node_status=node_status)
    assert 4 == link_count
Пример #4
0
def test_vertical_active_link_count():
    link_count = sgrid.vertical_active_link_count((3, 4))
    assert_equal(4, link_count)

    link_count = sgrid.vertical_active_link_count((3, 2))
    assert_equal(0, link_count)

    node_status = np.ones((4, 5), dtype=np.int)
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(9, link_count)

    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    node_status[0, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(8, link_count)

    node_status[2, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(6, link_count)

    node_status[2, 2] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(4, link_count)

    node_status[1, 1] = 0
    link_count = sgrid.vertical_active_link_count((4, 5),
                                                  node_status=node_status)
    assert_equal(4, link_count)