Example #1
0
  def test_addTree(self):
    forest = Forest(self.size)
    location1 = (1, 3)
    location2 = (2, 3)
    location3 = (4, 4)

    forest.addTree(location1)
    forest.addTree(location2)
    forest.addTree(location3)

    self.assertEqual(forest.getValue(location1), 2)
    self.assertEqual(forest.getValue(location2), 2)
    self.assertEqual(forest.getValue(location3), 1)
Example #2
0
  def test_elementManipulation(self):
    location = (1, 3)
    value = 5

    forest = Forest(self.size)
    forest.setValue(location, value)
    get_value = forest.getValue(location)

    self.assertEqual(get_value, value)