|
Smart Array problem
Hi, for an assignment I need to do we have to write a template for a "smart array" which basically acts like a vector (IE. can tell it's beginning/end/whatever.) Since we want it to allow any type storage I used a generic template with generic values. Every function that is nessesary is written and most (but not all) are proofread. The problem that I am encountering is this: I wrote a overloaded copy assignment (operator=) to allow copy assignment for any value_type. We are given a test program to run out template against that checks if everything is satisfactory, but when I compile the code I get the following error:
error C2106: '=' : left operand must be l-value
The weird thing is that the error happens in the test program's code...not mine. I asked about this but was reasured that the test program was valid. I have re-written the operator= function about twenty different ways but for the life of me I can't figure out how to fix said error. Can anyone give me some possible hints on this?
Here is my code:
//ssarray.h
#ifndef FILE_SSARRAY_H_INCLUDED // ifndef inclusion
#define FILE_SSARRAY_H_INCLUDED
// #include's
#include <cstdlib> // for std::size_t
#include <algorithm> // for std::swap, std::copy
template <typename T>
class SSArray
{
public:
//typedef's
typedef std::size_t size_type;
typedef T value_type;
//default ctor
//creates new object
SSArray()
:size_ (10)
{}
SSArray(size_type sizeIn)
:size_ (sizeIn)
{}
SSArray(size_type sizeIn, const value_type & valIn)
:size_ (sizeIn), val_ (valIn)
{
for(int i=0; i<=size; i++)
{
//set all array values to val for size.
arr[i] = val_;
}
}
//copy ctor
//copies values of arr into arbitrary otherArray
//Pre: arr and otherArray exsist; size >=0
//Post: otherArray contains values of arr
SSArray(const SSArray & otherArray)
{
for(int i=0; i<=otherArray.size; ++i)
{
std::copy(arr[0], arr[size], otherArray[]);
}
}
//dcor
//destroys object
~SSArray()
{
delete [] iter;
}
//***overloaded operators***
public:
//copy assignment
SSArray & operator=(const SSArray & otherArray )
{
if(this != otherArray)
{
std::copy(otherArray.begin(), otherArray.end(), arr);
}
return *this;
}
//const and non-const [] operator
value_type operator[](int index)
{
return arr[index];
}
value_type operator[](int index) const
{
return arr[index];
}
bool & operator==(const SSArray & otherArray) const
{
bool equ;
for(int i=0; i<otherArray.size(); ++i)
{
if(arr[i] == otherArray[i])
equ = true;
else
{
equ = false;
break;
}
}
return equ;
}
bool & operator !=(const SSArray & otherArray) const
{
return ( !(*this== otherArray));
}
public:
size_type & size() const
{
return size_;
}
value_type* begin() const
{
return &arr[0];
}
value_type* end() const
{
return &arr[size];
}
public:
//variables
size_type size_;
value_type val_;
value_type arr[10];
value_type* iter;
}; //end class ssarray
#endif //end file inclusion
Also, if it helps, here is the test program that we are given:
// ssarray_test.cpp
#include "ssarray.h" // For class SSArray
// Include above BEFORE system files, to make sure it works by itself
#include "ssarray.h" // Double inclusion test
// Includes for testing package
#include <iostream> // for std::cout, std::endl
#include <string> // for std::string
// Includes for this testing program
#include <cstdlib> // for std::size_t, std::ptrdiff_t
// ************************************************************************
// Testing class
// ************************************************************************
// class Tester
// For extremely simple unit testing.
// Keeps track of number of tests and number of passes.
// Use test (with success/failure parameter) to do a test.
// Get results with numTests, numPassed, numFailed, allPassed.
// Restart testing with reset.
// Invariants:
// countTests_ == number of tests (calls to test) since last reset.
// countPasses_ == number of times function test called with true param
// since last reset.
// 0 <= countPasses_ <= countTests_.
// tolerance_ >= 0.
class Tester {
// ***** Tester: ctors, dctor, op= *****
public:
// Default ctor
// Sets countTests_, countPasses_ to zero, tolerance_ to given value
// Pre: None.
// Post:
// numTests == 0, countPasses == 0, tolerance_ == abs(theTolerance)
Tester(double theTolerance = 0.0000001)
:countTests_(0),
countPasses_(0),
tolerance_(theTolerance >= 0 ? theTolerance : -theTolerance)
{}
// Compiler-generated copy ctor, copy op=, dctor are used
// ***** Tester: general public functions *****
public:
// test
// Handles single test, param indicates pass/fail
// Pre: None.
// Post:
// countTests_ incremented
// countPasses_ incremented if (success)
// Message indicating test name (if given)
// and pass/fail printed to cout
void test(bool success,
const std::string & testName = "")
{
++countTests_;
if (success) ++countPasses_;
std::cout << " ";
if (testName != "")
{
std::cout << "Test: "
<< testName
<< " - ";
}
std::cout << (success ? "passed" : "********** FAILED **********")
<< std::endl;
}
// ftest
// Does single floating-point test.
// Tests passes iff difference of first two values is <= tolerance.
// Pre: None.
// Post:
// countTests_ incremented
// countPasses_ incremented if (abs(val1-val2) <= tolerance_)
// Message indicating test name (if given)
// and pass/fail printed to cout
void ftest(double val1,
double val2,
const std::string & testName = "")
{ test(val1-val2 <= tolerance_ && val2-val1 <= tolerance_, testName); }
// reset
// Resets *this to default constructed state
// Pre: None.
// Post:
// countTests_ == 0, countPasses_ == 0
void reset()
{
countTests_ = 0;
countPasses_ = 0;
}
// numTests
// Returns the number of tests that have been done since last reset
// Pre: None.
// Post:
// return == countTests_
int numTests() const
{ return countTests_; }
// numPassed
// Returns the number of tests that have passed since last reset
// Pre: None.
// Post:
// return == countPasses_
int numPassed() const
{ return countPasses_; }
// numFailed
// Returns the number of tests that have not passed since last reset
// Pre: None.
// Post:
// return + countPasses_ == numTests_
int numFailed() const
{ return countTests_ - countPasses_; }
// allPassed
// Returns true if all tests since last reset have passed
// Pre: None.
// Post:
// return == (countPasses_ == countTests_)
bool allPassed() const
{ return countPasses_ == countTests_; }
// setTolerance
// Sets tolerance_ to given value
// Pre: None.
// Post:
// tolerance_ = abs(theTolerance)
void setTolerance(double theTolerance)
{ tolerance_ = (theTolerance >= 0 ? theTolerance : -theTolerance); }
// ***** Tester: data members *****
private:
int countTests_; // Number of tests done since last reset
int countPasses_; // Number of tests passed since last reset
double tolerance_; // Tolerance for floating-point near-equality tests
}; // end class Tester
// ************************************************************************
// Class for Counting Ctor/Dctor Calls
// ************************************************************************
// class CallCounter
// Item type for counting ctor & dctor calls
// Increments static data member testItemCount
// on default construction and destruction.
// Invariants:
// CallCounter::callCount_ is number of calls to default
// ctor and/or dctor for all CallCounter objects, since
// most recent call to resetCount, or start of program
// if resetCount has never been called.
class CallCounter {
// ***** CallCounter: Ctors, dctor, op= *****
public:
// Default ctor
// Pre: None.
// Post:
// (testItemCount_ has been incremented.)
CallCounter()
{ ++callCount_; }
// Copy ctor
// Pre: None.
// Post:
// (testItemCount_ has been incremented.)
CallCounter(const CallCounter & other)
{ ++callCount_; }
// Copy assignment
// Pre: None.
// Post:
// Return value is *this.
// (testItemCount_ has been incremented.)
CallCounter & operator=(const CallCounter & rhs)
{ ++callCount_; return *this; }
// Dctor
// Pre: None.
// Post:
// (testItemCount_ has been incremented.)
~CallCounter()
{ ++callCount_; }
// ***** CallCounter: Functions dealing with count *****
public:
// resetCount
// Pre: None.
// Post:
// testItemCount_ == 0.
static void resetCount()
{ callCount_ = 0; }
// getCount
// Pre: None.
// Post:
// return == testItemCount_.
static int getCount()
{ return callCount_; }
// ***** CallCounter: Data Members *****
private:
static int callCount_; // Counts default ctor, dctor calls
}; // End class CallCounter
// Definition of static data member of class CallCounter
int CallCounter::callCount_ = 0;
// ************************************************************************
// Type Checking Class
// ************************************************************************
// class TypeCheck
// This class exists in order to have static member function check, which
// takes a parameter of a given type, by reference. Objects of type
// TypeCheck<T> cannot be created.
// Usage:
// TypeCheck<MyType>::check(x)
// returns true if the type of x is (MyType) or (const MyType),
// otherwise false.
// Invariants: None.
// Requirements on Types: None.
template<typename T>
class TypeCheck {
private:
// Uncopyable class. Do not define copy ctor, copy assn.
TypeCheck(const TypeCheck &);
TypeCheck<T> & operator=(const TypeCheck &);
// Compiler-generated dctor is used (but irrelevant).
public:
// check
// These two functions simulate a single function that takes a
// single parameter, and returns true iff the parameter has type
// T or (const T).
// check (reference-to-const to T)
// Pre: None.
// Post:
// Return is true.
// Does not throw (No-Throw Guarantee)
static bool check(const T & param)
{ return true; }
// check (reference-to-const to non-T)
// Pre: None.
// Post:
// Return is false.
// Does not throw (No-Throw Guarantee)
template <typename OtherType>
static bool check(const OtherType & param)
{ return false; }
}; // End class TypeCheck
// ************************************************************************
// Test Suite Functions
// ************************************************************************
// test_class_SSArray_types
// Test suite for class SSArray, types
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_types(Tester & t)
{
std::cout << "Test Suite: class SSArray - types" << std::endl;
bool correctType; // result of type checking
// value_type test #1: int
SSArray<int>::value_type i1 = 0;
correctType = TypeCheck<int>::check(i1);
t.test(correctType, "value_type test #1");
// value_type test #2: double
SSArray<double>::value_type d1 = 0.;
correctType = TypeCheck<double>::check(d1);
t.test(correctType, "value_type test #2");
// value_type check modifiability (only needs to compile)
SSArray<double>::value_type d2;
d2 = 0.;
t.test(true, "value_type check modifiability");
// size_type test
SSArray<CallCounter>::size_type s1 = 0;
correctType = TypeCheck<std::size_t>::check(s1)
|| TypeCheck<std::ptrdiff_t>::check(s1);
t.test(correctType, "size_type test");
// size_type check modifiability (only needs to compile)
SSArray<CallCounter>::size_type s2;
s2 = 0;
t.test(true, "size_type check modifiability");
}
// test_class_SSArray_size_and_ctor_from_size
// Test suite for class SSArray, function size and ctor from size
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_size_and_ctor_from_size(Tester & t)
{
std::cout << "Test Suite: class SSArray - function size, ctor from size" << std::endl;
bool correctType; // result of type checking
const SSArray<int> ssai1(1);
correctType = TypeCheck<SSArray<int>::size_type>::check(ssai1.size());
t.test(correctType, "size, return type");
t.test(ssai1.size() == 1, "size, ctor from size (const) #1");
const SSArray<int> ssai2(10);
t.test(ssai2.size() == 10, "size, ctor from size (const) #2)");
const SSArray<double> ssad(100);
t.test(ssad.size() == 100, "size, ctor from size (const) #3)");
SSArray<int> ssai3(20);
t.test(ssai3.size() == 20, "size, ctor from size (non-const)");
}
// test_class_SSArray_default_ctor
// Test suite for class SSArray, default ctor
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate have been messages printed to cout.
void test_class_SSArray_default_ctor(Tester & t)
{
std::cout << "Test Suite: class SSArray - default ctor" << std::endl;
const SSArray<int> ssai1;
t.test(ssai1.size() == 10, "default ctor, size");
}
// test_class_SSArray_bracket_op
// Test suite for class SSArray, bracket operator
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_bracket_op(Tester & t)
{
std::cout << "Test Suite: class SSArray, bracket operator" << std::endl;
bool correctType; // result of type checking
const int theSize = 10;
bool noErrors; // True if no errors encountered
int i; // Counter
SSArray<double> ssad1;
correctType = TypeCheck<SSArray<double>::value_type>::check(ssad1[1]);
t.test(correctType, "Bracket operator (non-const), return type");
SSArray<int> ssai(theSize);
for (i = 0; i < theSize; ++i)
ssai[i] = 15 - i * i;
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssai[i] != 15 - i * i)
noErrors = false;
}
t.test(noErrors, "Bracket operator (non-const) #1");
ssai[2] = 1000;
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssai[i] != ((i == 2) ? 1000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Bracket operator (non-const) #2");
// Make const version, no copy
const SSArray<int> & ssaiRef = ssai;
const SSArray<double> ssad2;
correctType = TypeCheck<SSArray<double>::value_type>::check(ssad2[1]);
t.test(correctType, "Bracket operator (const), return type");
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssaiRef[i] != ((i == 2) ? 1000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Bracket operator (const)");
}
// test_class_SSArray_two_param_ctor
// Test suite for class SSArray, 2-parameter ctor
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_two_param_ctor(Tester & t)
{
std::cout << "Test Suite: class SSArray, 2-parameter ctor" << std::endl;
const int theSize = 10;
bool noErrors; // True if no errors encountered
const double theValue = 5.34; // Initial value for items in test array
int i; // Counter
const SSArray<double> ssad(theSize, theValue);
t.test(ssad.size() == theSize, "2-param ctor - size");
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssad[i] != theValue)
noErrors = false;
}
t.test(noErrors, "2-param ctor - values");
}
// test_class_SSArray_copy_ctor
// Test suite for class SSArray, copy ctor
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_copy_ctor(Tester & t)
{
std::cout << "Test Suite: class SSArray - copy ctor" << std::endl;
const int theSize = 10;
bool noErrors; // True if no errors encountered
int i; // Counter
SSArray<int> ssai(theSize);
for (i = 0; i < theSize; ++i)
ssai[i] = 15 - i * i;
// Make const version, no copy
const SSArray<int> & ssaiRef = ssai;
// Make copy (copy ctor)
SSArray<int> ssaiCopy(ssaiRef);
t.test(ssaiCopy.size() == theSize, "Copy ctor - check size, copy");
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssaiCopy[i] != 15 - i * i)
noErrors = false;
}
t.test(noErrors, "Copy ctor - check values, copy");
// Change original
ssai[2] = 1000;
// Check original
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssai[i] != ((i == 2) ? 1000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Copy ctor - change original, check values, original");
// Check copy
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssaiCopy[i] != 15 - i * i)
noErrors = false;
}
t.test(noErrors, "Copy ctor - change original, check values, copy");
// Change copy
ssaiCopy[3] = 2000;
// Check original
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssai[i] != ((i == 2) ? 1000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Copy ctor - change copy, check values, original");
// Check copy
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssaiCopy[i] != ((i == 3) ? 2000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Copy ctor - change copy, check values, copy");
}
// test_class_SSArray_copy_assn
// Test suite for class SSArray, copy assignment
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_copy_assn(Tester & t)
{
std::cout << "Test Suite: class SSArray - copy assignment" << std::endl;
const int theSize = 10;
bool noErrors; // True if no errors encountered
int i; // Counter
SSArray<int> ssai(theSize);
for (i = 0; i < theSize; ++i)
ssai[i] = 15 - i * i;
// Make const version, no copy
const SSArray<int> & ssaiRef = ssai;
// Make copy (copy ctor)
SSArray<int> ssaiCopy(1);
ssaiCopy = ssaiRef;
t.test(ssaiCopy.size() == theSize, "Copy assn - check size, copy");
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssaiCopy[i] != 15 - i * i)
noErrors = false;
}
t.test(noErrors, "Copy assn - check values, copy");
// Change original
ssai[2] = 1000;
// Check original
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssai[i] != ((i == 2) ? 1000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Copy assn - change original, check values, original");
// Check copy
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssaiCopy[i] != 15 - i * i)
noErrors = false;
}
t.test(noErrors, "Copy assn - change original, check values, copy");
// Change copy
ssaiCopy[3] = 2000;
// Check original
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssai[i] != ((i == 2) ? 1000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Copy assn - change copy, check values, original");
// Check copy
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssaiCopy[i] != ((i == 3) ? 2000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Copy assn - change copy, check values, copy");
// Check self-assignment
ssaiCopy = ssaiCopy;
noErrors = true;
for (i = 0; i < theSize; ++i)
{
if (ssaiCopy[i] != ((i == 3) ? 2000 : 15 - i * i))
noErrors = false;
}
t.test(noErrors, "Copy assn - values after self-assignment");
}
// test_class_SSArray_begin_end
// Test suite for class SSArray, functions begin & end
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_begin_end(Tester & t)
{
std::cout << "Test Suite: class SSArray - functions begin & end" << std::endl;
bool correctType; // result of type checking
const int theSize = 10;
bool noErrors; // True if no errors encountered
int i; // Counter
int * iter; // iterator
const int * citer; // const_iterator
SSArray<int> ssai(theSize);
for (iter = ssai.begin(), i = 0; iter != ssai.end(); ++iter, ++i)
*iter = 15 - i * i;
// Non-const test
SSArray<double> ssad1;
correctType = TypeCheck<SSArray<double>::value_type *>::check(ssad1.begin());
t.test(correctType, "begin (non-const), return type");
correctType = TypeCheck<SSArray<double>::value_type *>::check(ssad1.end());
t.test(correctType, "end (non-const), return type");
t.test(ssai.begin() != ssai.end(), "begin/end - inequality (non-const)");
t.test (ssai.end() - ssai.begin() == theSize, "begin/end - check difference (non-const)");
noErrors = true;
for (iter = ssai.begin(), i = 0; iter != ssai.end(); ++iter, ++i)
{
if (*iter != 15 - i * i)
noErrors = false;
}
t.test(noErrors, "begin/end - check values (non-const)");
// Make const version, no copy
const SSArray<int> & ssaiRef = ssai;
// Const test
const SSArray<double> ssad2;
correctType = TypeCheck<const SSArray<double>::value_type *>::check(ssad2.begin());
t.test(correctType, "begin (const), return type");
correctType = TypeCheck<const SSArray<double>::value_type *>::check(ssad2.end());
t.test(correctType, "end (const), return type");
t.test(ssaiRef.end() - ssaiRef.begin() == theSize, "begin/end - check difference (const)");
noErrors = true;
for (citer = ssaiRef.begin(), i = 0; citer != ssaiRef.end(); ++citer, ++i)
{
if (*citer != 15 - i * i)
noErrors = false;
}
t.test(noErrors, "begin/end - check values (const)");
}
// test_class_SSArray_comparisons
// Test suite for class SSArray, comparisons
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_comparisons(Tester & t)
{
std::cout << "Test Suite: class SSArray - comparisons" << std::endl;
bool correctType; // result of type checking
const int theSize = 10;
int i; // Counter
SSArray<int> ssai1(theSize);
for (i = 0; i < theSize; ++i)
ssai1[i] = 15 - i * i;
const SSArray<int> & ssai1Ref = ssai1;
SSArray<int> ssai1Copy(ssai1Ref);
SSArray<int> ssai2(theSize-1);
for (i = 0; i < theSize-1; ++i)
ssai2[i] = 15 - i * i;
const SSArray<int> & ssai2Ref = ssai2;
// operator== return type
correctType = TypeCheck<bool>::check(ssai1 == ssai1Copy);
t.test(correctType, "operator==, return type");
// operator!= return type
correctType = TypeCheck<bool>::check(ssai1 != ssai1Copy);
t.test(correctType, "operator!=, return type");
// Check equality of copies
t.test(ssai1 == ssai1Copy, "Equality of copies");
// Check inequality of copies
t.test(!(ssai1 != ssai1Copy), "Inequality of copies");
// Check equality of different sizes #1 (compilation checks constness of op==)
t.test(!(ssai1Ref == ssai2Ref), "Equality of different sizes #1");
// Check inequality of different sizes #1 (compilation checks constness of op!=)
t.test(ssai1Ref != ssai2Ref, "Inequality of different sizes #1");
// Check equality of different sizes #2
t.test(!(ssai2Ref == ssai1Ref), "Equality of different sizes #2");
// Check inequality of different sizes #2
t.test(ssai2Ref != ssai1Ref, "Inequality of different sizes #2");
// Modify copy
++ssai1Copy[theSize-1];
// Check equality of modification of copy
t.test(!(ssai1 == ssai1Copy), "Equality of modification of copy");
// Check inequality of modification of copy
t.test(ssai1 != ssai1Copy, "Inequality of modification of copy");
}
// test_class_SSArray_ctor_dctor_count
// Test suite for class SSArray, number of class to item type
// ctor, dctor.
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray_ctor_dctor_count(Tester & t)
{
std::cout << "Test Suite: class SSArray - ctor, dctor count" << std::endl;
// Check number of value type ctor/dctor calls on array creation & destruction
CallCounter::resetCount();
{ // Block, so we get dctor calls before function ends
const SSArray<CallCounter> ssacc(10);
t.test(CallCounter::getCount() == 10, "Counting default ctor calls due to array creation");
CallCounter::resetCount();
}
t.test(CallCounter::getCount() == 10, "Counting dctor calls due to destruction");
// Check correct number of value type ctor & dctor calls on self-assignment
SSArray<CallCounter> ssacc2(10);
CallCounter::resetCount();
ssacc2 = ssacc2;
int i1 = CallCounter::getCount();
t.test(i1 == 0 || i1 == 20, "Self-assignment ctor/dctor calls");
}
// test_class_SSArray
// Test suite for class SSArray
// Uses other test-suite functions
// Pre: None.
// Post:
// Pass/fail status of tests have been registered with t.
// Appropriate messages have been printed to cout.
void test_class_SSArray(Tester & t)
{
// Do all the test suites
std::cout << "TEST SUITES FOR CLASS SSArray" << std::endl;
test_class_SSArray_types(t);
test_class_SSArray_size_and_ctor_from_size(t);
test_class_SSArray_default_ctor(t);
test_class_SSArray_bracket_op(t);
test_class_SSArray_two_param_ctor(t);
test_class_SSArray_copy_ctor(t);
test_class_SSArray_copy_assn(t);
test_class_SSArray_begin_end(t);
test_class_SSArray_comparisons(t);
test_class_SSArray_ctor_dctor_count(t);
}
// ************************************************************************
// Main program
// ************************************************************************
// main
// Runs class SSArray test suite, prints results to cout.
int main()
{
Tester t;
test_class_SSArray(t);
std::cout << std::endl;
if (t.allPassed())
{
std::cout << "All tests successful"
<< std::endl;
}
else
{
std::cout << "Tests ********** UNSUCCESSFUL **********"
<< std::endl;
}
std::cout << std::endl;
return 0;
}
|