summaryrefslogtreecommitdiff
path: root/test/tree.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2009-02-14 11:12:22 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2009-02-14 11:12:22 +0000
commit4456645b451300aff4a763e966746e247ec5ae39 (patch)
tree0e2d93b749e073e79336601a0aee6c3306456960 /test/tree.c
parent472d9ed91f2e43642edd7ae92269b76a293e004e (diff)
downloadlibhubbub-4456645b451300aff4a763e966746e247ec5ae39.tar.gz
libhubbub-4456645b451300aff4a763e966746e247ec5ae39.tar.bz2
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
Diffstat (limited to 'test/tree.c')
-rw-r--r--test/tree.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/test/tree.c b/test/tree.c
index 9a5bf8c..8a5a5b1 100644
--- a/test/tree.c
+++ b/test/tree.c
@@ -117,26 +117,20 @@ 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);
-
- assert(hubbub_parser_parse_chunk(parser,
- buf, CHUNK_SIZE) == HUBBUB_OK);
-
- len -= CHUNK_SIZE;
- }
-
- if (len > 0) {
- fread(buf, 1, len, 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, len) == HUBBUB_OK);
+ buf, bytes_read) == HUBBUB_OK);
- len = 0;
-
- assert(hubbub_parser_completed(parser) == HUBBUB_OK);
+ len -= bytes_read;
}
-
+
+ assert(len == 0);
+
fclose(fp);
charset = hubbub_parser_read_charset(parser, &cssource);