[031b1f9] | 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') |
---|
[100f950] | 7 | progname = os.path.join('..','..','examples','aubionotes') |
---|
[031b1f9] | 8 | |
---|
| 9 | def test_aubionotes(self): |
---|
| 10 | """ test aubionotes with default parameters """ |
---|
| 11 | self.getOutput() |
---|
| 12 | # FIXME: useless check |
---|
[100f950] | 13 | self.assertEqual(len(self.output.split('\n')), 1) |
---|
| 14 | self.assertEqual(float(self.output.strip()), 0.017415) |
---|
[031b1f9] | 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 |
---|
[100f950] | 27 | self.getOutput(expected_status = 256) |
---|
[031b1f9] | 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 | assert output_lines[0] == "Unable to open input file /dev/null." |
---|
| 33 | #assert output_lines[1] == "Supported file format but file is malformed." |
---|
| 34 | assert output_lines[2] == "Could not open input file /dev/null." |
---|
| 35 | |
---|
[100f950] | 36 | mode_names = ["yinfft", "yin", "fcomb", "mcomb", "schmitt"] |
---|
| 37 | for name in mode_names: |
---|
| 38 | exec("class aubionotes_test_case_" + name + "(aubionotes_test_case):\n\ |
---|
| 39 | options = \" -p " + name + " \"") |
---|
| 40 | |
---|
[031b1f9] | 41 | if __name__ == '__main__': unittest.main() |
---|