コード例 #1
0
 def testSingleWaterPond(self):
     self.assertItemsEqual(pondsizes.getPondSizes([(0, 0)]), [1])
コード例 #2
0
    def testAllAdjacencyTypes(self):
        waterSquares = [(0, 0), (3, 0), (0, 1), (2, 1), (2, 2), (0, 3), (2, 3)]

        self.assertItemsEqual(pondsizes.getPondSizes(waterSquares), [2, 4, 1])
コード例 #3
0
 def testNoPonds(self):
     self.assertItemsEqual(pondsizes.getPondSizes([]), [])
コード例 #4
0
 def testDiagonallyAdjacentWaterPond(self):
     self.assertItemsEqual(
         pondsizes.getPondSizes([(0, 0), (1, 1), (0, 2), (2, 2), (2, 0)]),
         [5])
コード例 #5
0
    def testMultipleDiagonallyAdjacentWaterPonds(self):
        waterSquares = [(0, 0), (1, 1), (2, 0), (4, 1), (3, 2), (1, 3), (2, 4)]

        self.assertItemsEqual(pondsizes.getPondSizes(waterSquares), [3, 2, 2])
コード例 #6
0
 def testMultipleVerticallyAdjacentWaterPonds(self):
     self.assertItemsEqual(
         pondsizes.getPondSizes([(0, 0), (0, 1), (3, 2), (3, 3), (3, 1)]),
         [3, 2])
コード例 #7
0
 def testVerticallyAdjacentWaterPond(self):
     self.assertItemsEqual(pondsizes.getPondSizes([(0, 0), (0, 1)]), [2])
コード例 #8
0
 def testMultipleHorizontallyAdjacentWaterPonds(self):
     self.assertItemsEqual(
         pondsizes.getPondSizes([(0, 0), (1, 0), (1, 2), (2, 2), (3, 2)]),
         [2, 3])
コード例 #9
0
 def testHorizontallyAdjacentWaterPond(self):
     self.assertItemsEqual(pondsizes.getPondSizes([(0, 0), (1, 0)]), [2])
コード例 #10
0
 def testMultipleSingleWaterPonds(self):
     self.assertItemsEqual(pondsizes.getPondSizes([(0, 0), (1, 2)]), [1, 1])