1 | from template import * |
---|
2 | |
---|
3 | class aubionotes_test_case(program_test_case): |
---|
4 | |
---|
5 | import os.path |
---|
6 | filename = os.path.join('..','..','sounds','woodblock.aiff') |
---|
7 | progname = os.path.join('..','..','examples','aubionotes') |
---|
8 | |
---|
9 | def test_aubionotes(self): |
---|
10 | """ test aubionotes with default parameters """ |
---|
11 | self.getOutput() |
---|
12 | # FIXME: useless check |
---|
13 | self.assertEqual(len(self.output.split('\n')), 1) |
---|
14 | self.assertEqual(float(self.output.strip()), 0.017415) |
---|
15 | |
---|
16 | def test_aubionotes_verbose(self): |
---|
17 | """ test aubionotes with -v parameter """ |
---|
18 | self.command += " -v " |
---|
19 | self.getOutput() |
---|
20 | # FIXME: loose checking: make sure at least 8 lines are printed |
---|
21 | assert len(self.output) >= 8 |
---|
22 | |
---|
23 | def test_aubionotes_devnull(self): |
---|
24 | """ test aubionotes on /dev/null """ |
---|
25 | self.filename = "/dev/null" |
---|
26 | # exit status should not be 0 |
---|
27 | self.getOutput(expected_status = 256) |
---|
28 | # and there should be an error message |
---|
29 | assert len(self.output) > 0 |
---|
30 | # that looks like this |
---|
31 | #output_lines = self.output.split('\n') |
---|
32 | #for line in output_lines: |
---|
33 | # print line |
---|
34 | |
---|
35 | mode_names = ["yinfft", "yin", "fcomb", "mcomb", "schmitt"] |
---|
36 | for name in mode_names: |
---|
37 | exec("class aubionotes_test_case_" + name + "(aubionotes_test_case):\n\ |
---|
38 | options = \" -p " + name + " \"") |
---|
39 | |
---|
40 | if __name__ == '__main__': unittest.main() |
---|