import os.path
filename = os.path.join('..','..','sounds','woodblock.aiff')
- progname = os.path.join('..','..','examples','aubioonset')
+ progname = os.path.join('..','..','examples','aubionotes')
def test_aubionotes(self):
""" test aubionotes with default parameters """
self.getOutput()
# FIXME: useless check
- assert len(self.output) >= 0
+ self.assertEqual(len(self.output.split('\n')), 1)
+ self.assertEqual(float(self.output.strip()), 0.017415)
def test_aubionotes_verbose(self):
""" test aubionotes with -v parameter """
""" test aubionotes on /dev/null """
self.filename = "/dev/null"
# exit status should not be 0
- self.getOutput(expected_status = -1)
- assert self.status != 0
+ self.getOutput(expected_status = 256)
# and there should be an error message
assert len(self.output) > 0
# that looks like this
#assert output_lines[1] == "Supported file format but file is malformed."
assert output_lines[2] == "Could not open input file /dev/null."
+mode_names = ["yinfft", "yin", "fcomb", "mcomb", "schmitt"]
+for name in mode_names:
+ exec("class aubionotes_test_case_" + name + "(aubionotes_test_case):\n\
+ options = \" -p " + name + " \"")
+
if __name__ == '__main__': unittest.main()
def test_aubioonset(self):
""" test aubioonset with default parameters """
self.getOutput()
- assert len(self.output) != 0, self.output
assert len(str(self.output)) != 0, "no output produced with command:\n" \
+ self.command
self.command += " -s -100 "
self.getOutput()
# only one onset in woodblock.aiff
- assert len(self.output.split('\n')) == 1
assert len(str(self.output)) != 0, "no output produced with command:\n" \
+ self.command
+ assert len(self.output.split('\n')) == 1
# onset should be at 0.00000
assert float(self.output.strip()) == 0.
-class aubioonset_test_case_energy(aubioonset_test_case):
- def setUp(self, options = " -O energy "):
- aubioonset_test_case.setUp(self, options = options)
-
-class aubioonset_test_case_specdiff(aubioonset_test_case):
- def setUp(self, options = " -O specdiff "):
- aubioonset_test_case.setUp(self, options = options)
-
-class aubioonset_test_case_hfc(aubioonset_test_case):
- def setUp(self, options = " -O hfc "):
- aubioonset_test_case.setUp(self, options = options)
-
-class aubioonset_test_case_complex(aubioonset_test_case):
- def setUp(self, options = " -O complex "):
- aubioonset_test_case.setUp(self, options = options)
-
-class aubioonset_test_case_phase(aubioonset_test_case):
- def setUp(self, options = " -O phase"):
- aubioonset_test_case.setUp(self, options = options)
-
-class aubioonset_test_case_kl(aubioonset_test_case):
- def setUp(self, options = " -O kl "):
- aubioonset_test_case.setUp(self, options = options)
-
-class aubioonset_test_case_mkl(aubioonset_test_case):
- def setUp(self, options = " -O mkl "):
- aubioonset_test_case.setUp(self, options = options)
-
-if __name__ == '__main__':
+for name in ["energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl"]:
+ exec("class aubioonset_test_case_"+name+"(aubioonset_test_case):\n\
+ options = \" -O "+name+" \"")
- unittest.main()
+if __name__ == '__main__': unittest.main()