//Programmer: Kate Smorodkina
//Date: November 17, 2004
//File: test_hw9.cpp
//Description: This program tests Set class

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

int main()
{
  Set s1;
  Set s2;
  Set s3;
  if(s1.isEmpty() && s2.isEmpty() && s3.isEmpty())
  {
    cout<<"initialization done correctly"<<endl;
  }
  else
  {
    cout<<"initialization done INcorrectly"<<endl;
  }
  //make s1 = {1,2,3,4,5,6}
  //test addElement function
  for(int i=1; i<=6; i++)
  {
    s1.addElement(i);
  }
  cout<<"s1 = ";
  s1.printOut();

  //test isElement function
  if(!s1.isElement(10) && s1.isElement(5))
  {
    cout<<"isElement works correctly"<<endl;
  }
  
  //make s2 = {4,5,6,7,8,9,10}
  //This should cause an error message to get printed from 
  //addElement function when trying to add 11 to s2 
  //test addElement function
  for(int i=4; i<=11; i++)
  {
    s2.addElement(i);
  }
  //print s2
  cout<<"s2 = ";
  s2.printOut();
  
  //delete element 1 from s1 and print s1
  //test deleteElement function and printOut function
  s1.deleteElement(1);
  cout<<"s1 = ";
  s1.printOut();

  //union s1 and s2 and store the result in s3
  //test operator+
  s3=s1+s2;
  //print s3
  cout<<"s3 = ";
  s3.printOut();

  //intersect s1 and s2 and store the result in s3
  //test operator*
  s3=s1*s2;
  //print s3
  cout<<"s3 = ";
  s3.printOut();

  //delete elements 1,2,3,4,5 from s3
  for(int i=1; i<=5; i++)
  {
    s3.deleteElement(i);
  }
  
  //test isEmpty function
  if(s3.isEmpty())
  {
    cout<<"s3 is empty"<<endl;
  }
  else
  {
    cout<<"s3 is not empty, s3 = ";
    s3.printOut();
  }
  return 0;
}

