Skip to content
Snippets Groups Projects
Commit f302ae6d authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Exercise the parser code for handling truncation of a list of strings

parent a060cb1d
No related branches found
No related tags found
No related merge requests found
...@@ -143,6 +143,18 @@ int main(int argc, char *argv[]) { ...@@ -143,6 +143,18 @@ int main(int argc, char *argv[]) {
assert(strcmp("abcdefghijklmnopqrstuvwxyz", alphabet) == 0); assert(strcmp("abcdefghijklmnopqrstuvwxyz", alphabet) == 0);
parser_free_param_string_array(nvar_result, var_result); parser_free_param_string_array(nvar_result, var_result);
/* Unfinished list of values. Should read last improperly quoted string.
* Note length should be CHUNK + 1. */
parser_get_param_string_array(&param_file, "Words:unfinished", &nvar_result,
&var_result);
assert(nvar_result == 11);
printf("\nList from Words:unfinished parameter (%d)\n", nvar_result);
for (int i = 0; i < nvar_result; i++) {
printf(" %d: %s\n", i, var_result[i]);
}
assert(strcmp("abcdefg", var_result[nvar_result-1]) == 0);
parser_free_param_string_array(nvar_result, var_result);
/* Print the contents of the structure to stdout now used. */ /* Print the contents of the structure to stdout now used. */
printf("\n--- Values after being used:\n"); printf("\n--- Values after being used:\n");
parser_print_params(&param_file); parser_print_params(&param_file);
......
...@@ -21,6 +21,7 @@ Words: ...@@ -21,6 +21,7 @@ Words:
list: ['xyz', 'ABC', "ab'c", "de:f", "g,hi", "zzz", Hello World, once-again] list: ['xyz', 'ABC', "ab'c", "de:f", "g,hi", "zzz", Hello World, once-again]
nonstdlist: 'xyz', 'ABC', "ab'c", "de:f", "g,hi", "zzz", Hello World, once-again nonstdlist: 'xyz', 'ABC', "ab'c", "de:f", "g,hi", "zzz", Hello World, once-again
long: [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z] long: [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
unfinished: [a, b, c, d, e, f, g, h, i, j, 'abcdefg
# Spelling mistake, should go into unused list. # Spelling mistake, should go into unused list.
Box: Box:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment