Circular buffer implementation along with test