input: in certain tests, check that the string passed to the function is at the end of the string

This commit is contained in:
Peter McGoron 2021-07-10 16:27:02 -04:00
parent d258005125
commit ee5d0c1a67
1 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,7 @@ TEST line_limit(void) {
libscomm_reset(&in);
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_COMPLETE);
ASSERT_EQ(p, &s[LIBSCOMM_MAXBUF]);
PASS();
}
@ -60,6 +61,8 @@ TEST single_arg_too_large(void) {
libscomm_reset(&in);
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_OVERFLOW);
ASSERT_EQ(p, &s[sizeof s - 1]);
ASSERT_EQ(in.len, 0);
/* state values are opaque. */
@ -81,6 +84,7 @@ TEST arg_limit(void) {
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_COMPLETE);
ASSERT_EQ(l.name, 0);
ASSERT_EQ(l.len, LIBSCOMM_MAXARG);
ASSERT_EQ(p, &s[sizeof s - 1]);
for (i = 1; i <= l.len; i++) {
sprintf(tbuf, " %d", i);
@ -98,6 +102,7 @@ TEST too_many_arg(void) {
libscomm_reset(&in);
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_ARG_OVERFLOW);
ASSERT_EQ(p, &s[sizeof s - 1]);
PASS();
}