Commit aefec86e authored by Daniel Kamil Kozar's avatar Daniel Kamil Kozar Committed by Jean-Paul Saman

add tests for the subtitling descriptor

Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jpsaman@videolan.org>
parent 9ce67f5b
......@@ -344,4 +344,8 @@
<array name="p_local_time_offset" len_name="i_local_time_offsets_number" min_size="1" type="dvbpsi_local_time_offset_t"/>
</descriptor>
<descriptor name="subtitling" sname="subtitling" fname="Subtitling">
<array name="p_subtitle" len_name="i_subtitles_number" min_size="1" type="dvbpsi_subtitle_t"/>
</descriptor>
</dr>
......@@ -2201,6 +2201,30 @@ static int main_local_time_offset_(void)
return i_err;
}
/* subtitling */
static int main_subtitling_(void)
{
BOZO_VARS(subtitling);
BOZO_START(subtitling);
/* check p_subtitle */
BOZO_init_array(i_subtitles_number);
BOZO_begin_array(p_subtitle)
BOZO_loop_array_begin(p_subtitle, i_subtitles_number, 1)
BOZO_DOJOB(Subtitling);
BOZO_check_array_begin(p_subtitle, i_subtitles_number)
BOZO_check_array_cmp(p_subtitle, i_subtitles_number, dvbpsi_subtitle_t)
BOZO_CLEAN();
BOZO_loop_array_end(p_subtitle, ARRAY_SIZE(s_decoded.p_subtitle))
BOZO_end_array
BOZO_END(subtitling);
return i_err;
}
/* main function */
int main(void)
......@@ -2255,6 +2279,7 @@ int main(void)
i_err |= main_parental_rating_();
i_err |= main_teletext_();
i_err |= main_local_time_offset_();
i_err |= main_subtitling_();
if(i_err)
fprintf(stderr, "At least one test has FAILED !!!\n");
......
......@@ -95,3 +95,18 @@ static int compare_dvbpsi_local_time_offset_t(const void *s1, const void *s2)
return 1;
else return 0;
}
static int compare_dvbpsi_subtitle_t(const void *s1, const void *s2)
{
const dvbpsi_subtitle_t *a = s1, *b = s2;
int iso_cmp = memcmp(a->i_iso6392_language_code, b->i_iso6392_language_code,
sizeof(a->i_iso6392_language_code));
if(iso_cmp < 0 || a->i_subtitling_type < b->i_subtitling_type ||
a->i_composition_page_id < b->i_composition_page_id ||
a->i_ancillary_page_id < b->i_ancillary_page_id) return -1;
else if(iso_cmp > 0 || a->i_subtitling_type > b->i_subtitling_type ||
a->i_composition_page_id > b->i_composition_page_id ||
a->i_ancillary_page_id > b->i_ancillary_page_id) return 1;
else return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment