Ejemplo n.º 1
0
// test_class_SSArray_size_and_ctor_from_size
// Test suite for class template 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.
// Does not throw (No-Throw Guarantee)
void test_class_SSArray_size_and_ctor_from_size(Tester & t)
{
    std::cout << "Test Suite: class template SSArray - "
              << "function size, ctor from size"
              << std::endl;

    bool correctType;  // result of type checking

    const SSArray<int> tai1(1);

    correctType = TypeCheck<SSArray<int>::size_type>::check(tai1.size());
    t.test(correctType, "size, return type");

    t.test(tai1.size() == 1, "ctor from size (const) #1, check size");

    const SSArray<int> tai2(10);
    t.test(tai2.size() == 10, "ctor from size (const) #2, check size");

    const SSArray<double> tad(100);
    t.test(tad.size() == 100, "ctor from size (const) #3, check size");

    SSArray<int> tai3(20);
    t.test(tai3.size() == 20, "ctor from size (non-const), check size");

    const SSArray<int> tai4(0);
    t.test(tai4.size() == 0, "ctor from size (size 0), check size");
}
Ejemplo n.º 2
0
// 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 have been messages 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;

    const SSArray<int> ssai(10);
    t.test(ssai.size() == 10, "size, ctor from size (const) #1");

    const SSArray<double> ssad(100);
    t.test(ssad.size() == 100, "size, ctor from size (const) #2)");

    SSArray<int> ssai2(20);
    t.test(ssai2.size() == 20, "size, ctor from size (non-const)");
}
Ejemplo n.º 3
0
// test_class_SSArray_default_ctor
// Test suite for class template SSArray, default ctor
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate have been messages printed to cout.
// Does not throw (No-Throw Guarantee)
void test_class_SSArray_default_ctor(Tester & t)
{
    std::cout << "Test Suite: class template SSArray - default ctor"
              << std::endl;

    const SSArray<int> tai1;
    t.test(tai1.size() == 10, "default ctor, size");
}