mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-12-04 14:46:31 -05:00
Test playlist
This commit is contained in:
parent
aab0afaa82
commit
122728aaa2
@ -6,8 +6,41 @@ Suite * playlist_suite(void);
|
||||
void setup_checked(void);
|
||||
void teardown_checked(void);
|
||||
|
||||
START_TEST(test_read)
|
||||
START_TEST(test_playlist_file)
|
||||
{
|
||||
playlist_t p;
|
||||
|
||||
p = playlist_read(SRCDIR "/playlist.txt");
|
||||
ck_assert_ptr_ne(p, NULL);
|
||||
ck_assert_uint_gt(playlist_get_num_items(p), 0);
|
||||
ck_assert_str_eq(playlist_get_next(p), "1.ogg");
|
||||
playlist_skip_next(p);
|
||||
ck_assert_uint_eq(playlist_get_position(p), 2);
|
||||
ck_assert_str_eq(playlist_get_next(p), "3.ogg");
|
||||
ck_assert_int_eq(playlist_goto_entry(p, "2.ogg"), 1);
|
||||
ck_assert_str_eq(playlist_get_next(p), "2.ogg");
|
||||
playlist_rewind(p);
|
||||
ck_assert_str_eq(playlist_get_next(p), "1.ogg");
|
||||
ck_assert_int_eq(playlist_goto_entry(p, "5.ogg"), 1);
|
||||
ck_assert_int_eq(playlist_goto_entry(p, "6.ogg"), 0);
|
||||
ck_assert_str_eq(playlist_get_next(p), "5.ogg");
|
||||
ck_assert_ptr_eq(playlist_get_next(p), NULL);
|
||||
ck_assert_int_eq(playlist_reread(&p), 1);
|
||||
ck_assert_str_eq(playlist_get_next(p), "1.ogg");
|
||||
playlist_shuffle(p);
|
||||
playlist_free(&p);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_playlist_program)
|
||||
{
|
||||
playlist_t p;
|
||||
|
||||
p = playlist_program(EXAMPLESDIR "/play.sh");
|
||||
ck_assert_ptr_ne(p, NULL);
|
||||
ck_assert_str_eq(playlist_get_next(p),
|
||||
"Great_Artist_-_Great_Song.ogg");
|
||||
playlist_free(&p);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
@ -21,7 +54,8 @@ playlist_suite(void)
|
||||
|
||||
tc_playlist = tcase_create("Playlist");
|
||||
tcase_add_checked_fixture(tc_playlist, setup_checked, teardown_checked);
|
||||
tcase_add_test(tc_playlist, test_read);
|
||||
tcase_add_test(tc_playlist, test_playlist_file);
|
||||
tcase_add_test(tc_playlist, test_playlist_program);
|
||||
suite_add_tcase(s, tc_playlist);
|
||||
|
||||
return (s);
|
||||
|
Loading…
Reference in New Issue
Block a user