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

add tests for the teletext descriptor

Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent e1001cf7
...@@ -336,4 +336,8 @@ ...@@ -336,4 +336,8 @@
<array name="p_parental_rating" len_name="i_ratings_number" min_size="1" type="dvbpsi_parental_rating_t"/> <array name="p_parental_rating" len_name="i_ratings_number" min_size="1" type="dvbpsi_parental_rating_t"/>
</descriptor> </descriptor>
<descriptor name="teletext" sname="teletext" fname="Teletext">
<array name="p_pages" len_name="i_pages_number" min_size="1" type="dvbpsi_teletextpage_t"/>
</descriptor>
</dr> </dr>
...@@ -2153,6 +2153,30 @@ static int main_parental_rating_(void) ...@@ -2153,6 +2153,30 @@ static int main_parental_rating_(void)
return i_err; return i_err;
} }
/* teletext */
static int main_teletext_(void)
{
BOZO_VARS(teletext);
BOZO_START(teletext);
/* check p_pages */
BOZO_init_array(i_pages_number);
BOZO_begin_array(p_pages)
BOZO_loop_array_begin(p_pages, i_pages_number, 1)
BOZO_DOJOB(Teletext);
BOZO_check_array_begin(p_pages, i_pages_number)
BOZO_check_array_cmp(p_pages, i_pages_number, dvbpsi_teletextpage_t)
BOZO_CLEAN();
BOZO_loop_array_end(p_pages, ARRAY_SIZE(s_decoded.p_pages))
BOZO_end_array
BOZO_END(teletext);
return i_err;
}
/* main function */ /* main function */
int main(void) int main(void)
...@@ -2205,6 +2229,7 @@ int main(void) ...@@ -2205,6 +2229,7 @@ int main(void)
i_err |= main_ca_identifier_(); i_err |= main_ca_identifier_();
i_err |= main_content_(); i_err |= main_content_();
i_err |= main_parental_rating_(); i_err |= main_parental_rating_();
i_err |= main_teletext_();
if(i_err) if(i_err)
fprintf(stderr, "At least one test has FAILED !!!\n"); fprintf(stderr, "At least one test has FAILED !!!\n");
......
...@@ -56,3 +56,19 @@ static int compare_dvbpsi_parental_rating_t(const void *s1, const void *s2) ...@@ -56,3 +56,19 @@ static int compare_dvbpsi_parental_rating_t(const void *s1, const void *s2)
else if(a_cc > b_cc || a->i_rating > b->i_rating) return 1; else if(a_cc > b_cc || a->i_rating > b->i_rating) return 1;
else return 0; else return 0;
} }
static int compare_dvbpsi_teletextpage_t(const void *s1, const void *s2)
{
const dvbpsi_teletextpage_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));
uint8_t a_tt = (a->i_teletext_type & 0x1f),
a_tmn = (a->i_teletext_magazine_number & 0x07),
b_tt = (b->i_teletext_type & 0x1f),
b_tmn = (b->i_teletext_magazine_number & 0x07);
if(iso_cmp < 0 || a_tt < b_tt || a_tmn < b_tmn ||
a->i_teletext_page_number < b->i_teletext_page_number) return -1;
else if(iso_cmp > 0 || a_tt > b_tt || a_tmn > b_tmn ||
a->i_teletext_page_number > b->i_teletext_page_number) 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