input: add line_limit test
This commit is contained in:
parent
2e2c8bff35
commit
5ce988c8de
22
test/input.c
22
test/input.c
|
@ -21,6 +21,27 @@ TEST one_pass(void) {
|
|||
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) {
|
||||
struct libscomm_input in;
|
||||
struct libscomm_line l;
|
||||
|
@ -72,6 +93,7 @@ GREATEST_MAIN_DEFS();
|
|||
int main(int argc, char *argv[]) {
|
||||
GREATEST_MAIN_BEGIN();
|
||||
RUN_TEST(one_pass);
|
||||
RUN_TEST(line_limit);
|
||||
RUN_TEST(single_arg_too_large);
|
||||
RUN_TEST(arg_limit);
|
||||
GREATEST_MAIN_END();
|
||||
|
|
Loading…
Reference in New Issue