2009-02-14 12:35:34 -05:00
|
|
|
/* This file is part of Evoral.
|
|
|
|
* Copyright(C) 2000-2008 Paul Davis
|
|
|
|
* Author: Hans Baier
|
|
|
|
*
|
|
|
|
* Evoral is free software; you can redistribute it and/or modify it under the
|
|
|
|
* terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation; either version 2 of the License, or(at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* Evoral 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 General Public License for details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cassert>
|
2009-05-17 20:21:17 -04:00
|
|
|
#include <stdint.h>
|
2009-02-14 12:35:34 -05:00
|
|
|
#include <sigc++/sigc++.h>
|
2009-02-09 17:32:38 -05:00
|
|
|
#include <cppunit/TestFixture.h>
|
|
|
|
#include <cppunit/extensions/HelperMacros.h>
|
2009-02-14 12:35:34 -05:00
|
|
|
#include "evoral/SMF.hpp"
|
2009-02-10 18:58:02 -05:00
|
|
|
#include "SequenceTest.hpp"
|
|
|
|
|
|
|
|
using namespace Evoral;
|
|
|
|
|
2009-02-14 20:32:41 -05:00
|
|
|
class TestSMF : public SMF {
|
2009-02-10 18:58:02 -05:00
|
|
|
public:
|
2009-02-12 18:28:51 -05:00
|
|
|
std::string path() const { return _path; }
|
|
|
|
|
2009-02-11 12:59:33 -05:00
|
|
|
int open(const std::string& path) THROW_FILE_ERROR {
|
2009-02-12 18:28:51 -05:00
|
|
|
_path = path;
|
2009-02-14 20:32:41 -05:00
|
|
|
return SMF::open(path);
|
2009-02-10 18:58:02 -05:00
|
|
|
}
|
|
|
|
|
2009-02-12 18:28:51 -05:00
|
|
|
void close() THROW_FILE_ERROR {
|
2009-02-14 20:32:41 -05:00
|
|
|
return SMF::close();
|
2009-02-12 18:28:51 -05:00
|
|
|
}
|
|
|
|
|
2009-02-10 18:58:02 -05:00
|
|
|
int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const {
|
2009-02-14 20:32:41 -05:00
|
|
|
return SMF::read_event(delta_t, size, buf);
|
2009-02-10 18:58:02 -05:00
|
|
|
}
|
2009-02-12 18:28:51 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::string _path;
|
2009-02-10 18:58:02 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class SMFTest : public CppUnit::TestFixture
|
|
|
|
{
|
2009-02-14 12:35:34 -05:00
|
|
|
CPPUNIT_TEST_SUITE(SMFTest);
|
|
|
|
CPPUNIT_TEST(createNewFileTest);
|
|
|
|
CPPUNIT_TEST(takeFiveTest);
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
2009-02-10 18:58:02 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
typedef double Time;
|
|
|
|
|
2009-02-14 12:35:34 -05:00
|
|
|
void setUp() {
|
2009-02-10 18:58:02 -05:00
|
|
|
type_map = new DummyTypeMap();
|
|
|
|
assert(type_map);
|
|
|
|
seq = new MySequence<Time>(*type_map, 0);
|
|
|
|
assert(seq);
|
|
|
|
}
|
|
|
|
|
2009-02-14 12:35:34 -05:00
|
|
|
void tearDown() {
|
2009-02-10 18:58:02 -05:00
|
|
|
delete seq;
|
|
|
|
delete type_map;
|
|
|
|
}
|
|
|
|
|
2009-02-14 12:35:34 -05:00
|
|
|
void createNewFileTest();
|
|
|
|
void takeFiveTest();
|
2009-02-10 18:58:02 -05:00
|
|
|
|
|
|
|
private:
|
2009-02-14 12:35:34 -05:00
|
|
|
DummyTypeMap* type_map;
|
|
|
|
MySequence<Time>* seq;
|
2009-02-10 18:58:02 -05:00
|
|
|
};
|
2009-02-14 12:35:34 -05:00
|
|
|
|