diff options
author | Daniel Silverstone <dsilvers@netsurf-browser.org> | 2011-01-20 11:59:46 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@netsurf-browser.org> | 2011-01-20 11:59:46 +0000 |
commit | 33b37afeab6180e4fdc3c97f7f6cc713686ac6a9 (patch) | |
tree | feb641941e4fbd0db11bf70415fee5e3be50a08a /test | |
parent | a8537a5405583a4c975b56d95cab8bdd5d406e9f (diff) | |
download | libcss-33b37afeab6180e4fdc3c97f7f6cc713686ac6a9.tar.gz libcss-33b37afeab6180e4fdc3c97f7f6cc713686ac6a9.tar.bz2 |
Ensure there are zero global symbols without css_ or css__ in front of them. This helps prevent confusion if someone else wants a function called parse_background or similar
svn path=/trunk/libcss/; revision=11416
Diffstat (limited to 'test')
-rw-r--r-- | test/csdetect.c | 4 | ||||
-rw-r--r-- | test/lex-auto.c | 12 | ||||
-rw-r--r-- | test/number.c | 6 | ||||
-rw-r--r-- | test/parse-auto.c | 10 | ||||
-rw-r--r-- | test/parse.c | 4 | ||||
-rw-r--r-- | test/parse2-auto.c | 10 | ||||
-rw-r--r-- | test/select-auto.c | 42 | ||||
-rw-r--r-- | test/testutils.h | 18 |
8 files changed, 53 insertions, 53 deletions
diff --git a/test/csdetect.c b/test/csdetect.c index aa72ce2..efd764d 100644 --- a/test/csdetect.c +++ b/test/csdetect.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) return 1; } - ctx.buflen = parse_filesize(argv[1]); + ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; @@ -51,7 +51,7 @@ int main(int argc, char **argv) ctx.indata = false; ctx.inenc = false; - assert(parse_testfile(argv[1], handle_line, &ctx) == true); + assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0 && ctx.buf[ctx.bufused - 1] == '\n') diff --git a/test/lex-auto.c b/test/lex-auto.c index 70f9f44..044d9dd 100644 --- a/test/lex-auto.c +++ b/test/lex-auto.c @@ -36,7 +36,7 @@ typedef struct line_ctx { } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); -static void parse_expected(line_ctx *ctx, const char *data, size_t len); +static void css__parse_expected(line_ctx *ctx, const char *data, size_t len); static const char *string_from_type(css_token_type type); static css_token_type string_to_type(const char *data, size_t len); static void run_test(const uint8_t *data, size_t len, @@ -58,7 +58,7 @@ int main(int argc, char **argv) return 1; } - ctx.buflen = parse_filesize(argv[1]); + ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; @@ -77,7 +77,7 @@ int main(int argc, char **argv) ctx.indata = false; ctx.inexp = false; - assert(parse_testfile(argv[1], handle_line, &ctx) == true); + assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0) @@ -127,17 +127,17 @@ bool handle_line(const char *data, size_t datalen, void *pw) if (data[datalen - 1] == '\n') datalen -= 1; - parse_expected(ctx, data, datalen); + css__parse_expected(ctx, data, datalen); } } return true; } -void parse_expected(line_ctx *ctx, const char *data, size_t len) +void css__parse_expected(line_ctx *ctx, const char *data, size_t len) { css_token_type type; - const char *colon = parse_strnchr(data, len, ':'); + const char *colon = css__parse_strnchr(data, len, ':'); if (colon == NULL) colon = data + len; diff --git a/test/number.c b/test/number.c index bd5128f..12728fb 100644 --- a/test/number.c +++ b/test/number.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) return 1; } - ctx.buflen = parse_filesize(argv[1]); + ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; @@ -51,7 +51,7 @@ int main(int argc, char **argv) ctx.indata = false; ctx.inexp = false; - assert(parse_testfile(argv[1], handle_line, &ctx) == true); + assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0) @@ -120,7 +120,7 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen) assert(lwc_intern_string((const char *)data, len, &in) == lwc_error_ok); - result = number_from_lwc_string(in, false, &consumed); + result = css__number_from_lwc_string(in, false, &consumed); print_css_fixed(buf, sizeof(buf), result); diff --git a/test/parse-auto.c b/test/parse-auto.c index 8b0a36b..0d26829 100644 --- a/test/parse-auto.c +++ b/test/parse-auto.c @@ -46,7 +46,7 @@ typedef struct line_ctx { } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); -static void parse_expected(line_ctx *ctx, const char *data, size_t len); +static void css__parse_expected(line_ctx *ctx, const char *data, size_t len); static void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen); static bool validate_rule_selector(css_rule_selector *s, exp_entry *e); @@ -115,7 +115,7 @@ int main(int argc, char **argv) return 1; } - ctx.buflen = parse_filesize(argv[1]); + ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; @@ -135,7 +135,7 @@ int main(int argc, char **argv) ctx.inerrors = false; ctx.inexp = false; - assert(parse_testfile(argv[1], handle_line, &ctx) == true); + assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0) @@ -203,14 +203,14 @@ bool handle_line(const char *data, size_t datalen, void *pw) if (data[datalen - 1] == '\n') datalen -= 1; - parse_expected(ctx, data, datalen); + css__parse_expected(ctx, data, datalen); } } return true; } -void parse_expected(line_ctx *ctx, const char *data, size_t len) +void css__parse_expected(line_ctx *ctx, const char *data, size_t len) { /* Ignore blanks or lines that don't start with | */ if (len == 0 || data[0] != '|') diff --git a/test/parse.c b/test/parse.c index efb555e..255cd5b 100644 --- a/test/parse.c +++ b/test/parse.c @@ -112,7 +112,7 @@ int main(int argc, char **argv) size_t read = fread(buf, 1, CHUNK_SIZE, fp); assert(read == CHUNK_SIZE); - error = css_parser_parse_chunk(parser, buf, CHUNK_SIZE); + error = css_parser_css__parse_chunk(parser, buf, CHUNK_SIZE); assert(error == CSS_OK || error == CSS_NEEDDATA); len -= CHUNK_SIZE; @@ -122,7 +122,7 @@ int main(int argc, char **argv) size_t read = fread(buf, 1, len, fp); assert(read == len); - error = css_parser_parse_chunk(parser, buf, len); + error = css_parser_css__parse_chunk(parser, buf, len); assert(error == CSS_OK || error == CSS_NEEDDATA); len = 0; diff --git a/test/parse2-auto.c b/test/parse2-auto.c index 50426d2..877c0f5 100644 --- a/test/parse2-auto.c +++ b/test/parse2-auto.c @@ -30,7 +30,7 @@ typedef struct line_ctx { } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); -static void parse_expected(line_ctx *ctx, const char *data, size_t len); +static void css__parse_expected(line_ctx *ctx, const char *data, size_t len); static void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen); @@ -73,7 +73,7 @@ int main(int argc, char **argv) return 1; } - ctx.buflen = parse_filesize(argv[1]); + ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; @@ -93,7 +93,7 @@ int main(int argc, char **argv) ctx.inerrors = false; ctx.inexp = false; - assert(parse_testfile(argv[1], handle_line, &ctx) == true); + assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0) @@ -156,14 +156,14 @@ bool handle_line(const char *data, size_t datalen, void *pw) ctx->bufused += datalen; } if (ctx->inexp) { - parse_expected(ctx, data, datalen); + css__parse_expected(ctx, data, datalen); } } return true; } -void parse_expected(line_ctx *ctx, const char *data, size_t len) +void css__parse_expected(line_ctx *ctx, const char *data, size_t len) { while (ctx->expused + len >= ctx->explen) { size_t required = ctx->explen == 0 ? 64 : ctx->explen * 2; diff --git a/test/select-auto.c b/test/select-auto.c index 5b21b66..c81d097 100644 --- a/test/select-auto.c +++ b/test/select-auto.c @@ -65,13 +65,13 @@ typedef struct line_ctx { } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); -static void parse_tree(line_ctx *ctx, const char *data, size_t len); -static void parse_tree_data(line_ctx *ctx, const char *data, size_t len); -static void parse_sheet(line_ctx *ctx, const char *data, size_t len); -static void parse_media_list(const char **data, size_t *len, uint64_t *media); -static void parse_pseudo_list(const char **data, size_t *len, +static void css__parse_tree(line_ctx *ctx, const char *data, size_t len); +static void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len); +static void css__parse_sheet(line_ctx *ctx, const char *data, size_t len); +static void css__parse_media_list(const char **data, size_t *len, uint64_t *media); +static void css__parse_pseudo_list(const char **data, size_t *len, uint32_t *element); -static void parse_expected(line_ctx *ctx, const char *data, size_t len); +static void css__parse_expected(line_ctx *ctx, const char *data, size_t len); static void run_test(line_ctx *ctx, const char *exp, size_t explen); static void destroy_tree(node *root); @@ -207,7 +207,7 @@ int main(int argc, char **argv) lwc_intern_string("class", SLEN("class"), &ctx.attr_class); lwc_intern_string("id", SLEN("id"), &ctx.attr_id); - assert(parse_testfile(argv[1], handle_line, &ctx) == true); + assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.tree != NULL) @@ -240,7 +240,7 @@ bool handle_line(const char *data, size_t datalen, void *pw) ctx->inexp = false; } else { /* Assume start of stylesheet */ - parse_sheet(ctx, data + 1, datalen - 1); + css__parse_sheet(ctx, data + 1, datalen - 1); ctx->intree = false; ctx->insheet = true; @@ -264,7 +264,7 @@ bool handle_line(const char *data, size_t datalen, void *pw) ctx->sheets[ctx->n_sheets - 1].sheet) == CSS_OK); - parse_sheet(ctx, data + 1, datalen - 1); + css__parse_sheet(ctx, data + 1, datalen - 1); } else { error = css_stylesheet_append_data( ctx->sheets[ctx->n_sheets - 1].sheet, @@ -291,7 +291,7 @@ bool handle_line(const char *data, size_t datalen, void *pw) } else { /* Start state */ if (strncasecmp(data+1, "tree", 4) == 0) { - parse_tree(ctx, data + 5, datalen - 5); + css__parse_tree(ctx, data + 5, datalen - 5); ctx->intree = true; ctx->insheet = false; @@ -302,21 +302,21 @@ bool handle_line(const char *data, size_t datalen, void *pw) } else { if (ctx->intree) { /* Not interested in the '|' */ - parse_tree_data(ctx, data + 1, datalen - 1); + css__parse_tree_data(ctx, data + 1, datalen - 1); } else if (ctx->insheet) { error = css_stylesheet_append_data( ctx->sheets[ctx->n_sheets - 1].sheet, (const uint8_t *) data, datalen); assert(error == CSS_OK || error == CSS_NEEDDATA); } else if (ctx->inexp) { - parse_expected(ctx, data, datalen); + css__parse_expected(ctx, data, datalen); } } return true; } -void parse_tree(line_ctx *ctx, const char *data, size_t len) +void css__parse_tree(line_ctx *ctx, const char *data, size_t len) { const char *p = data; const char *end = data + len; @@ -334,7 +334,7 @@ void parse_tree(line_ctx *ctx, const char *data, size_t len) if (p < end) { left = end - p; - parse_media_list(&p, &left, &ctx->media); + css__parse_media_list(&p, &left, &ctx->media); end = p + left; } @@ -342,11 +342,11 @@ void parse_tree(line_ctx *ctx, const char *data, size_t len) if (p < end) { left = end - p; - parse_pseudo_list(&p, &left, &ctx->pseudo_element); + css__parse_pseudo_list(&p, &left, &ctx->pseudo_element); } } -void parse_tree_data(line_ctx *ctx, const char *data, size_t len) +void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len) { const char *p = data; const char *end = data + len; @@ -455,7 +455,7 @@ void parse_tree_data(line_ctx *ctx, const char *data, size_t len) } } -void parse_sheet(line_ctx *ctx, const char *data, size_t len) +void css__parse_sheet(line_ctx *ctx, const char *data, size_t len) { const char *p; const char *end = data + len; @@ -488,7 +488,7 @@ void parse_sheet(line_ctx *ctx, const char *data, size_t len) if (p < end) { size_t ignored = end - p; - parse_media_list(&p, &ignored, &media); + css__parse_media_list(&p, &ignored, &media); } /** \todo How are we going to handle @import? */ @@ -510,7 +510,7 @@ void parse_sheet(line_ctx *ctx, const char *data, size_t len) ctx->n_sheets++; } -void parse_media_list(const char **data, size_t *len, uint64_t *media) +void css__parse_media_list(const char **data, size_t *len, uint64_t *media) { const char *p = *data; const char *end = p + *len; @@ -583,7 +583,7 @@ void parse_media_list(const char **data, size_t *len, uint64_t *media) *len = end - p; } -void parse_pseudo_list(const char **data, size_t *len, uint32_t *element) +void css__parse_pseudo_list(const char **data, size_t *len, uint32_t *element) { const char *p = *data; const char *end = p + *len; @@ -635,7 +635,7 @@ void parse_pseudo_list(const char **data, size_t *len, uint32_t *element) *len = end - p; } -void parse_expected(line_ctx *ctx, const char *data, size_t len) +void css__parse_expected(line_ctx *ctx, const char *data, size_t len) { while (ctx->expused + len >= ctx->explen) { size_t required = ctx->explen == 0 ? 64 : ctx->explen * 2; diff --git a/test/testutils.h b/test/testutils.h index 5471fed..1a13e5b 100644 --- a/test/testutils.h +++ b/test/testutils.h @@ -34,10 +34,10 @@ void __assert2(const char *expr, const char *function, typedef bool (*line_func)(const char *data, size_t datalen, void *pw); -static size_t parse_strlen(const char *str, size_t limit); -char *parse_strnchr(const char *str, size_t len, int chr); -bool parse_testfile(const char *filename, line_func callback, void *pw); -size_t parse_filesize(const char *filename); +static size_t css__parse_strlen(const char *str, size_t limit); +char *css__parse_strnchr(const char *str, size_t len, int chr); +bool css__parse_testfile(const char *filename, line_func callback, void *pw); +size_t css__parse_filesize(const char *filename); /** * Testcase datafile parser driver @@ -47,7 +47,7 @@ size_t parse_filesize(const char *filename); * \param pw Pointer to client-specific private data * \return true on success, false otherwise. */ -bool parse_testfile(const char *filename, line_func callback, void *pw) +bool css__parse_testfile(const char *filename, line_func callback, void *pw) { FILE *fp; char buf[300]; @@ -62,7 +62,7 @@ bool parse_testfile(const char *filename, line_func callback, void *pw) if (buf[0] == '\n') continue; - if (!callback(buf, parse_strlen(buf, sizeof buf - 1), pw)) { + if (!callback(buf, css__parse_strlen(buf, sizeof buf - 1), pw)) { fclose(fp); return false; } @@ -80,7 +80,7 @@ bool parse_testfile(const char *filename, line_func callback, void *pw) * \param limit Upper bound on string length * \return String length */ -size_t parse_strlen(const char *str, size_t limit) +size_t css__parse_strlen(const char *str, size_t limit) { size_t len = 0; @@ -105,7 +105,7 @@ size_t parse_strlen(const char *str, size_t limit) * \param chr Character to search for * \return Pointer to character in string, or NULL if not found */ -char *parse_strnchr(const char *str, size_t len, int chr) +char *css__parse_strnchr(const char *str, size_t len, int chr) { size_t i; @@ -129,7 +129,7 @@ char *parse_strnchr(const char *str, size_t len, int chr) * \param filename Name of file to read size of * \return File size (in bytes), or 0 on error */ -size_t parse_filesize(const char *filename) +size_t css__parse_filesize(const char *filename) { FILE *fp; size_t len = 0; |