class ArrayRingBufferTests(unittest.TestCase):
    def setUp(self):
        self.buffer = ArrayRingBuffer(
            5
        )  # assumes we initialize size of array to the lemgth of capacity, reminds me of c++
        self.buffer_2 = ArrayRingBuffer(5)

    def test__array_ring_buffer(self):
        self.assertEqual(len(self.buffer.storage), 5)

        self.buffer.append('a')
        self.buffer.append('b')
        self.buffer.append('c')
        self.buffer.append('d')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['a', 'b', 'c', 'd'])

        self.buffer.append('e')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['a', 'b', 'c', 'd', 'e'])

        self.buffer.append('f')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['f', 'b', 'c', 'd', 'e'])

        self.buffer.append('g')
        self.buffer.append('h')
        self.buffer.append('i')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['f', 'g', 'h', 'i', 'e'])

        for i in range(50):
            self.buffer_2.append(i)
        self.assertEqual(self.buffer_2.get(), [45, 46, 47, 48, 49])
class ArrayRingBufferTests(unittest.TestCase):
    def setUp(self):
        self.buffer = ArrayRingBuffer(5)
        self.buffer_2 = ArrayRingBuffer(5)

    def test__array_ring_buffer(self):
        self.assertEqual(len(self.buffer.storage), 5)

        self.buffer.append('a')
        self.buffer.append('b')
        self.buffer.append('c')
        self.buffer.append('d')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['a', 'b', 'c', 'd'])

        self.buffer.append('e')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['a', 'b', 'c', 'd', 'e'])

        self.buffer.append('f')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['f', 'b', 'c', 'd', 'e'])

        self.buffer.append('g')
        self.buffer.append('h')
        self.buffer.append('i')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['f', 'g', 'h', 'i', 'e'])

        for i in range(50):
            self.buffer_2.append(i)
        self.assertEqual(self.buffer_2.get(), [45, 46, 47, 48, 49])
class ArrayRingBufferTests(unittest.TestCase):
    def setUp(self):
        self.buffer = ArrayRingBuffer(5)
        self.buffer_2 = ArrayRingBuffer(5)

    def test__array_ring_buffer(self):
        # self.assertEqual(len(self.buffer.storage), 5)
        # why would it be 5? should be 0 (empty list)
        self.assertEqual(len(self.buffer.storage), 0)

        self.buffer.append('a')
        self.buffer.append('b')
        self.buffer.append('c')
        self.buffer.append('d')
        # self.assertEqual(len(self.buffer.storage), 5)
        # why would it be 5? should be 4 (only added 4 items)
        self.assertEqual(len(self.buffer.storage), 4)
        self.assertEqual(self.buffer.get(), ['a', 'b', 'c', 'd'])

        self.buffer.append('e')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['a', 'b', 'c', 'd', 'e'])

        self.buffer.append('f')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['f', 'b', 'c', 'd', 'e'])

        self.buffer.append('g')
        self.buffer.append('h')
        self.buffer.append('i')
        self.assertEqual(len(self.buffer.storage), 5)
        self.assertEqual(self.buffer.get(), ['f', 'g', 'h', 'i', 'e'])

        for i in range(50):
            self.buffer_2.append(i)
        self.assertEqual(self.buffer_2.get(), [45, 46, 47, 48, 49])