コード例 #1
0
ファイル: test_islands.py プロジェクト: swstephe/algorithms
def test1():
    g = Graph(((0, ), ))
    assert g.rows == 1
    assert g.cols == 1
    assert g.count_islands() == 0
    g = Graph(((1, ), ))
    assert g.rows == 1
    assert g.cols == 1
    assert g.count_islands() == 1
コード例 #2
0
ファイル: test_islands.py プロジェクト: swstephe/algorithms
def test5():
    g = Graph(((1, 1, 0, 0, 0), (0, 1, 0, 0, 1), (1, 0, 0, 1, 1),
               (0, 0, 0, 0, 0), (1, 0, 1, 0, 1)))
    assert g.rows == 5
    assert g.cols == 5
    assert g.count_islands() == 5
コード例 #3
0
ファイル: test_islands.py プロジェクト: swstephe/algorithms
def test0():
    g = Graph(((0, 0, 0, 0, 0), (0, 0, 0, 0, 0), (0, 0, 0, 0, 0),
               (0, 0, 0, 0, 0), (0, 0, 0, 0, 0)))
    assert g.rows == 5
    assert g.cols == 5
    assert g.count_islands() == 0
コード例 #4
0
ファイル: test_islands.py プロジェクト: swstephe/algorithms
def test1c():
    g = Graph(((1, 1, 1, 1, 1), (1, 1, 1, 1, 1), (1, 1, 1, 1, 1),
               (1, 1, 1, 1, 1), (1, 1, 1, 1, 1)))
    assert g.rows == 5
    assert g.cols == 5
    assert g.count_islands() == 1