1
// ------------------------------------------------------------------------
2
// eca-audio-time_test.h: Unit test for ECA_AUDIO_TIME
3
// Copyright (C) 2008 Kai Vehmanen
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 2 of the License, or
8
// (at your option) any later version.
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
// ------------------------------------------------------------------------
22
#include "kvu_utils.h" /* kvu_sleep() */
24
#include "eca-control.h"
25
#include "eca-test-case.h"
30
* Unit test for ECA_CONTROL.
32
* FIXME: implementation not ready
34
class ECA_AUDIO_TIME_TEST : public ECA_TEST_CASE {
38
virtual string do_name(void) const { return("Unit test for ECA_AUDIO_TIME"); }
39
virtual void do_run(void);
43
virtual ~ECA_AUDIO_TIME_TEST(void) { }
49
void ECA_AUDIO_TIME_TEST::do_run(void)
51
cerr << "libecasound_tester: eca-audio-time" << endl;
53
ECA_AUDIO_TIME v ("88200sa");
54
v.set_samples_per_second(44100);
55
if (v.samples() != 88200)
56
ECA_TEST_FAILURE("Incorrect sample count (from-samples).");
58
if (v.seconds() != 2.0f)
59
ECA_TEST_FAILURE("Incorrect time in seconds (from-samples).");
61
v.set_time_string("2.0");
62
if (v.samples() != 88200)
63
ECA_TEST_FAILURE("Incorrect sample count (from-secs).");
65
if (v.seconds() != 2.0f)
66
ECA_TEST_FAILURE("Incorrect time in seconds (from-secs).");