[031b1f9] | 1 | from template import * |
---|
| 2 | |
---|
| 3 | class aubioonset_test_case(program_test_case): |
---|
| 4 | |
---|
| 5 | import os.path |
---|
| 6 | filename = os.path.join('..','..','sounds','woodblock.aiff') |
---|
| 7 | progname = os.path.join('..','..','examples','aubioonset') |
---|
| 8 | |
---|
| 9 | def test_aubioonset(self): |
---|
| 10 | """ test aubioonset with default parameters """ |
---|
| 11 | self.getOutput() |
---|
[9f9f63f] | 12 | assert len(self.output) != 0, self.output |
---|
| 13 | assert len(str(self.output)) != 0, "no output produced with command:\n" \ |
---|
| 14 | + self.command |
---|
[031b1f9] | 15 | |
---|
| 16 | def test_aubioonset_with_inf_silence(self): |
---|
| 17 | """ test aubioonset with -s 0 """ |
---|
| 18 | self.command += " -s 0" |
---|
| 19 | self.getOutput() |
---|
| 20 | assert len(self.output) == 0, self.output |
---|
| 21 | |
---|
| 22 | def test_aubioonset_with_no_silence(self): |
---|
| 23 | """ test aubioonset with -s -100 """ |
---|
| 24 | self.command += " -s -100 " |
---|
| 25 | self.getOutput() |
---|
| 26 | # only one onset in woodblock.aiff |
---|
| 27 | assert len(self.output.split('\n')) == 1 |
---|
[9f9f63f] | 28 | assert len(str(self.output)) != 0, "no output produced with command:\n" \ |
---|
| 29 | + self.command |
---|
[031b1f9] | 30 | # onset should be at 0.00000 |
---|
| 31 | assert float(self.output.strip()) == 0. |
---|
| 32 | |
---|
| 33 | class aubioonset_test_case_energy(aubioonset_test_case): |
---|
| 34 | def setUp(self, options = " -O energy "): |
---|
| 35 | aubioonset_test_case.setUp(self, options = options) |
---|
| 36 | |
---|
| 37 | class aubioonset_test_case_specdiff(aubioonset_test_case): |
---|
| 38 | def setUp(self, options = " -O specdiff "): |
---|
| 39 | aubioonset_test_case.setUp(self, options = options) |
---|
| 40 | |
---|
| 41 | class aubioonset_test_case_hfc(aubioonset_test_case): |
---|
| 42 | def setUp(self, options = " -O hfc "): |
---|
| 43 | aubioonset_test_case.setUp(self, options = options) |
---|
| 44 | |
---|
| 45 | class aubioonset_test_case_complex(aubioonset_test_case): |
---|
| 46 | def setUp(self, options = " -O complex "): |
---|
| 47 | aubioonset_test_case.setUp(self, options = options) |
---|
| 48 | |
---|
| 49 | class aubioonset_test_case_phase(aubioonset_test_case): |
---|
[9f9f63f] | 50 | def setUp(self, options = " -O phase"): |
---|
[031b1f9] | 51 | aubioonset_test_case.setUp(self, options = options) |
---|
| 52 | |
---|
| 53 | class aubioonset_test_case_kl(aubioonset_test_case): |
---|
| 54 | def setUp(self, options = " -O kl "): |
---|
| 55 | aubioonset_test_case.setUp(self, options = options) |
---|
| 56 | |
---|
| 57 | class aubioonset_test_case_mkl(aubioonset_test_case): |
---|
| 58 | def setUp(self, options = " -O mkl "): |
---|
| 59 | aubioonset_test_case.setUp(self, options = options) |
---|
| 60 | |
---|
| 61 | if __name__ == '__main__': |
---|
[9f9f63f] | 62 | |
---|
[031b1f9] | 63 | unittest.main() |
---|