'Tests the output for the given parameters.'

def runTest(self, relative_root, recursive):

    root_dir = os.path.join(self.root_dir, relative_root)
    expected_filenames = self.expected_dir_midi_contents[relative_root]
    if recursive:
        for sub_dir in self.expected_sub_dirs[relative_root]:
            for filename in self.expected_dir_midi_contents[os.path.join(relative_root, sub_dir)]:
                expected_filenames.add(os.path.join(sub_dir, filename))
    with tempfile.NamedTemporaryFile(prefix='ConvertMidiDirToSequencesTest') as output_file:
        convert_dir_to_note_sequences.convert_directory(root_dir, output_file.name, 1, recursive)
        actual_filenames = set()
        for sequence in note_sequence_io.note_sequence_record_iterator(output_file.name):
            self.assertEquals(note_sequence_io.generate_note_sequence_id(sequence.filename, os.path.basename(relative_root), 'midi'), sequence.id)
            self.assertEquals(os.path.basename(root_dir), sequence.collection_name)
            self.assertNotEquals(0, len(sequence.notes))
            actual_filenames.add(sequence.filename)
    self.assertEquals(expected_filenames, actual_filenames)
