test/data updates.
[dcpomatic.git] / test / resampler_test.cc
1 /*
2     Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file  test/resampler_test.cc
21  *  @brief Check that the timings that come back from the resampler correspond
22  *  to the number of samples it generates.
23  */
24
25 #include <boost/test/unit_test.hpp>
26 #include "lib/audio_buffers.h"
27 #include "lib/resampler.h"
28
29 using std::pair;
30 using std::cout;
31 using boost::shared_ptr;
32
33 static void
34 resampler_test_one (int from, int to)
35 {
36         Resampler resamp (from, to, 1);
37
38         /* 3 hours */
39         int64_t const N = int64_t (from) * 60 * 60 * 3;
40                 
41         /* XXX: no longer checks anything */
42         for (int64_t i = 0; i < N; i += 1000) {
43                 shared_ptr<AudioBuffers> a (new AudioBuffers (1, 1000));
44                 a->make_silent ();
45                 shared_ptr<const AudioBuffers> r = resamp.run (a);
46         }
47 }       
48                 
49 BOOST_AUTO_TEST_CASE (resampler_test)
50 {
51         resampler_test_one (44100, 48000);
52         resampler_test_one (44100, 46080);
53         resampler_test_one (44100, 50000);
54 }