Skip to content
Snippets Groups Projects
Unverified Commit 0d88703e authored by mirabilos's avatar mirabilos Committed by mirabilos
Browse files

add a couple of tests, both MML and frequency/duration outputs

parent 1ad9eeb9
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@
# Copyright © 2017
# Dominik George <nik@naturalnet.de>
# Copyright © 2021
# mirabilos <m@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
# are retained or reproduced in an accompanying document, permission
......@@ -25,6 +27,7 @@ import unittest
from .util import round_sequence_r, TestCase
from mmllib.parser import mml_file, mml_file_meta
from mmllib.mml import mml
class ParserTests(TestCase):
def setUp(self):
......@@ -556,5 +559,40 @@ class ParserTests(TestCase):
1]]
self.assertListEqual(round_sequence_r(res), round_sequence_r(expected))
def test_mml_details(self):
input = 'ml|ol o bc n cb p bc- p cb+ p o5cbf p o5cn60f'
expected_mml = "O4L4T120MN ML O4B>CN0C<BP4BBP4CCP4O5C<BFP4O5CN60F"
expected_lst = [
# B C → B >C
(1975.533205024496, 0.5),
(2093.004522404789, 0.5),
(0, 0.5),
# C B → C <B
(2093.004522404789, 0.5),
(1975.533205024496, 0.5),
(0, 0.5),
# B C♭(=B) → B‿B
(1975.533205024496, 1.0),
(0, 0.5),
# C B♯(=C) → C‿C
(2093.004522404789, 1.0),
(0, 0.5),
# C B F → C <B F
(2093.004522404789, 0.5),
(1975.533205024496, 0.5),
(1396.9129257320155, 0.5),
(0, 0.5),
# C B† F → C B F (†=with N command)
# because N doesn’t affect octave tracking
(2093.004522404789, 0.5),
(1975.533205024496, 0.5),
(2793.825851464031, 0.5)]
res = [0, 0]
def _getres(s):
res[0] = s
res[1] = mml(input, _mmltrk=_getres)
self.assertEqual(res[0], expected_mml)
self.assertListEqual(round_sequence_r(res[1]), round_sequence_r(expected_lst))
if __name__ == "__main__":
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment