media/utc: Improve FileInputDataSource open utc
Check mp3, aac, wav, ts header parsing with empty file
@@ -139,10 +139,23 @@ static void utc_media_FileInputDataSource_open_p(void)
}
static void utc_media_FileInputDataSource_open_n(void)
+{
+ /* Test non-exist file */
{
media::stream::FileInputDataSource source("non-exist-file");
-
TC_ASSERT_EQ("utc_media_FileInputDataSource_open", source.open(), false);
+ }
+
+ /* Test empty file */
+ constexpr char *paths[] = {"/mnt/fileinputdatasource.mp3", "/mnt/fileinputdatasource.aac", "/mnt/fileinputdatasource.wav", "/mnt/fileinputdatasource.ts"};
+ for (auto path : paths)
+ {
+ FILE *fp = fopen(path, "w");
+ fclose(fp);
+ media::stream::FileInputDataSource source(path);
+ TC_ASSERT_EQ_CLEANUP("utc_media_FileInputDataSource_open", source.open(), false, remove(path));
+ remove(path);
+ }
TC_SUCCESS_RESULT();
}
