De-templatify Evoral::SMF which has no concept of time other than SMF time.
[ardour.git] / libs / evoral / test / SMFTest.hpp
1 /* This file is part of Evoral.
2  * Copyright(C) 2000-2008 Paul Davis
3  * Author: Hans Baier
4  * 
5  * Evoral is free software; you can redistribute it and/or modify it under the
6  * terms of the GNU General Public License as published by the Free Software
7  * Foundation; either version 2 of the License, or(at your option) any later
8  * version.
9  * 
10  * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for details.
13  * 
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18
19 #include <cassert>
20 #include <sigc++/sigc++.h>
21 #include <cppunit/TestFixture.h>
22 #include <cppunit/extensions/HelperMacros.h>
23 #include "evoral/SMF.hpp"
24 #include "SequenceTest.hpp"
25
26 using namespace Evoral;
27
28 class TestSMF : public SMF {
29 public:
30         std::string path() const { return _path; }
31         
32         int open(const std::string& path) THROW_FILE_ERROR {
33                 _path = path;
34                 return SMF::open(path);
35         }
36         
37         void close() THROW_FILE_ERROR {
38                 return SMF::close();
39         }
40         
41         int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const {
42                 return SMF::read_event(delta_t, size, buf);
43         }
44
45 private:
46         std::string  _path;
47 };
48
49 class SMFTest : public CppUnit::TestFixture
50 {
51     CPPUNIT_TEST_SUITE(SMFTest);
52     CPPUNIT_TEST(createNewFileTest);
53     CPPUNIT_TEST(takeFiveTest);
54     CPPUNIT_TEST_SUITE_END();
55
56     public:
57         typedef double Time;
58         
59         void setUp() { 
60            type_map = new DummyTypeMap();
61            assert(type_map);
62            seq = new MySequence<Time>(*type_map, 0);
63            assert(seq);
64         }
65         
66         void tearDown() {
67                 delete seq;
68                 delete type_map;
69         }
70
71         void createNewFileTest();
72         void takeFiveTest();
73
74     private:
75         DummyTypeMap*     type_map;
76         MySequence<Time>* seq;
77 };
78