~ubuntu-branches/ubuntu/natty/ecasound2.2/natty

« back to all changes in this revision

Viewing changes to libecasound/eca-audio-time_test.h

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2008-09-26 09:58:52 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080926095852-k3v9ewhmxpaltusw
Tags: 2.5.2-3
yodl 2.13.1 removed --unique-output option. Remove --unique-output
accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ------------------------------------------------------------------------
 
2
// eca-audio-time_test.h: Unit test for ECA_AUDIO_TIME
 
3
// Copyright (C) 2008 Kai Vehmanen
 
4
//
 
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.
 
9
// 
 
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.
 
14
// 
 
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
// ------------------------------------------------------------------------
 
19
 
 
20
#include <string>
 
21
 
 
22
#include "kvu_utils.h" /* kvu_sleep() */
 
23
 
 
24
#include "eca-control.h"
 
25
#include "eca-test-case.h"
 
26
 
 
27
using namespace std;
 
28
 
 
29
/**
 
30
 * Unit test for ECA_CONTROL.
 
31
 *
 
32
 * FIXME: implementation not ready
 
33
 */
 
34
class ECA_AUDIO_TIME_TEST : public ECA_TEST_CASE {
 
35
 
 
36
protected:
 
37
 
 
38
  virtual string do_name(void) const { return("Unit test for ECA_AUDIO_TIME"); }
 
39
  virtual void do_run(void);
 
40
 
 
41
public:
 
42
 
 
43
  virtual ~ECA_AUDIO_TIME_TEST(void) { }
 
44
 
 
45
private:
 
46
 
 
47
};
 
48
 
 
49
void ECA_AUDIO_TIME_TEST::do_run(void)
 
50
{
 
51
  cerr << "libecasound_tester: eca-audio-time" << endl;
 
52
 
 
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).");
 
57
 
 
58
  if (v.seconds() != 2.0f)
 
59
    ECA_TEST_FAILURE("Incorrect time in seconds (from-samples).");
 
60
 
 
61
  v.set_time_string("2.0");
 
62
  if (v.samples() != 88200)
 
63
    ECA_TEST_FAILURE("Incorrect sample count (from-secs).");
 
64
 
 
65
  if (v.seconds() != 2.0f)
 
66
    ECA_TEST_FAILURE("Incorrect time in seconds (from-secs).");
 
67
 
 
68
}