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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// ------------------------------------------------------------------------
// audioio_test.h: Unit test for AUDIO_IO
// Copyright (C) 2002 Kai Vehmanen
//
// This program 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.
// 
// This program 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 more 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
// ------------------------------------------------------------------------

#include <string>

#include "audioio.h"
#include "eca-object-factory.h"
#include "eca-object-map.h"

#include "kvu_numtostr.h"

#include "eca-logger.h"
#include "eca-test-case.h"

using namespace std;

/**
 * Unit test for AUDIO_IO.
 *
 * FIXME: implementation not ready
 */
class AUDIO_IO_TEST : public ECA_TEST_CASE {

protected:

  virtual string do_name(void) const { return("Unit test for AUDIO_IO"); }
  virtual void do_run(void);

public:

  virtual ~AUDIO_IO(void) { }

};

void AUDIO_IOTEST::do_run(void)
{
  /**
   * - create AUDIO_IO types from ECA_OBJECT_FACTORY
   * - check that type supports both read and write modes
   * - create a test filename
   * - repeat for permutations of 'audio_format' 
   *   and buffersize:
   *     - open for write
   *     - verify is_open
'  *     - write random length of data (len1, predefined content)
   *     - close 
   *     - verify close
   *     - if read_n_write mode supported:
   *         - open for read_write
   *         - verify is_open
   *         - seek_to_end
   *         - write random length of data (len2, predefined content)
   *         - close
   *         - verify close
   *     - open for read
   *     - verify is_open
   *     - read clip1 from start (seek + read)
   *     - read clip2 from random pos
   *     - verify that clip1 and clip2 match written data
   *     - check file length against len1+len2
   *     - close 
   *     - verify close
   *     - remove file
   */
}