// L-17 MCS 360 Fri 1 Oct 2010 : use_ring.cpp

/* We test the circular buffer of fixed capacity. */

#include "mcs360_circular_double_ring.h"
#include <iostream>
using namespace mcs360_circular_double_ring;
using namespace std;

int main()
{
   Queue<char> q;

   for(int i=0; i<5; i++) q.push_back('a'+i);

   cout << "printing two rounds forward:";
   for(int i=0; i<2*q.size(); i++, q.move_front_forward())
      cout << " " <<  q.front();
   cout << endl;

   cout << "printing two rounds backward:";
   for(int i=0; i<2*q.size(); i++, q.move_front_backward())
      cout << " " <<  q.front();
   cout << endl;

   cout << "removing 2nd and 3rd element..." << endl;
   q.move_front_forward();
   q.pop_front();
   q.pop_front();

   cout << "printing two rounds forward:";
   for(int i=0; i<2*q.size(); i++, q.move_front_forward())
      cout << " " <<  q.front();
   cout << endl;

   cout << "printing two rounds backward:";
   for(int i=0; i<2*q.size(); i++, q.move_front_backward())
      cout << " " <<  q.front();
   cout << endl;

   return 0;
}

