* misc/dr.dtd, misc/dr.xml, misc/dr.xsl, misc/test_dr.h, misc/test_dr.c: more improvement.

parent 9d4d880d
...@@ -20,9 +20,6 @@ ...@@ -20,9 +20,6 @@
<!ATTLIST integer name CDATA #IMPLIED> <!ATTLIST integer name CDATA #IMPLIED>
<!ATTLIST integer bitcount CDATA #IMPLIED> <!ATTLIST integer bitcount CDATA #IMPLIED>
<!ATTLIST integer default CDATA #IMPLIED> <!ATTLIST integer default CDATA #IMPLIED>
<!ATTLIST integer min CDATA #IMPLIED>
<!ATTLIST integer max CDATA #IMPLIED>
<!ATTLIST integer step CDATA #IMPLIED>
<!ATTLIST boolean name CDATA #IMPLIED> <!ATTLIST boolean name CDATA #IMPLIED>
<!ATTLIST boolean default CDATA #IMPLIED> <!ATTLIST boolean default CDATA #IMPLIED>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</insert> </insert>
<boolean name="b_constrained_parameter" default="0" /> <boolean name="b_constrained_parameter" default="0" />
<boolean name="b_still_picture" default="0" /> <boolean name="b_still_picture" default="0" />
<integer name="i_profile_level_indication" bitcount="8" default="0" max="0xff - 1" /> <integer name="i_profile_level_indication" bitcount="8" default="0" />
<integer name="i_chroma_format" bitcount="2" default="0" /> <integer name="i_chroma_format" bitcount="2" default="0" />
<boolean name="b_frame_rate_extension" default="0" /> <boolean name="b_frame_rate_extension" default="0" />
</descriptor> </descriptor>
...@@ -45,12 +45,11 @@ ...@@ -45,12 +45,11 @@
<begin> <begin>
s_decoded.i_additional_length = 0;</begin> s_decoded.i_additional_length = 0;</begin>
</insert> </insert>
<integer name="i_format_identifier" bitcount="32" default="0" max="0xffff" /> <integer name="i_format_identifier" bitcount="32" default="0" />
<integer name="i_format_identifier" bitcount="32" default="0" max="0xffff0000" step="0x10000" />
</descriptor> </descriptor>
<descriptor name="data stream alignment" sname="ds_alignment" fname="DSAlignment"> <descriptor name="data stream alignment" sname="ds_alignment" fname="DSAlignment">
<integer name="i_alignment_type" bitcount="8" default="0" max="0xff - 1" /> <integer name="i_alignment_type" bitcount="8" default="0" />
</descriptor> </descriptor>
<descriptor name="target background grid" sname="target_bg_grid" fname="TargetBgGrid"> <descriptor name="target background grid" sname="target_bg_grid" fname="TargetBgGrid">
...@@ -70,7 +69,7 @@ ...@@ -70,7 +69,7 @@
<begin> <begin>
s_decoded.i_private_length = 0;</begin> s_decoded.i_private_length = 0;</begin>
</insert> </insert>
<integer name="i_ca_system_id" bitcount="16" default="0" max="0xffff - 1" /> <integer name="i_ca_system_id" bitcount="16" default="0" />
<integer name="i_ca_pid" bitcount="13" default="0" /> <integer name="i_ca_pid" bitcount="13" default="0" />
</descriptor> </descriptor>
...@@ -79,7 +78,7 @@ ...@@ -79,7 +78,7 @@
<begin> <begin>
s_decoded.i_code_count = 0;</begin> s_decoded.i_code_count = 0;</begin>
</insert> </insert>
<integer name="i_audio_type" bitcount="8" default="0" max="0xff - 1" /> <integer name="i_audio_type" bitcount="8" default="0" />
</descriptor> </descriptor>
</dr> </dr>
...@@ -36,6 +36,11 @@ int main() ...@@ -36,6 +36,11 @@ int main()
int i_err = 0; int i_err = 0;
<xsl:apply-templates mode="main" /> <xsl:apply-templates mode="main" />
if(i_err)
fprintf(stderr, "At least one test has FAILED !!!\n");
else
fprintf(stdout, "All tests succeeded.\n");
return i_err; return i_err;
} }
...@@ -86,11 +91,11 @@ int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix" />() ...@@ -86,11 +91,11 @@ int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix" />()
<xsl:template match="integer" mode="check"> <xsl:template match="integer" mode="check">
/* check <xsl:value-of select="@name" /> */<xsl:apply-templates select=".." mode="init" /> /* check <xsl:value-of select="@name" /> */<xsl:apply-templates select=".." mode="init" />
BOZO_begin_integer(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />, <xsl:choose><xsl:when test="@min != ''"><xsl:value-of select="@min" /></xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose>) BOZO_begin_integer(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />)
BOZO_DOJOB(<xsl:value-of select="../@fname" />); BOZO_DOJOB(<xsl:value-of select="../@fname" />);
BOZO_check_integer<xsl:if test="@bitcount='32' or @bitcount='64'" ><xsl:value-of select="@bitcount" /></xsl:if>(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />) BOZO_check_integer(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />, <xsl:choose><xsl:when test="@max != ''"><xsl:value-of select="@max" /></xsl:when><xsl:otherwise>(1 &lt;&lt; <xsl:value-of select="@bitcount" />) - 1</xsl:otherwise></xsl:choose>, <xsl:choose><xsl:when test="@step != ''"><xsl:value-of select="@step" /></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose>) BOZO_end_integer(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />)
</xsl:template> </xsl:template>
<xsl:template match="boolean" mode="check"> <xsl:template match="boolean" mode="check">
......
...@@ -45,11 +45,11 @@ int main_vstream_1() ...@@ -45,11 +45,11 @@ int main_vstream_1()
s_decoded.b_mpeg2 = 0; s_decoded.b_mpeg2 = 0;
BOZO_init_boolean(b_constrained_parameter, 0); BOZO_init_boolean(b_constrained_parameter, 0);
BOZO_init_boolean(b_still_picture, 0); BOZO_init_boolean(b_still_picture, 0);
BOZO_begin_integer(i_frame_rate_code, 4, 0) BOZO_begin_integer(i_frame_rate_code, 4)
BOZO_DOJOB(VStream); BOZO_DOJOB(VStream);
BOZO_check_integer(i_frame_rate_code, 4) BOZO_check_integer(i_frame_rate_code, 4)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_frame_rate_code, 4, (1 << 4) - 1, 1) BOZO_end_integer(i_frame_rate_code, 4)
/* check b_constrained_parameter */ /* check b_constrained_parameter */
BOZO_init_boolean(b_multiple_frame_rate, 0); BOZO_init_boolean(b_multiple_frame_rate, 0);
...@@ -112,11 +112,11 @@ int main_vstream_2() ...@@ -112,11 +112,11 @@ int main_vstream_2()
BOZO_init_integer(i_profile_level_indication, 0); BOZO_init_integer(i_profile_level_indication, 0);
BOZO_init_integer(i_chroma_format, 0); BOZO_init_integer(i_chroma_format, 0);
BOZO_init_boolean(b_frame_rate_extension, 0); BOZO_init_boolean(b_frame_rate_extension, 0);
BOZO_begin_integer(i_frame_rate_code, 4, 0) BOZO_begin_integer(i_frame_rate_code, 4)
BOZO_DOJOB(VStream); BOZO_DOJOB(VStream);
BOZO_check_integer(i_frame_rate_code, 4) BOZO_check_integer(i_frame_rate_code, 4)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_frame_rate_code, 4, (1 << 4) - 1, 1) BOZO_end_integer(i_frame_rate_code, 4)
/* check b_constrained_parameter */ /* check b_constrained_parameter */
BOZO_init_boolean(b_multiple_frame_rate, 0); BOZO_init_boolean(b_multiple_frame_rate, 0);
...@@ -157,11 +157,11 @@ int main_vstream_2() ...@@ -157,11 +157,11 @@ int main_vstream_2()
BOZO_init_integer(i_profile_level_indication, 0); BOZO_init_integer(i_profile_level_indication, 0);
BOZO_init_integer(i_chroma_format, 0); BOZO_init_integer(i_chroma_format, 0);
BOZO_init_boolean(b_frame_rate_extension, 0); BOZO_init_boolean(b_frame_rate_extension, 0);
BOZO_begin_integer(i_profile_level_indication, 8, 0) BOZO_begin_integer(i_profile_level_indication, 8)
BOZO_DOJOB(VStream); BOZO_DOJOB(VStream);
BOZO_check_integer(i_profile_level_indication, 8) BOZO_check_integer(i_profile_level_indication, 8)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_profile_level_indication, 8, 0xff - 1, 1) BOZO_end_integer(i_profile_level_indication, 8)
/* check i_chroma_format */ /* check i_chroma_format */
BOZO_init_boolean(b_multiple_frame_rate, 0); BOZO_init_boolean(b_multiple_frame_rate, 0);
...@@ -172,11 +172,11 @@ int main_vstream_2() ...@@ -172,11 +172,11 @@ int main_vstream_2()
BOZO_init_integer(i_profile_level_indication, 0); BOZO_init_integer(i_profile_level_indication, 0);
BOZO_init_integer(i_chroma_format, 0); BOZO_init_integer(i_chroma_format, 0);
BOZO_init_boolean(b_frame_rate_extension, 0); BOZO_init_boolean(b_frame_rate_extension, 0);
BOZO_begin_integer(i_chroma_format, 2, 0) BOZO_begin_integer(i_chroma_format, 2)
BOZO_DOJOB(VStream); BOZO_DOJOB(VStream);
BOZO_check_integer(i_chroma_format, 2) BOZO_check_integer(i_chroma_format, 2)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_chroma_format, 2, (1 << 2) - 1, 1) BOZO_end_integer(i_chroma_format, 2)
/* check b_frame_rate_extension */ /* check b_frame_rate_extension */
BOZO_init_boolean(b_multiple_frame_rate, 0); BOZO_init_boolean(b_multiple_frame_rate, 0);
...@@ -220,21 +220,21 @@ int main_astream_() ...@@ -220,21 +220,21 @@ int main_astream_()
BOZO_init_boolean(b_free_format, 0); BOZO_init_boolean(b_free_format, 0);
BOZO_init_integer(i_id, 0); BOZO_init_integer(i_id, 0);
BOZO_init_integer(i_layer, 0); BOZO_init_integer(i_layer, 0);
BOZO_begin_integer(i_id, 1, 0) BOZO_begin_integer(i_id, 1)
BOZO_DOJOB(AStream); BOZO_DOJOB(AStream);
BOZO_check_integer(i_id, 1) BOZO_check_integer(i_id, 1)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_id, 1, (1 << 1) - 1, 1) BOZO_end_integer(i_id, 1)
/* check i_layer */ /* check i_layer */
BOZO_init_boolean(b_free_format, 0); BOZO_init_boolean(b_free_format, 0);
BOZO_init_integer(i_id, 0); BOZO_init_integer(i_id, 0);
BOZO_init_integer(i_layer, 0); BOZO_init_integer(i_layer, 0);
BOZO_begin_integer(i_layer, 2, 0) BOZO_begin_integer(i_layer, 2)
BOZO_DOJOB(AStream); BOZO_DOJOB(AStream);
BOZO_check_integer(i_layer, 2) BOZO_check_integer(i_layer, 2)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_layer, 2, (1 << 2) - 1, 1) BOZO_end_integer(i_layer, 2)
BOZO_END(audio stream); BOZO_END(audio stream);
...@@ -254,44 +254,44 @@ int main_hierarchy_() ...@@ -254,44 +254,44 @@ int main_hierarchy_()
BOZO_init_integer(i_h_layer_index, 0); BOZO_init_integer(i_h_layer_index, 0);
BOZO_init_integer(i_h_embedded_layer, 0); BOZO_init_integer(i_h_embedded_layer, 0);
BOZO_init_integer(i_h_priority, 0); BOZO_init_integer(i_h_priority, 0);
BOZO_begin_integer(i_h_type, 4, 0) BOZO_begin_integer(i_h_type, 4)
BOZO_DOJOB(Hierarchy); BOZO_DOJOB(Hierarchy);
BOZO_check_integer(i_h_type, 4) BOZO_check_integer(i_h_type, 4)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_h_type, 4, (1 << 4) - 1, 1) BOZO_end_integer(i_h_type, 4)
/* check i_h_layer_index */ /* check i_h_layer_index */
BOZO_init_integer(i_h_type, 0); BOZO_init_integer(i_h_type, 0);
BOZO_init_integer(i_h_layer_index, 0); BOZO_init_integer(i_h_layer_index, 0);
BOZO_init_integer(i_h_embedded_layer, 0); BOZO_init_integer(i_h_embedded_layer, 0);
BOZO_init_integer(i_h_priority, 0); BOZO_init_integer(i_h_priority, 0);
BOZO_begin_integer(i_h_layer_index, 6, 0) BOZO_begin_integer(i_h_layer_index, 6)
BOZO_DOJOB(Hierarchy); BOZO_DOJOB(Hierarchy);
BOZO_check_integer(i_h_layer_index, 6) BOZO_check_integer(i_h_layer_index, 6)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_h_layer_index, 6, (1 << 6) - 1, 1) BOZO_end_integer(i_h_layer_index, 6)
/* check i_h_embedded_layer */ /* check i_h_embedded_layer */
BOZO_init_integer(i_h_type, 0); BOZO_init_integer(i_h_type, 0);
BOZO_init_integer(i_h_layer_index, 0); BOZO_init_integer(i_h_layer_index, 0);
BOZO_init_integer(i_h_embedded_layer, 0); BOZO_init_integer(i_h_embedded_layer, 0);
BOZO_init_integer(i_h_priority, 0); BOZO_init_integer(i_h_priority, 0);
BOZO_begin_integer(i_h_embedded_layer, 6, 0) BOZO_begin_integer(i_h_embedded_layer, 6)
BOZO_DOJOB(Hierarchy); BOZO_DOJOB(Hierarchy);
BOZO_check_integer(i_h_embedded_layer, 6) BOZO_check_integer(i_h_embedded_layer, 6)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_h_embedded_layer, 6, (1 << 6) - 1, 1) BOZO_end_integer(i_h_embedded_layer, 6)
/* check i_h_priority */ /* check i_h_priority */
BOZO_init_integer(i_h_type, 0); BOZO_init_integer(i_h_type, 0);
BOZO_init_integer(i_h_layer_index, 0); BOZO_init_integer(i_h_layer_index, 0);
BOZO_init_integer(i_h_embedded_layer, 0); BOZO_init_integer(i_h_embedded_layer, 0);
BOZO_init_integer(i_h_priority, 0); BOZO_init_integer(i_h_priority, 0);
BOZO_begin_integer(i_h_priority, 6, 0) BOZO_begin_integer(i_h_priority, 6)
BOZO_DOJOB(Hierarchy); BOZO_DOJOB(Hierarchy);
BOZO_check_integer(i_h_priority, 6) BOZO_check_integer(i_h_priority, 6)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_h_priority, 6, (1 << 6) - 1, 1) BOZO_end_integer(i_h_priority, 6)
BOZO_END(hierarchy); BOZO_END(hierarchy);
...@@ -309,22 +309,11 @@ int main_registration_() ...@@ -309,22 +309,11 @@ int main_registration_()
/* check i_format_identifier */ /* check i_format_identifier */
s_decoded.i_additional_length = 0; s_decoded.i_additional_length = 0;
BOZO_init_integer(i_format_identifier, 0); BOZO_init_integer(i_format_identifier, 0);
BOZO_init_integer(i_format_identifier, 0); BOZO_begin_integer(i_format_identifier, 32)
BOZO_begin_integer(i_format_identifier, 32, 0)
BOZO_DOJOB(Registration); BOZO_DOJOB(Registration);
BOZO_check_integer32(i_format_identifier, 32) BOZO_check_integer(i_format_identifier, 32)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_format_identifier, 32, 0xffff, 1) BOZO_end_integer(i_format_identifier, 32)
/* check i_format_identifier */
s_decoded.i_additional_length = 0;
BOZO_init_integer(i_format_identifier, 0);
BOZO_init_integer(i_format_identifier, 0);
BOZO_begin_integer(i_format_identifier, 32, 0)
BOZO_DOJOB(Registration);
BOZO_check_integer32(i_format_identifier, 32)
BOZO_CLEAN();
BOZO_end_integer(i_format_identifier, 32, 0xffff0000, 0x10000)
BOZO_END(registration); BOZO_END(registration);
...@@ -341,11 +330,11 @@ int main_ds_alignment_() ...@@ -341,11 +330,11 @@ int main_ds_alignment_()
/* check i_alignment_type */ /* check i_alignment_type */
BOZO_init_integer(i_alignment_type, 0); BOZO_init_integer(i_alignment_type, 0);
BOZO_begin_integer(i_alignment_type, 8, 0) BOZO_begin_integer(i_alignment_type, 8)
BOZO_DOJOB(DSAlignment); BOZO_DOJOB(DSAlignment);
BOZO_check_integer(i_alignment_type, 8) BOZO_check_integer(i_alignment_type, 8)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_alignment_type, 8, 0xff - 1, 1) BOZO_end_integer(i_alignment_type, 8)
BOZO_END(data stream alignment); BOZO_END(data stream alignment);
...@@ -364,31 +353,31 @@ int main_target_bg_grid_() ...@@ -364,31 +353,31 @@ int main_target_bg_grid_()
BOZO_init_integer(i_horizontal_size, 0); BOZO_init_integer(i_horizontal_size, 0);
BOZO_init_integer(i_vertical_size, 0); BOZO_init_integer(i_vertical_size, 0);
BOZO_init_integer(i_pel_aspect_ratio, 0); BOZO_init_integer(i_pel_aspect_ratio, 0);
BOZO_begin_integer(i_horizontal_size, 14, 0) BOZO_begin_integer(i_horizontal_size, 14)
BOZO_DOJOB(TargetBgGrid); BOZO_DOJOB(TargetBgGrid);
BOZO_check_integer(i_horizontal_size, 14) BOZO_check_integer(i_horizontal_size, 14)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_horizontal_size, 14, (1 << 14) - 1, 1) BOZO_end_integer(i_horizontal_size, 14)
/* check i_vertical_size */ /* check i_vertical_size */
BOZO_init_integer(i_horizontal_size, 0); BOZO_init_integer(i_horizontal_size, 0);
BOZO_init_integer(i_vertical_size, 0); BOZO_init_integer(i_vertical_size, 0);
BOZO_init_integer(i_pel_aspect_ratio, 0); BOZO_init_integer(i_pel_aspect_ratio, 0);
BOZO_begin_integer(i_vertical_size, 14, 0) BOZO_begin_integer(i_vertical_size, 14)
BOZO_DOJOB(TargetBgGrid); BOZO_DOJOB(TargetBgGrid);
BOZO_check_integer(i_vertical_size, 14) BOZO_check_integer(i_vertical_size, 14)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_vertical_size, 14, (1 << 14) - 1, 1) BOZO_end_integer(i_vertical_size, 14)
/* check i_pel_aspect_ratio */ /* check i_pel_aspect_ratio */
BOZO_init_integer(i_horizontal_size, 0); BOZO_init_integer(i_horizontal_size, 0);
BOZO_init_integer(i_vertical_size, 0); BOZO_init_integer(i_vertical_size, 0);
BOZO_init_integer(i_pel_aspect_ratio, 0); BOZO_init_integer(i_pel_aspect_ratio, 0);
BOZO_begin_integer(i_pel_aspect_ratio, 4, 0) BOZO_begin_integer(i_pel_aspect_ratio, 4)
BOZO_DOJOB(TargetBgGrid); BOZO_DOJOB(TargetBgGrid);
BOZO_check_integer(i_pel_aspect_ratio, 4) BOZO_check_integer(i_pel_aspect_ratio, 4)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_pel_aspect_ratio, 4, (1 << 4) - 1, 1) BOZO_end_integer(i_pel_aspect_ratio, 4)
BOZO_END(target background grid); BOZO_END(target background grid);
...@@ -407,31 +396,31 @@ int main_vwindow_() ...@@ -407,31 +396,31 @@ int main_vwindow_()
BOZO_init_integer(i_horizontal_offset, 0); BOZO_init_integer(i_horizontal_offset, 0);
BOZO_init_integer(i_vertical_offset, 0); BOZO_init_integer(i_vertical_offset, 0);
BOZO_init_integer(i_window_priority, 0); BOZO_init_integer(i_window_priority, 0);
BOZO_begin_integer(i_horizontal_offset, 14, 0) BOZO_begin_integer(i_horizontal_offset, 14)
BOZO_DOJOB(VWindow); BOZO_DOJOB(VWindow);
BOZO_check_integer(i_horizontal_offset, 14) BOZO_check_integer(i_horizontal_offset, 14)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_horizontal_offset, 14, (1 << 14) - 1, 1) BOZO_end_integer(i_horizontal_offset, 14)
/* check i_vertical_offset */ /* check i_vertical_offset */
BOZO_init_integer(i_horizontal_offset, 0); BOZO_init_integer(i_horizontal_offset, 0);
BOZO_init_integer(i_vertical_offset, 0); BOZO_init_integer(i_vertical_offset, 0);
BOZO_init_integer(i_window_priority, 0); BOZO_init_integer(i_window_priority, 0);
BOZO_begin_integer(i_vertical_offset, 14, 0) BOZO_begin_integer(i_vertical_offset, 14)
BOZO_DOJOB(VWindow); BOZO_DOJOB(VWindow);
BOZO_check_integer(i_vertical_offset, 14) BOZO_check_integer(i_vertical_offset, 14)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_vertical_offset, 14, (1 << 14) - 1, 1) BOZO_end_integer(i_vertical_offset, 14)
/* check i_window_priority */ /* check i_window_priority */
BOZO_init_integer(i_horizontal_offset, 0); BOZO_init_integer(i_horizontal_offset, 0);
BOZO_init_integer(i_vertical_offset, 0); BOZO_init_integer(i_vertical_offset, 0);
BOZO_init_integer(i_window_priority, 0); BOZO_init_integer(i_window_priority, 0);
BOZO_begin_integer(i_window_priority, 4, 0) BOZO_begin_integer(i_window_priority, 4)
BOZO_DOJOB(VWindow); BOZO_DOJOB(VWindow);
BOZO_check_integer(i_window_priority, 4) BOZO_check_integer(i_window_priority, 4)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_window_priority, 4, (1 << 4) - 1, 1) BOZO_end_integer(i_window_priority, 4)
BOZO_END(video window); BOZO_END(video window);
...@@ -450,21 +439,21 @@ int main_ca_() ...@@ -450,21 +439,21 @@ int main_ca_()
s_decoded.i_private_length = 0; s_decoded.i_private_length = 0;
BOZO_init_integer(i_ca_system_id, 0); BOZO_init_integer(i_ca_system_id, 0);
BOZO_init_integer(i_ca_pid, 0); BOZO_init_integer(i_ca_pid, 0);
BOZO_begin_integer(i_ca_system_id, 16, 0) BOZO_begin_integer(i_ca_system_id, 16)
BOZO_DOJOB(CA); BOZO_DOJOB(CA);
BOZO_check_integer(i_ca_system_id, 16) BOZO_check_integer(i_ca_system_id, 16)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_ca_system_id, 16, 0xffff - 1, 1) BOZO_end_integer(i_ca_system_id, 16)
/* check i_ca_pid */ /* check i_ca_pid */
s_decoded.i_private_length = 0; s_decoded.i_private_length = 0;
BOZO_init_integer(i_ca_system_id, 0); BOZO_init_integer(i_ca_system_id, 0);
BOZO_init_integer(i_ca_pid, 0); BOZO_init_integer(i_ca_pid, 0);
BOZO_begin_integer(i_ca_pid, 13, 0) BOZO_begin_integer(i_ca_pid, 13)
BOZO_DOJOB(CA); BOZO_DOJOB(CA);
BOZO_check_integer(i_ca_pid, 13) BOZO_check_integer(i_ca_pid, 13)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_ca_pid, 13, (1 << 13) - 1, 1) BOZO_end_integer(i_ca_pid, 13)
BOZO_END(conditional access); BOZO_END(conditional access);
...@@ -482,11 +471,11 @@ int main_iso639_() ...@@ -482,11 +471,11 @@ int main_iso639_()
/* check i_audio_type */ /* check i_audio_type */
s_decoded.i_code_count = 0; s_decoded.i_code_count = 0;
BOZO_init_integer(i_audio_type, 0); BOZO_init_integer(i_audio_type, 0);
BOZO_begin_integer(i_audio_type, 8, 0) BOZO_begin_integer(i_audio_type, 8)
BOZO_DOJOB(ISO639); BOZO_DOJOB(ISO639);
BOZO_check_integer(i_audio_type, 8) BOZO_check_integer(i_audio_type, 8)
BOZO_CLEAN(); BOZO_CLEAN();
BOZO_end_integer(i_audio_type, 8, 0xff - 1, 1) BOZO_end_integer(i_audio_type, 8)
BOZO_END(ISO 639 language); BOZO_END(ISO 639 language);
...@@ -511,6 +500,11 @@ int main() ...@@ -511,6 +500,11 @@ int main()
i_err |= main_ca_(); i_err |= main_ca_();
i_err |= main_iso639_(); i_err |= main_iso639_();
if(i_err)
fprintf(stderr, "At least one test has FAILED !!!\n");
else
fprintf(stdout, "All tests succeeded.\n");
return i_err; return i_err;
} }
/***************************************************************************** /*****************************************************************************
* test_dr.h * test_dr.h
* (c)2001-2002 VideoLAN * (c)2001-2002 VideoLAN
* $Id: test_dr.h,v 1.2 2002/05/09 19:59:20 bozo Exp $ * $Id: test_dr.h,v 1.3 2002/05/09 20:39:02 bozo Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -52,20 +52,21 @@ ...@@ -52,20 +52,21 @@
#define BOZO_init_integer(name, default) \ #define BOZO_init_integer(name, default) \
s_decoded.name = default; s_decoded.name = default;
#define BOZO_begin_integer(name, bitcount, min) \ #define BOZO_begin_integer(name, bitcount) \
if(!i_err) \ if(!i_err) \
{ \ { \
unsigned int i = 0; \
fprintf(stdout, " \"%s\" %u bit(s) integer check\n", \ fprintf(stdout, " \"%s\" %u bit(s) integer check\n", \
#name, bitcount); \ #name, bitcount); \
i_loop_count = 0; \ i_loop_count = 0; \
s_decoded.name = min; \ s_decoded.name = 1; \
do \ do \
{ {
#define BOZO_end_integer(name, bitcount, max, step) \ #define BOZO_end_integer(name, bitcount) \
s_decoded.name += step; \ s_decoded.name <<= 1; \
} while(!i_err \ } while(!i_err \
&& (s_decoded.name != max + step)); \ && (++i < bitcount)); \
fprintf(stdout, "\r iteration count: %22llu", i_loop_count); \ fprintf(stdout, "\r iteration count: %22llu", i_loop_count); \
if(i_err) \ if(i_err) \
fprintf(stdout, " FAILED !!!\n"); \ fprintf(stdout, " FAILED !!!\n"); \
...@@ -79,43 +80,6 @@ ...@@ -79,43 +80,6 @@
fprintf(stderr, "\nError: integer %s %llu -> %llu\n", #name, \ fprintf(stderr, "\nError: integer %s %llu -> %llu\n", #name, \
(uint64_t)s_decoded.name, (uint64_t)p_new_decoded->name); \ (uint64_t)s_decoded.name, (uint64_t)p_new_decoded->name); \
i_err = 1; \ i_err = 1; \
} \
if(!i_err && (p_new_decoded->name & ~(((uint64_t)1 << bitcount) - 1))) \
{ \
fprintf(stderr, \
"\nError: integer %s has more than %d bits (%llx)\n", \
#name, bitcount, (uint64_t)p_new_decoded->name); \
i_err = 1; \
}
#define BOZO_check_integer32(name, bitcount) \
if(!i_err && (s_decoded.name != p_new_decoded->name)) \
{ \
fprintf(stderr, "\nError: integer %s %llu -> %llu\n", #name, \
(uint64_t)s_decoded.name, (uint64_t)p_new_decoded->name); \
i_err = 1; \
} \
if(!i_err && (p_new_decoded->name & ~0xffffffff)) \
{ \
fprintf(stderr, \
"\nError: integer %s has more than %d bits (%llx)\n", \
#name, bitcount, (uint64_t)p_new_decoded->name); \
i_err = 1; \
}
#define BOZO_check_integer64(name, bitcount) \
if(!i_err && (s_decoded.name != p_new_decoded->name)) \
{ \
fprintf(stderr, "\nError: integer %s %llu -> %llu\n", #name, \
(uint64_t)s_decoded.name, (uint64_t)p_new_decoded->name); \
i_err = 1; \
} \
if(!i_err && (p_new_decoded->name & ~0xffffffffffffffff)) \
{ \
fprintf(stderr, \
"\nError: integer %s has more than %d bits (%llx)\n", \
#name, bitcount, (uint64_t)p_new_decoded->name); \
i_err = 1; \
} }
......
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