def test_append_when_empty_myarray(self): # Arrange myarray = MyArray('i') # Act myarray.append(100) # Assert self.assertEqual(1, myarray.size()) self.assertEqual(100, myarray.get(0))
def test_append_when_single_element_in_myarray(self): # Arrange myarray = MyArray('i', 100) # Act myarray.append(200) # Assert self.assertEqual(2, myarray.size()) self.assertEqual(100, myarray.get(0)) self.assertEqual(200, myarray.get(1))
def test_append_when_more_than_one_element_in_myarray(self): # Arrange myarray = MyArray('i', 100, 200) # Act myarray.append(300) # Assert self.assertEqual(3, myarray.size()) self.assertEqual(100, myarray.get(0)) self.assertEqual(200, myarray.get(1)) self.assertEqual(300, myarray.get(2))