#include <vector>
#include <string>
#include <cstdlib>

#include "intlist.h"

void doTest(std::string inputString);

int main()
{
  // test inputs should have a single space between the values
  
  doTest("1 3 4 5 6 7 9");
  doTest("1 2 5");
  doTest("1 2 5 6");
  doTest("1 2 5 6 7");
  doTest("");
  doTest("1");
  doTest("-1 0 1 2 3");
  
  return 0;
}

void doTest(std::string inputString)
{
  // make a vector to hold the elements

  std::vector< int > inputVector;

  // get numbers from the string into the vector
  
  int space;
  do
    {
      // split input string at first spae

      space = inputString.find(' ');

      std::string number;

      if (space == std::string::npos)
	number = inputString;
      else
	{
	  number = inputString.substr(0, space);
	  inputString = inputString.substr(space + 1);
	}

      inputVector.push_back(atoi(number.c_str()));
    }
  while (space != std::string::npos);

  // create the object to test and invoke the method

  IntegerList testList(inputVector);

  testList.printList();
}
