input: add too_many_arg test

This commit is contained in:
Peter McGoron 2021-07-10 16:09:34 -04:00
parent 5ce988c8de
commit 75e721ccf9
1 changed files with 12 additions and 0 deletions

View File

@ -88,6 +88,17 @@ TEST arg_limit(void) {
PASS();
}
TEST too_many_arg(void) {
struct libscomm_input in;
struct libscomm_line l;
char s[] = " 1\t 2\t 3\t 4\t 5\t 6\t 7\t 8\t 9\t 10\t 11\t 12\t 13\t 14\t 15\t 16\t 17\t 18\t 19\t 20\t 21\t 22\t 23\t 24\t 25\t 26\t 27\t 28\t 29\t 30\t 31\t 32\t 33\n";
char *p = s;
libscomm_reset(&in);
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_ARG_OVERFLOW);
PASS();
}
GREATEST_MAIN_DEFS();
int main(int argc, char *argv[]) {
@ -96,5 +107,6 @@ int main(int argc, char *argv[]) {
RUN_TEST(line_limit);
RUN_TEST(single_arg_too_large);
RUN_TEST(arg_limit);
RUN_TEST(too_many_arg);
GREATEST_MAIN_END();
}