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

  * misc/dr.dtd, misc/dr.xml, misc/dr.xsl, misc/test_dr.h, misc/test_dr.c: modified the way tests are performed (avoid stupid iterations).
parent d5412905
...@@ -12,13 +12,17 @@ ...@@ -12,13 +12,17 @@
<!ELEMENT check (#PCDATA)> <!ELEMENT check (#PCDATA)>
<!ELEMENT end (#PCDATA)>
<!ATTLIST descriptor name CDATA #IMPLIED> <!ATTLIST descriptor name CDATA #IMPLIED>
<!ATTLIST descriptor sname CDATA #IMPLIED> <!ATTLIST descriptor sname CDATA #IMPLIED>
<!ATTLIST descriptor fname CDATA #IMPLIED> <!ATTLIST descriptor fname CDATA #IMPLIED>
<!ATTLIST descriptor msuffix CDATA #IMPLIED>
<!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 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>
...@@ -2,37 +2,42 @@ ...@@ -2,37 +2,42 @@
<!DOCTYPE dr SYSTEM "dr.dtd"> <!DOCTYPE dr SYSTEM "dr.dtd">
<dr> <dr>
<descriptor name="video stream" sname="vstream" fname="VStream"> <descriptor name="video stream (b_mpeg2 = false)" sname="vstream" fname="VStream" msuffix="1" >
<boolean name="b_multiple_frame_rate" /> <boolean name="b_multiple_frame_rate" default="0" />
<integer name="i_frame_rate_code" bitcount="4" /> <integer name="i_frame_rate_code" bitcount="4" default="0" />
<boolean name="b_mpeg2" />
<boolean name="b_constrained_parameter" />
<boolean name="b_still_picture" />
<insert> <insert>
<check> <begin>
if(s_decoded.b_mpeg2) s_decoded.b_mpeg2 = 0;</begin>
{</check>
</insert> </insert>
<integer name="i_profile_level_indication" bitcount="8" /> <boolean name="b_constrained_parameter" default="0" />
<integer name="i_chroma_format" bitcount="2" /> <boolean name="b_still_picture" default="0" />
<boolean name="b_frame_rate_extension" /> </descriptor>
<descriptor name="video stream (b_mpeg2 = true)" sname="vstream" fname="VStream" msuffix="2" >
<boolean name="b_multiple_frame_rate" default="0" />
<integer name="i_frame_rate_code" bitcount="4" default="0" />
<insert> <insert>
<check> <begin>
}</check> s_decoded.b_mpeg2 = 12;</begin>
</insert> </insert>
<boolean name="b_constrained_parameter" 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_chroma_format" bitcount="2" default="0" />
<boolean name="b_frame_rate_extension" default="0" />
</descriptor> </descriptor>
<descriptor name="audio stream" sname="astream" fname="AStream"> <descriptor name="audio stream" sname="astream" fname="AStream">
<boolean name="b_free_format" /> <boolean name="b_free_format" default="0" />
<integer name="i_id" bitcount="1" /> <integer name="i_id" bitcount="1" default="0" />
<integer name="i_layer" bitcount="2" /> <integer name="i_layer" bitcount="2" default="0" />
</descriptor> </descriptor>
<descriptor name="hierarchy" sname="hierarchy" fname="Hierarchy"> <descriptor name="hierarchy" sname="hierarchy" fname="Hierarchy">
<integer name="i_h_type" bitcount="4" /> <integer name="i_h_type" bitcount="4" default="0" />
<integer name="i_h_layer_index" bitcount="6" /> <integer name="i_h_layer_index" bitcount="6" default="0" />
<integer name="i_h_embedded_layer" bitcount="6" /> <integer name="i_h_embedded_layer" bitcount="6" default="0" />
<integer name="i_h_priority" bitcount="6" /> <integer name="i_h_priority" bitcount="6" default="0" />
</descriptor> </descriptor>
<descriptor name="registration" sname="registration" fname="Registration"> <descriptor name="registration" sname="registration" fname="Registration">
...@@ -40,23 +45,24 @@ ...@@ -40,23 +45,24 @@
<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" /> <integer name="i_format_identifier" bitcount="32" default="0" max="0xffff" />
<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" /> <integer name="i_alignment_type" bitcount="8" default="0" max="0xff - 1" />
</descriptor> </descriptor>
<descriptor name="target background grid" sname="target_bg_grid" fname="TargetBgGrid"> <descriptor name="target background grid" sname="target_bg_grid" fname="TargetBgGrid">
<integer name="i_horizontal_size" bitcount="14" /> <integer name="i_horizontal_size" bitcount="14" default="0" />
<integer name="i_vertical_size" bitcount="14" /> <integer name="i_vertical_size" bitcount="14" default="0" />
<integer name="i_pel_aspect_ratio" bitcount="4" /> <integer name="i_pel_aspect_ratio" bitcount="4" default="0" />
</descriptor> </descriptor>
<descriptor name="video window" sname="vwindow" fname="VWindow"> <descriptor name="video window" sname="vwindow" fname="VWindow">
<integer name="i_horizontal_offset" bitcount="14" /> <integer name="i_horizontal_offset" bitcount="14" default="0" />
<integer name="i_vertical_offset" bitcount="14" /> <integer name="i_vertical_offset" bitcount="14" default="0" />
<integer name="i_window_priority" bitcount="4" /> <integer name="i_window_priority" bitcount="4" default="0" />
</descriptor> </descriptor>
<descriptor name="conditional access" sname="ca" fname="CA"> <descriptor name="conditional access" sname="ca" fname="CA">
...@@ -64,8 +70,8 @@ ...@@ -64,8 +70,8 @@
<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" /> <integer name="i_ca_system_id" bitcount="16" default="0" max="0xffff - 1" />
<integer name="i_ca_pid" bitcount="13" /> <integer name="i_ca_pid" bitcount="13" default="0" />
</descriptor> </descriptor>
<descriptor name="ISO 639 language" sname="iso639" fname="ISO639"> <descriptor name="ISO 639 language" sname="iso639" fname="ISO639">
...@@ -73,6 +79,7 @@ ...@@ -73,6 +79,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" /> <integer name="i_audio_type" bitcount="8" default="0" max="0xff - 1" />
</descriptor> </descriptor>
</dr> </dr>
...@@ -49,25 +49,12 @@ int main() ...@@ -49,25 +49,12 @@ int main()
<xsl:template match="descriptor" mode="code"> <xsl:template match="descriptor" mode="code">
/* <xsl:value-of select="@name" /> */ /* <xsl:value-of select="@name" /> */
int main_<xsl:value-of select="@sname" />() int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix" />()
{ {
BOZO_VARS(<xsl:value-of select="@sname" />); BOZO_VARS(<xsl:value-of select="@sname" />);
BOZO_START(<xsl:value-of select="@name" />); BOZO_START(<xsl:value-of select="@name" />);
/* BEGIN start */<xsl:apply-templates mode="begin" /> <xsl:apply-templates mode="check" />
/* BEGIN end */
BOZO_DOJOB(<xsl:value-of select="@fname" />);
/* CHECK start */<xsl:apply-templates mode="check" />
/* CHECK end */
BOZO_CLEAN();
/* END start */<xsl:apply-templates mode="end" >
<xsl:sort select="position()" data-type="number" order="descending" />
</xsl:apply-templates>
/* END end */
BOZO_END(<xsl:value-of select="@name" />); BOZO_END(<xsl:value-of select="@name" />);
...@@ -78,30 +65,42 @@ int main_<xsl:value-of select="@sname" />() ...@@ -78,30 +65,42 @@ int main_<xsl:value-of select="@sname" />()
<xsl:template match="text()" mode="code" priority="-1"/> <xsl:template match="text()" mode="code" priority="-1"/>
<!-- --> <!-- -->
<!-- begin templates --> <!-- init templates -->
<!-- --> <!-- -->
<xsl:template match="integer" mode="begin"> <xsl:template match="integer" mode="init">
BOZO_begin_integer(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />)</xsl:template> BOZO_init_integer(<xsl:value-of select="@name" />, <xsl:value-of select="@default" />);</xsl:template>
<xsl:template match="boolean" mode="begin"> <xsl:template match="boolean" mode="init">
BOZO_begin_boolean(<xsl:value-of select="@name" />)</xsl:template> BOZO_init_boolean(<xsl:value-of select="@name" />, <xsl:value-of select="@default" />);</xsl:template>
<xsl:template match="insert" mode="begin"> <xsl:template match="insert" mode="init">
<xsl:value-of select="begin" /> <xsl:value-of select="begin" />
</xsl:template> </xsl:template>
<xsl:template match="text()" mode="begin" priority="-1"/> <xsl:template match="text()" mode="init" priority="-1"/>
<!-- --> <!-- -->
<!-- check templates --> <!-- check templates -->
<!-- --> <!-- -->
<xsl:template match="integer" mode="check"> <xsl:template match="integer" mode="check">
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" />)</xsl:template> /* 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_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_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>)
</xsl:template>
<xsl:template match="boolean" mode="check"> <xsl:template match="boolean" mode="check">
BOZO_check_boolean(<xsl:value-of select="@name" />)</xsl:template> /* check <xsl:value-of select="@name" /> */<xsl:apply-templates select=".." mode="init" />
BOZO_begin_boolean(<xsl:value-of select="@name" />)
BOZO_DOJOB(<xsl:value-of select="../@fname" />);
BOZO_check_boolean(<xsl:value-of select="@name" />)
BOZO_CLEAN();
BOZO_end_boolean(<xsl:value-of select="@name" />)
</xsl:template>
<xsl:template match="insert" mode="check"> <xsl:template match="insert" mode="check">
<xsl:value-of select="check" /> <xsl:value-of select="check" />
...@@ -109,28 +108,12 @@ int main_<xsl:value-of select="@sname" />() ...@@ -109,28 +108,12 @@ int main_<xsl:value-of select="@sname" />()
<xsl:template match="text()" mode="check" priority="-1"/> <xsl:template match="text()" mode="check" priority="-1"/>
<!-- -->
<!-- end templates -->
<!-- -->
<xsl:template match="integer" mode="end">
BOZO_end_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" />)</xsl:template>
<xsl:template match="boolean" mode="end">
BOZO_end_boolean(<xsl:value-of select="@name" />)</xsl:template>
<xsl:template match="insert" mode="end">
<xsl:value-of select="end" />
</xsl:template>
<xsl:template match="text()" mode="end" priority="-1"/>
<!-- --> <!-- -->
<!-- main templates --> <!-- main templates -->
<!-- --> <!-- -->
<xsl:template match="descriptor" mode="main"> <xsl:template match="descriptor" mode="main">
i_err |= main_<xsl:value-of select="@sname" />();</xsl:template> i_err |= main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix" />();</xsl:template>
<xsl:template match="text()" mode="main" priority="-1"/> <xsl:template match="text()" mode="main" priority="-1"/>
......
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
* test_dr.h * test_dr.h
* (c)2001-2002 VideoLAN * (c)2001-2002 VideoLAN
* $Id: test_dr.h,v 1.1 2002/05/09 17:00:03 bozo Exp $ * $Id: test_dr.h,v 1.2 2002/05/09 19:59:20 bozo Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define BOZO_VARS(sname) \ #define BOZO_VARS(sname) \
int i_err = 0; \ int i_err = 0; \
long long unsigned int i_loop_count = 0; \ long long unsigned int i_loop_count; \
dvbpsi_##sname##_dr_t s_decoded, *p_new_decoded; \ dvbpsi_##sname##_dr_t s_decoded, *p_new_decoded; \
dvbpsi_descriptor_t * p_descriptor; dvbpsi_descriptor_t * p_descriptor;
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
#define BOZO_DOJOB(fname) \ #define BOZO_DOJOB(fname) \
if(!(i_loop_count & 0xffff)) \ if(!(i_loop_count & 0xffff)) \
fprintf(stdout, "\r iteration count: %22llu [%llu]", \ fprintf(stdout, "\r iteration count: %22llu", i_loop_count); \
i_loop_count, (uint64_t)(-1)); \
i_loop_count++; \ i_loop_count++; \
p_descriptor = dvbpsi_Gen##fname##Dr(&s_decoded, 0); \ p_descriptor = dvbpsi_Gen##fname##Dr(&s_decoded, 0); \
p_new_decoded = dvbpsi_Decode##fname##Dr(p_descriptor); p_new_decoded = dvbpsi_Decode##fname##Dr(p_descriptor);
...@@ -43,34 +42,36 @@ ...@@ -43,34 +42,36 @@
fprintf(stdout, "\"%s\" descriptor check:\n", #name); fprintf(stdout, "\"%s\" descriptor check:\n", #name);
#define BOZO_END(name) \ #define BOZO_END(name) \
fprintf(stdout, "\r iteration count: %22llu [%llu]\n", \
i_loop_count, (uint64_t)(-1)); \
if(i_err) \ if(i_err) \
fprintf(stderr, "\"%s\" descriptor check FAILED\n\n", #name); \ fprintf(stderr, "\"%s\" descriptor check FAILED !!!\n\n", #name); \
else \ else \
fprintf(stdout, "\"%s\" descriptor check succeeded\n\n", #name); fprintf(stdout, "\"%s\" descriptor check succeeded\n\n", #name);
/* integer */ /* integer */
#define BOZO_begin_integer(name, bitcount) \ #define BOZO_init_integer(name, default) \
s_decoded.name = 0; \ s_decoded.name = default;
#define BOZO_begin_integer(name, bitcount, min) \
if(!i_err) \
{ \
fprintf(stdout, " \"%s\" %u bit(s) integer check\n", \
#name, bitcount); \
i_loop_count = 0; \
s_decoded.name = min; \
do \ do \
{ {
#define BOZO_end_integer(name, bitcount) \ #define BOZO_end_integer(name, bitcount, max, step) \
s_decoded.name++; \ s_decoded.name += step; \
} while(!i_err \
&& ((s_decoded.name & ((1 << bitcount) - 1)) != 0));
#define BOZO_end_integer32(name, bitcount) \
s_decoded.name++; \
} while(!i_err \
&& ((s_decoded.name & 0xffffffff) != 0));
#define BOZO_end_integer64(name, bitcount) \
s_decoded.name++; \
} while(!i_err \ } while(!i_err \
&& ((s_decoded.name & 0xffffffffffffffff) != 0)); && (s_decoded.name != max + step)); \
fprintf(stdout, "\r iteration count: %22llu", i_loop_count); \
if(i_err) \
fprintf(stdout, " FAILED !!!\n"); \
else \
fprintf(stdout, " Ok.\n"); \
}
#define BOZO_check_integer(name, bitcount) \ #define BOZO_check_integer(name, bitcount) \
if(!i_err && (s_decoded.name != p_new_decoded->name)) \ if(!i_err && (s_decoded.name != p_new_decoded->name)) \
...@@ -119,14 +120,27 @@ ...@@ -119,14 +120,27 @@
/* boolean */ /* boolean */
#define BOZO_init_boolean(name, default) \
s_decoded.name = default;
#define BOZO_begin_boolean(name) \ #define BOZO_begin_boolean(name) \
if(!i_err) \
{ \
fprintf(stdout, " \"%s\" boolean check\n", #name); \
i_loop_count = 0; \
s_decoded.name = 0; \ s_decoded.name = 0; \
do \ do \
{ {
#define BOZO_end_boolean(name) \ #define BOZO_end_boolean(name) \
s_decoded.name += 12; \ s_decoded.name += 12; \
} while(!i_err && (s_decoded.name <= 12)); } while(!i_err && (s_decoded.name <= 12)); \
fprintf(stdout, "\r iteration count: %22llu", i_loop_count); \
if(i_err) \
fprintf(stdout, " FAILED !!!\n"); \
else \
fprintf(stdout, " Ok.\n"); \
}
#define BOZO_check_boolean(name) \ #define BOZO_check_boolean(name) \
if( !i_err \ if( !i_err \
......
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