input: add line_limit test

This commit is contained in:
Peter McGoron 2021-07-10 16:06:19 -04:00
parent 2e2c8bff35
commit 5ce988c8de
1 changed files with 22 additions and 0 deletions

View File

@ -21,6 +21,27 @@ TEST one_pass(void) {
PASS(); PASS();
} }
TEST line_limit(void) {
struct libscomm_input in;
struct libscomm_line l;
char s[LIBSCOMM_MAXBUF + 1];
char *p = s;
int i;
for (i = 0; i < LIBSCOMM_MAXBUF - 1; i++) {
s[i] = (i + 1) % 64 ? 'a' : '\t';
}
s[LIBSCOMM_MAXBUF - 1] = '\n';
s[LIBSCOMM_MAXBUF] = 0;
if (GREATEST_IS_VERBOSE())
fprintf(stderr, "%s", s);
libscomm_reset(&in);
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_COMPLETE);
PASS();
}
TEST single_arg_too_large(void) { TEST single_arg_too_large(void) {
struct libscomm_input in; struct libscomm_input in;
struct libscomm_line l; struct libscomm_line l;
@ -72,6 +93,7 @@ GREATEST_MAIN_DEFS();
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
GREATEST_MAIN_BEGIN(); GREATEST_MAIN_BEGIN();
RUN_TEST(one_pass); RUN_TEST(one_pass);
RUN_TEST(line_limit);
RUN_TEST(single_arg_too_large); RUN_TEST(single_arg_too_large);
RUN_TEST(arg_limit); RUN_TEST(arg_limit);
GREATEST_MAIN_END(); GREATEST_MAIN_END();