WLoaderManager_test.h 2.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------

#ifndef WLOADERMANAGER_TEST_H
#define WLOADERMANAGER_TEST_H

27 28 29 30
#include <string>
#include <iostream>

#include <boost/shared_ptr.hpp>
31 32
#include <cxxtest/TestSuite.h>

33 34

#include "../WDataHandler.h"
35
#include "../WLoaderManager.h"
36
#include "../WDataSet.h"
37 38

/**
39
 * Testsuite for WLoaderManager.
40 41 42 43 44
 */
class WLoaderManagerTest : public CxxTest::TestSuite
{
public:
    /**
45
     * Test the loading routine.
46
     */
47
    void testLoad( void )
48
    {
49 50 51 52
        std::string fileName = "fixtures/scalar_signed_short.nii.gz";
        std::cout << "Test loading of " << fileName << "." << std::endl;
        boost::shared_ptr< WDataHandler > dataHandler =
            boost::shared_ptr< WDataHandler >( new WDataHandler() );
53
        TS_ASSERT_EQUALS( dataHandler->getNumberOfSubjects(), 0 );
54 55 56
        WLoaderManager testLoaderManager;
        testLoaderManager.load( fileName, dataHandler );
        sleep( 4 );  // we need this to allow the thread to terminate
57
        // TODO(wiebel): we need to change this because loading, in the end,
58
        // should not always increase the number of subjects.
59
        TS_ASSERT_EQUALS( dataHandler->getNumberOfSubjects(), 1 );
60 61 62 63
    }
};

#endif  // WLOADERMANAGER_TEST_H