Пример #1
0
 def test_detect_borders_should_set_true_for_strata_with_all_minimum_points_for_single_altitude_map(
         self):
     pmap = EarthMatrix([[9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9],
                         [9, 9, 9, 9, 9, 9], [9, 9, 9, 9, 9, 9]])
     self.assertEqual([[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1],
                       [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]],
                      pmap.detect_borders())
Пример #2
0
def main():
    photograph = [[9, 2, 2, 2, 3, 5], [9, 8, 3, 2, 4, 5], [9, 7, 2, 2, 4, 3],
                  [9, 9, 2, 4, 4, 3], [9, 2, 3, 4, 3, 5]]
    matrix = EarthMatrix(photograph)
    assert (matrix.detect_borders() == [[0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0],
                                        [0, 0, 1, 1, 0, 1], [0, 0, 1, 0, 0, 1],
                                        [0, 1, 0, 0, 1, 0]])
    return 0
Пример #3
0
 def test_detect_borders_should_set_true_for_strata_with_all_minimum_points_for_square_map(
         self):
     pmap = EarthMatrix([[9, 9, 9, 9, 9, 9], [9, 5, 5, 5, 5, 9],
                         [9, 5, 8, 8, 5, 9], [9, 5, 5, 5, 5, 9],
                         [9, 9, 9, 9, 9, 9]])
     self.assertEqual(
         [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0],
          [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]], pmap.detect_borders())
Пример #4
0
 def test_detect_borders_should_set_true_for_strata_with_all_minimum_points(
         self):
     pmap = EarthMatrix([[9, 2, 2, 2, 3, 5], [9, 8, 3, 2, 4, 5],
                         [9, 7, 2, 2, 4, 3], [9, 9, 2, 4, 4, 3],
                         [9, 2, 3, 4, 3, 5]])
     self.assertEqual(
         [[0, 1, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 1],
          [0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0]], pmap.detect_borders())
Пример #5
0
 def test_detect_borders_should_set_true_for_strata_with_all_minimum_points_for_square_map_reversed(
         self):
     pmap = EarthMatrix([[5, 5, 5, 5, 5, 5], [5, 9, 9, 9, 9, 5],
                         [5, 9, 5, 5, 9, 5], [5, 9, 9, 9, 9, 5],
                         [5, 5, 5, 5, 5, 5]])
     self.assertEqual(
         [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1],
          [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]], pmap.detect_borders())