Please send questions to st10@humboldt.edu .
//---------------------------------------------------------------
// File: test_stack.cpp
// Name: Sharon M. Tuttle
// last modified: 3-10-05
//
// Purpose: tester for class stack
//--------------------------------------------------------------

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

int main()
{
    // declarations

    stack myStack;

    cout << endl;
    cout << "Testing class stack...for value_type double" << endl;
    cout << endl;
    
    // verify the constructors and test the accessors/observers 
    //    at the same time
    cout << "VERIFYING CONSTRUCTORS/ACCESSORS/OBSERVERS:" << endl;
    cout << endl;
    cout << "1's mean test passed, 0's mean test failed:" << endl;
    cout << "-------------------------------------------" << endl;
    
    cout << (myStack.is_empty() == true) << endl;
    cout << (myStack.get_size() == 0) << endl;

    // verifying the modifiers

    cout << endl;
    cout << "VERIFYING MODIFIERS:" << endl;
    cout << endl;
    cout << "1's mean test passed, 0's mean test failed:" << endl;
    cout << "-------------------------------------------" << endl;

    myStack.push(10.1);
    myStack.push(20.2);
    myStack.push(30.3);

    cout << (myStack.get_top() == 30.3) << endl;
    cout << (myStack.get_size() == 3) << endl;
    cout << (myStack.is_empty() == false) << endl;

    cout << (myStack.pop() == 30.3) << endl;
    cout << (myStack.get_top() == 20.2) << endl;
    cout << (myStack.get_size() == 2) << endl;

    for (int i=0; i<28; i++)
    {
        myStack.push(i/2.0);
    }

    cout << (myStack.get_size() == 30) << endl;
    cout << (myStack.get_top() == 13.5) << endl;

    // can we exercise the copy constructor?

    cout << endl;
    cout << "trying to verify copy constructor: " << endl;
    cout << "-----------------------------------" << endl;
    
    // this should initialize stack2 as a copy of myStack?
    //    (and should use the copy constructor to do it)
    //
    stack stack2(myStack);

    cout << (stack2.get_size() == 30) << endl;
    cout << (stack2.get_top() == 13.5) << endl;

    while ((!myStack.is_empty()) && (!stack2.is_empty()))
    {
        cout << (myStack.pop() == stack2.pop()) << " ";
    }
    cout << endl;

    cout << (myStack.is_empty()) << endl;
    cout << (stack2.is_empty()) << endl;

    return EXIT_SUCCESS;
}