///////////////////////////////////////////////////////////////////////////
//  Student Name :  Ronny Pudding
//  Student ID   :  123-45-6789
//  Course       :  CS 162
//  Assignment   :  Lab #2
//  Program File :  client_test2.cpp
//  Due Date     :  7/20/98
//
// Driver that tests the output of stack.cpp in all cases
//
// The following cases are tested in this driver:
//   1. Try to create constructor bigger than MAX_SIZE
//   2. Use default constructor & check size & count of stack
//   3. Push items on default stack & check count of stack
//   4. Pop items on default stack & check count of stack
//   5. Peek at top item in default stack
//   6. Remove all items but 1, and check for empty, full
//   7. Remove last item, and check for empty
//   8. Try to remove an item with empty stack
//   9. Display empty stack
//  10.Create a stack using non-default constructor & check size & top
//  11.Try to push one-too-many items on stack
//  12.Display full stack
//  13.Try to take-off one-too-many-items from stack
// 
// This driver outputs the following:
//   1. Size of stack3 is 100
//   1. Count of stack3 is 0
//   2. Size of stack1 is 100
//   2. Count of stack1 is 0
//   3.The count of stack1 is: 11
//   4.The count of stack1 is: 6
//   5. The top item in stack1 is: 5
//   6.The count of stack1 is: 1
//   6. stack1 is not empty
//   6. stack1 is not full
//   7. stack1 is empty
//   8. Error: stack is empty
//   9.
//  10. The size of stack2 is: 5
//  10. The count of stack2 is: 0
//  11. Error: stack is full
//  12. 5 5 5 5 5
//  13. Error: stack is empty
///////////////////////////////////////////////////////////////////////////

#include "stack.h"
#include <iostream.h>
#include <iomanip.h>
 
void main(void)
{
  int i, value, count, size;
 
  Stack stack1;      // create stack with default size of MAX_SIZE
  Stack stack2(5);   // create stack with size 5
  Stack stack3(101); // 1. create stack bigger than MAX_SIZE
 
    // 1. Try to create constructor bigger than MAX_SIZE
  cout << "1. Size of stack3 is " << stack3.getSize() << endl;
  cout << "1. Count of stack3 is " << stack3.getCount() << endl;

 
    // 2. print out size & count of stack1
  cout << "2. Size of stack1 is " << stack1.getSize() << endl;
  cout << "2. Count of stack1 is " << stack1.getCount() << endl;
 

    // 3. Push items on default stack & check count of stack
  stack1.pushItem(10);
  stack1.pushItem(9);
  stack1.pushItem(8);
  stack1.pushItem(7);
  stack1.pushItem(6);
  stack1.pushItem(5);
  stack1.pushItem(4);
  stack1.pushItem(3);
  stack1.pushItem(2);
  stack1.pushItem(1);
  stack1.pushItem(0);
  cout << "3.The count of stack1 is: " << stack1.getCount() << endl;
 

    // 4. Pop items on default stack & check count of stack
  for (i = 0; i < 5; ++i)
    stack1.popItem();
  cout << "4.The count of stack1 is: " << stack1.getCount() << endl;
 

    // 5. Peek at top item in default stack
  value = stack1.peekAtTop();
  cout << "5. The top item in stack1 is: " << value << endl;
 

    // 6. Remove all items but 1, and check for empty, full
  for (i = 0; i < 5; ++i)
    stack1.popItem();
  cout << "6.The count of stack1 is: " << stack1.getCount() << endl;
  value = stack1.isEmpty();
  if (value)
    cout << "6. stack1 is empty" << endl;
  else
    cout << "6. stack1 is not empty" << endl;
  value = stack1.isFull();
  if (value)
    cout << "6. stack1 is full" << endl;
  else
    cout << "6. stack1 is not full" << endl;
 

    // 7. Remove last item, and check for empty
  stack1.popItem();
  value = stack1.isEmpty();
  if (value)
    cout << "7. stack1 is empty" << endl;
  else
    cout << "7. stack1 is not empty" << endl;
 

    // 8. Try to remove an item with empty stack
  cout << "8. "
  stack1.popItem();
 

    // 9. Display empty stack
  cout << "9. "
  stack1.display();
 

    //10. Check size & count of non-default constructor
  cout << "10. The size of stack2 is: " << stack2.getSize() << endl;
  cout << "10. The count of stack2 is: " << stack2.getCount() << endl;
 

    //11. Try to push one-too-many items on stack
  cout << "11. "
  for (i = 0; i < 6; ++i)
    stack2.pushItem(5);
 

    //12. Display full stack
  cout << "12. "
  stack2.display();
 

    //13. Try to take-off one-too-many-items from stack
  cout << "13. "
  for (i = 0; i < 6; ++i)
    stack2.popItem();
}


