Please send questions to
st10@humboldt.edu .
//---------------------------------------------------------------
// File: babytest_bag.cpp
// Name: Sharon M. Tuttle
// last modified: 2-14-05
//
// Purpose: baby tester for class bag
//--------------------------------------------------------------
#include <iostream>
#include "bag.h"
using namespace std;
int main()
{
// declarations
bag bag1;
bag bag2(100);
cout << endl;
cout << "Baby-Testing class bag..." << 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 << (bag1.get_size() == 0) << endl;
cout << (bag2.get_size() == 0) << endl;
cout << (bag1.get_count(3) == 0) << endl;
cout << (bag1.get_capacity() == 30) << endl;
cout << (bag2.get_capacity() == 100) << 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;
bag1.insert(3);
bag1.insert(3);
bag1.insert(4);
bag1.insert(4);
bag1.insert(4);
cout << (bag1.get_size() == 5) << endl;
cout << (bag1.get_count(3) == 2) << endl;
cout << (bag1.get_count(4) == 3) << endl;
bag1.erase(4);
bag1.erase_one(3);
cout << (bag1.get_size() == 1) << endl;
cout << (bag1.get_count(3) == 1) << endl;
cout << (bag1.get_count(4) == 0) << endl;
bag1.reserve(1000);
cout << (bag1.get_capacity() == 1000) << endl;
cout << (bag1.get_size() == 1) << endl;
cout << (bag1.get_count(3) == 1) << endl;
cout << (bag1.get_count(4) == 0) << endl;
// other methods/operators tests -- can use same basic approach as
// for functions, except they can be included in this same
// testing function.
return EXIT_SUCCESS;
}