#include <iostream>
#include <cmath>
#include <list>

#include "dslist.h"


template <class T>
void print_dslist_forwards(const std::string &label, dslist<T> &lst) {
  std::cout << label;
  for (typename dslist<T>::iterator itr = lst.begin(); itr != lst.end(); ++itr)
    std::cout << " " << *itr;
  std::cout << std::endl;
}


int main() {

  // =======================================
  // CHECKPOINT 1

  // create a list of the sqrt of the first 10 integers
  dslist<double> a;
  dslist<double> b;
  for (int i = 0; i < 10; ++i) {
    a.push_back(i);
    b.push_back(sqrt(i));
  }
  
  assert (a.size() == 10);
  assert (b.size() == 10);
  assert (a.front() == 0);
  assert (b.front() == 0);
  assert (a.back() == 9);
  assert (b.back() == 3);

  // print out details of the list
  print_dslist_forwards("a: ", a);
  print_dslist_forwards("b: ", b);
  
  // clear out one the lists
  a.clear();

  assert (a.size() == 0);
  print_dslist_forwards("after clearing, a: ", a);

  // =======================================
  // CHECKPOINT 2

  /* uncomment these tests after you finish implementing push_front, pop_front, and pop_back */

  /*
  // simple tests of push_front, pop_front, and pop_back
  dslist<double> c;
  c.push_front(5);
  c.push_back(7);
  c.push_front(3);
  c.push_back(9);
  assert (c.size() == 4);
  
  assert (*(c.begin()) == 3);
  assert (*(++c.begin()) == 5);
  assert (*(++(++c.begin())) == 7);
  assert (*(++(++(++c.begin()))) == 9);
  
  print_dslist_forwards("c has 4 elements: ", c);

  c.pop_back();
  c.pop_front();
  assert (c.size() == 2);
  assert (*(c.begin()) == 5);
  assert (*(++c.begin()) == 7);
  
  print_dslist_forwards("c now has 2 elements: ", c);
  
  c.pop_back();
  c.pop_front();
  assert (c.size() == 0);
  assert (c.begin() == c.end());
  print_dslist_forwards("c is now empty: ", c);
  */

  // ===================================================
  // add tests of copy constructor & assignment operator
  
  
  
  
  return 0;
}

