Prevent uninitialized use of prev_preset and assume VintageDreams soundfont for test

This commit is contained in:
Marcus Weseloh 2018-04-10 22:08:09 +02:00
parent efa97718fa
commit fdd6804ae8

View file

@ -5,18 +5,17 @@
int main(void) int main(void)
{ {
char *s;
int id; int id;
fluid_sfont_t *sfont; fluid_sfont_t *sfont;
fluid_preset_t *preset; fluid_preset_t *preset;
fluid_preset_t *prev_preset; fluid_preset_t *prev_preset = NULL;
int count = 0; int count = 0;
/* setup */ /* setup */
fluid_settings_t *settings = new_fluid_settings(); fluid_settings_t *settings = new_fluid_settings();
fluid_synth_t *synth = new_fluid_synth(settings); fluid_synth_t *synth = new_fluid_synth(settings);
fluid_settings_dupstr(settings, "synth.default-soundfont", &s); /* Load the VintageDreams soundfont */
id = fluid_synth_sfload(synth, s, 1); id = fluid_synth_sfload(synth, DEFAULT_SOUNDFONT, 1);
sfont = fluid_synth_get_sfont_by_id(synth, id); sfont = fluid_synth_get_sfont_by_id(synth, id);
/* code under test */ /* code under test */
@ -27,10 +26,12 @@ int main(void)
/* make sure we actually got a different preset */ /* make sure we actually got a different preset */
TEST_ASSERT(preset != prev_preset); TEST_ASSERT(preset != prev_preset);
prev_preset = preset; prev_preset = preset;
} }
TEST_ASSERT(count > 0); /* VintageDreams has 136 presets */
TEST_ASSERT(count == 136);
/* teardown */ /* teardown */
delete_fluid_synth(synth); delete_fluid_synth(synth);