예제 #1
0
    def test_pop_when_single_element_in_myarray(self):
        # Arrange
        myarray = MyArray('i', 20)

        # Act
        myarray.pop()

        # Assert
        self.assertEqual(0, myarray.size())
예제 #2
0
    def test_pop_when_more_than_one_element_in_myarray(self):
        # Arrange
        myarray = MyArray('i', 20, 30)

        # Act
        myarray.pop(0)

        # Assert
        self.assertEqual(1, myarray.size())
        self.assertEqual(30, myarray.get(0))
예제 #3
0
    def test_pop_when_more_than_two_element_in_myarray(self):
        # Arrange
        myarray = MyArray('i', 20, 30, 40)

        # Act
        myarray.pop(1)

        # Assert
        self.assertEqual(2, myarray.size())
        self.assertEqual(20, myarray.get(0))
        self.assertEqual(40, myarray.get(1))