add more tests

This commit is contained in:
Hinko Kocevar
2025-04-06 13:38:55 +02:00
committed by Andrew Johnson
parent e294bb443c
commit f34dd44c29
3 changed files with 16 additions and 7 deletions

View File

@@ -8,9 +8,11 @@
5 it is fine to spit words, or really chop them up!
6 start with backslash , fine with me but why?
7 have a trailing space after backslash \
8 not part of the string no. 7
# keep this one last
99 will not get to this line 'cause input file line has no newline

View File

@@ -25,9 +25,13 @@ o\
p\
them up!
\
6 start with backslash , fine with me but why?
# if there is a trailing char after the backslash that does not count as
# a multiline string
7 have a trailing space after backslash \
8 not part of the string no. 7
# keep this one last
99 this one will not appear 'cause of no newline
99 will not get to this line 'cause input file line has no newline

View File

@@ -20,7 +20,7 @@ MAIN(readlineTest)
const char *input = ".." OSI_PATH_SEPARATOR "multiline-input.txt";
const char *expect = ".." OSI_PATH_SEPARATOR "multiline-expect.txt";
testPlan(5);
testPlan(9);
testDiag("open input file \"%s\"", input);
FILE *fp_input = fopen(input, "r");
@@ -79,10 +79,13 @@ MAIN(readlineTest)
size_t len_input = strlen(line_input);
if (len_input != len_expect) {
testAbort("lines are not of same length: input %ld, expected %ld", len_input, len_expect);
testAbort("lines are not of same length:\n"
"input len %ld :\n\"%s\"\nexpected len %ld : \n\"%s\"",
len_input, line_input, len_expect, line_expect);
}
if (strncmp(line_input, line_expect, len_expect)) {
testAbort("lines are not the same:\ninput:\"%s\"\nexpected: \"%s\"", line_input, line_expect);
testAbort("lines are not the same:\ninput:\"%s\"\nexpected: \"%s\"",
line_input, line_expect);
}
testOk(1, "line \"%s\"", line_input);
}