From 4456645b451300aff4a763e966746e247ec5ae39 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 14 Feb 2009 11:12:22 +0000 Subject: Allow TESTTYPE=release to be specified to build the tests with the release CFLAGS. Add TARGET to the build paths. You should 'make distclean' before updating to this. Add BUILD_SHARED=yes support to the *nix build svn path=/trunk/hubbub/; revision=6478 --- test/parser.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'test/parser.c') diff --git a/test/parser.c b/test/parser.c index 5531af1..7847a68 100644 --- a/test/parser.c +++ b/test/parser.c @@ -50,25 +50,19 @@ static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE) origlen = len = ftell(fp); fseek(fp, 0, SEEK_SET); - while (len >= CHUNK_SIZE) { - fread(buf, 1, CHUNK_SIZE, fp); - + while (len > 0) { + ssize_t bytes_read = fread(buf, 1, CHUNK_SIZE, fp); + + if (bytes_read < 1) + break; + assert(hubbub_parser_parse_chunk(parser, - buf, CHUNK_SIZE) == HUBBUB_OK); - - len -= CHUNK_SIZE; - } - - if (len > 0) { - fread(buf, 1, len, fp); - - assert(hubbub_parser_parse_chunk(parser, - buf, len) == HUBBUB_OK); - - len = 0; + buf, bytes_read) == HUBBUB_OK); - assert(hubbub_parser_completed(parser) == HUBBUB_OK); + len -= bytes_read; } + + assert(len == 0); fclose(fp); -- cgit v1.2.3