// test01.cxx -- John Valois (valoisj@cs.rpi.edu)

// Test case to check correct LIFO behavior.


#include <iostream>
#include "stack.h"

using std::cout;
using std::endl;


int main()
{
  cout << "test01: LIFO... ";
  try 
  {
    stack<int> s;
    int i;
    for (i=0; i < s.max_size(); ++ i)
      s.push(i);
    while (i--)
    {
      int x = s.top();
      s.pop();
      if (x != i)
      {
	cout << "FAILED (not LIFO)" << endl;
	return 1;
      }
    }
  }
  catch (...) 
  {
    cout << "FAILED (threw exception)" << endl;
    return 1;
  }

  cout << "PASSED" << endl;
  return 0;
}
