diff options
Diffstat (limited to 'libsframe/testsuite/libsframe.decode')
-rw-r--r-- | libsframe/testsuite/libsframe.decode/DATA2 | bin | 98 -> 98 bytes | |||
-rw-r--r-- | libsframe/testsuite/libsframe.decode/be-flipping.c | 36 | ||||
-rw-r--r-- | libsframe/testsuite/libsframe.decode/frecnt-1.c | 36 | ||||
-rw-r--r-- | libsframe/testsuite/libsframe.decode/frecnt-2.c | 37 | ||||
-rw-r--r-- | libsframe/testsuite/libsframe.decode/local.mk | 12 |
5 files changed, 33 insertions, 88 deletions
diff --git a/libsframe/testsuite/libsframe.decode/DATA2 b/libsframe/testsuite/libsframe.decode/DATA2 Binary files differindex 472f736..90649e2 100644 --- a/libsframe/testsuite/libsframe.decode/DATA2 +++ b/libsframe/testsuite/libsframe.decode/DATA2 diff --git a/libsframe/testsuite/libsframe.decode/be-flipping.c b/libsframe/testsuite/libsframe.decode/be-flipping.c index 5002524..5f97594 100644 --- a/libsframe/testsuite/libsframe.decode/be-flipping.c +++ b/libsframe/testsuite/libsframe.decode/be-flipping.c @@ -15,17 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> - -#include "sframe-api.h" - -/* DejaGnu should not use gnulib's vsnprintf replacement here. */ -#undef vsnprintf -#include <dejagnu.h> +#include "sframe-test.h" /* SFrame info from the following source (1 fde 5 fres): static int cnt; @@ -55,16 +45,7 @@ main (void) struct stat st; char *sf_buf; size_t sf_size; - -#define TEST(name, cond) \ - do \ - { \ - if (cond) \ - pass (name); \ - else \ - fail (name); \ - } \ - while (0) + uint8_t rep_block_size; /* Test setup. */ fp = fopen (DATA, "r"); @@ -96,14 +77,15 @@ main (void) the host running the test is a little-endian system. This endian-flipped copy of the buffer is kept internally in dctx. */ dctx = sframe_decode (sf_buf, sf_size, &err); - TEST ("be-flipping: Decoder setup", dctx != NULL); + TEST (dctx != NULL, "be-flipping-1: Decoder setup"); unsigned int fde_cnt = sframe_decoder_get_num_fidx (dctx); - TEST ("be-flipping: Decoder FDE count", fde_cnt == 1); + TEST (fde_cnt == 1, "be-flipping-1: Decoder FDE count"); - err = sframe_decoder_get_funcdesc (dctx, 0, &nfres, &fsize, &fstart, &finfo); - TEST ("be-flipping: Decoder get FDE", err == 0); - TEST ("be-flipping: Decoder FRE count", nfres == 5); + err = sframe_decoder_get_funcdesc_v2 (dctx, 0, &nfres, &fsize, &fstart, + &finfo, &rep_block_size); + TEST (err == 0, "be-flipping-1: Decoder get FDE"); + TEST (nfres == 5, "be-flipping-1: Decoder FRE count"); free (sf_buf); sf_buf = NULL; @@ -113,6 +95,6 @@ main (void) setup_fail: sframe_decoder_free (&dctx); - fail ("be-flipping: Test setup"); + fail ("be-flipping-1: Test setup"); return 1; } diff --git a/libsframe/testsuite/libsframe.decode/frecnt-1.c b/libsframe/testsuite/libsframe.decode/frecnt-1.c index 77b0440..53d70a0 100644 --- a/libsframe/testsuite/libsframe.decode/frecnt-1.c +++ b/libsframe/testsuite/libsframe.decode/frecnt-1.c @@ -15,17 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> - -#include "sframe-api.h" - -/* DejaGnu should not use gnulib's vsnprintf replacement here. */ -#undef vsnprintf -#include <dejagnu.h> +#include "sframe-test.h" /* * SFrame info from the following source (1 fde 4 fres): @@ -46,16 +36,7 @@ main (void) struct stat st; char *sf_buf; size_t sf_size; - -#define TEST(name, cond) \ - do \ - { \ - if (cond) \ - pass (name); \ - else \ - fail (name); \ - } \ - while (0) + uint8_t rep_block_size; /* Test Setup. */ fp = fopen (DATA, "r"); @@ -77,17 +58,18 @@ main (void) /* Execute tests. */ sf_size = fread (sf_buf, 1, st.st_size, fp); fclose (fp); - TEST ("frecnt-1: Read data", sf_size != 0); + TEST (sf_size != 0, "frecnt-1: Read data"); dctx = sframe_decode (sf_buf, sf_size, &err); - TEST ("frecnt-1: Decoder setup", dctx != NULL); + TEST (dctx != NULL, "frecnt-1: Decoder setup"); unsigned int fde_cnt = sframe_decoder_get_num_fidx (dctx); - TEST ("frecnt-1: Decoder FDE count", fde_cnt == 1); + TEST (fde_cnt == 1, "frecnt-1: Decoder FDE count"); - err = sframe_decoder_get_funcdesc (dctx, 0, &nfres, &fsize, &fstart, &finfo); - TEST ("frecnt-1: Decoder get FDE", err == 0); - TEST ("frecnt-1: Decoder FRE count", nfres == 4); + err = sframe_decoder_get_funcdesc_v2 (dctx, 0, &nfres, &fsize, &fstart, + &finfo, &rep_block_size); + TEST (err == 0, "frecnt-1: Decoder get FDE"); + TEST (nfres == 4, "frecnt-1: Decoder FRE count"); free (sf_buf); sf_buf = NULL; diff --git a/libsframe/testsuite/libsframe.decode/frecnt-2.c b/libsframe/testsuite/libsframe.decode/frecnt-2.c index 912fdbd..a8ca69f 100644 --- a/libsframe/testsuite/libsframe.decode/frecnt-2.c +++ b/libsframe/testsuite/libsframe.decode/frecnt-2.c @@ -15,17 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> - -#include "sframe-api.h" - -/* DejaGnu should not use gnulib's vsnprintf replacement here. */ -#undef vsnprintf -#include <dejagnu.h> +#include "sframe-test.h" /* * SFrame info from the following source (2 fde 8 fres): @@ -48,16 +38,7 @@ main (void) struct stat st; char *sf_buf; size_t sf_size; - -#define TEST(name, cond) \ - do \ - { \ - if (cond) \ - pass (name); \ - else \ - fail (name); \ - } \ - while (0) + uint8_t rep_block_size; fp = fopen (DATA, "r"); if (fp == NULL) @@ -78,20 +59,20 @@ main (void) /* Execute tests. */ sf_size = fread (sf_buf, 1, st.st_size, fp); fclose (fp); - TEST ("frecnt-2: Read data", sf_size != 0); + TEST (sf_size != 0, "frecnt-2: Read data"); dctx = sframe_decode (sf_buf, sf_size, &err); - TEST ("frecnt-2: Decode setup", dctx != NULL); + TEST (dctx != NULL, "frecnt-2: Decode setup"); unsigned int fde_cnt = sframe_decoder_get_num_fidx (dctx); - TEST ("frecnt-2: Decode FDE count", fde_cnt == 2); + TEST (fde_cnt == 2, "frecnt-2: Decode FDE count"); for (i = 0; i < fde_cnt; ++i) { - err = sframe_decoder_get_funcdesc (dctx, i, &nfres, &fsize, &fstart, - &finfo); - TEST ("frecnt-2: Decode get FDE", err == 0); - TEST ("frecnt-2: Decode get FRE", nfres == 4); + err = sframe_decoder_get_funcdesc_v2 (dctx, i, &nfres, &fsize, &fstart, + &finfo, &rep_block_size); + TEST (err == 0, "frecnt-2: Decode get FDE%d", i); + TEST (nfres == 4, "frecnt-2: Decode num FREs for FDE%d", i); } free (sf_buf); diff --git a/libsframe/testsuite/libsframe.decode/local.mk b/libsframe/testsuite/libsframe.decode/local.mk index 0e4279b..de34bbc 100644 --- a/libsframe/testsuite/libsframe.decode/local.mk +++ b/libsframe/testsuite/libsframe.decode/local.mk @@ -4,13 +4,13 @@ if HAVE_COMPAT_DEJAGNU endif %C%_be_flipping_SOURCES = %D%/be-flipping.c -%C%_be_flipping_LDADD = ${top_builddir}/libsframe.la -%C%_be_flipping_CPPFLAGS = -I${top_srcdir}/../include -Wall +%C%_be_flipping_LDADD = $(testsuite_LDADD) +%C%_be_flipping_CPPFLAGS = $(testsuite_CPPFLAGS) %C%_frecnt_1_SOURCES = %D%/frecnt-1.c -%C%_frecnt_1_LDADD = ${top_builddir}/libsframe.la -%C%_frecnt_1_CPPFLAGS = -I${top_srcdir}/../include -Wall +%C%_frecnt_1_LDADD = $(testsuite_LDADD) +%C%_frecnt_1_CPPFLAGS = $(testsuite_CPPFLAGS) %C%_frecnt_2_SOURCES = %D%/frecnt-2.c -%C%_frecnt_2_LDADD = ${top_builddir}/libsframe.la -%C%_frecnt_2_CPPFLAGS = -I${top_srcdir}/../include -Wall +%C%_frecnt_2_LDADD = $(testsuite_LDADD) +%C%_frecnt_2_CPPFLAGS = $(testsuite_CPPFLAGS) |