/*
 * I1D.h
 *
 * Unit tests of methods for creating and deleting 1D pointer-based matrices.
 *
 *  Created on: Feb 7, 2014
 *      Author: godin
 */

#ifndef I1D_TEST_H_
#define I1D_TEST_H_

#include "I1D.h"

#include <cxxtest/TestSuite.h>

class I1D_Test : public CxxTest::TestSuite
{
public:

    // Test basic allocation and access
    void testNew( void )
    {
        int m = 7;
        float* values = I1D<float>::New1D( m );
        float inc = 1;
        for( int i = 0; i < m; ++i )
        {
            values[i] = inc;
            ++inc;
        }
        int sum = 0;
        for( int i = 0; i < m; ++i )
        {
            sum = sum + values[i];
        }
        TS_ASSERT_DELTA( sum, m * ( m + 1 ) / 2.0f, 0.01 );
        I1D<float>::Delete1D( values );
    }
};

#endif /* I1D_TEST_H_ */
