def test_parse_ringtone(self): """Test if parse_tone parses multiple notes separated by commas""" self.assertEqual(rtttl2bin.parse_ringtone("Test: d=8,o=4,b=105: 2d#6., 2d8"), {'title': 'Test', 'melody': [(3, 'd#', 6), (2, 'd', 8)], "whole": 2284}) self.assertEqual(rtttl2bin.parse_ringtone("Test: d=8,o=4,b=160: d#6., 2d8"), {'title': 'Test', 'melody': [(12, 'd#', 6), (2, 'd', 8)], "whole": 1500}) self.assertEqual(rtttl2bin.parse_ringtone("Test: d=8,o=4,b=90: 2d#6., 2d"), {'title': 'Test', 'melody': [(3, 'd#', 6), (2, 'd', 4)], "whole": 2664})
def test_ringtone_generation(self): """This tests the complete generation sequence""" self.assertEqual( rtttl2bin.generate_binary_ringtone( rtttl2bin.parse_ringtone("welcome: d=16,o=4,b=150: a, c, e")), "note welcome[4] = {0x1901, 0x1904, 0x1908, 0x000F};")
def test_ringtone_generation(self): """This tests the complete generation sequence""" self.assertEqual(rtttl2bin.generate_binary_ringtone(rtttl2bin.parse_ringtone( "welcome: d=16,o=4,b=150: a, c, e")), "note welcome[4] = {0x1901, 0x1904, 0x1908, 0x000F};")