from sound_functions import *
from parsenotes import song_parse
    
def test(): 
    testarray = ["ABCDEFG","APBPPCPPPDPPPPEPPPPPFPPPPPPGPPPPPPPA","1C2D3E4F","E>E>>E>>>E<E<<E<<<E<<<<E","C++++C---C","C|D","++C|--D","[60]CCCC",">+CCGG<AA2G|+CGEG<CA2E","[60]CC|CC", "13C"]
    
    a = 0
    result = ['FAILED','PASSED']

    for notestring in testarray:
        snd = song_parse(notestring)
        expected = load_sound("testsounds/test%02d.wav" % a)
        # this ensures that students not using create_sound(1) don't fail tests 
        if snd.get_sample(0).get_value() == 0:
            snd.crop(1, len(snd)-1)
        print "Testing %s: %s" % (notestring, result[snd == expected])
        a += 1

        
if __name__ == "__main__":
    test()