Ejemplo n.º 1
0
    def test10(self):
        x = None
        algo = Algorithm(x)

        try:
            algo.ValidateInputs()
        except Exception as e:
            assert str(e) == "Incorrect inputs. 2 dimensional matrix required"
Ejemplo n.º 2
0
    def test8(self):
        x = np.array([[1, 1, 1, 0, 0], [1, 1, 0, "a", 0], [0, 0, 1, "bcd", 0],
                      [0, 0, 0, 1, 1]])
        algo = Algorithm(x)

        try:
            algo.ValidateInputs()
        except Exception as e:
            assert str(e) == "Incorrect inputs. Only 0s and 1s required!"
Ejemplo n.º 3
0
def Main():
    try:
        matrix = ReadInputs()
        algo = Algorithm(matrix)
        algo.ValidateInputs()
    except Exception as e:
        print("Error in inputs:" + str(e))
        sys.exit(1)

    count_islands = algo.RunSearch()
    print("Number of islands is: " + str(count_islands))
    sys.exit(0)