input: in certain tests, check that the string passed to the function is at the end of the string
This commit is contained in:
parent
d258005125
commit
ee5d0c1a67
|
@ -41,6 +41,7 @@ TEST line_limit(void) {
|
||||||
|
|
||||||
libscomm_reset(&in);
|
libscomm_reset(&in);
|
||||||
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_COMPLETE);
|
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_COMPLETE);
|
||||||
|
ASSERT_EQ(p, &s[LIBSCOMM_MAXBUF]);
|
||||||
PASS();
|
PASS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +61,8 @@ TEST single_arg_too_large(void) {
|
||||||
|
|
||||||
libscomm_reset(&in);
|
libscomm_reset(&in);
|
||||||
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_OVERFLOW);
|
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_OVERFLOW);
|
||||||
|
ASSERT_EQ(p, &s[sizeof s - 1]);
|
||||||
|
|
||||||
ASSERT_EQ(in.len, 0);
|
ASSERT_EQ(in.len, 0);
|
||||||
|
|
||||||
/* state values are opaque. */
|
/* state values are opaque. */
|
||||||
|
@ -81,6 +84,7 @@ TEST arg_limit(void) {
|
||||||
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_COMPLETE);
|
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_COMPLETE);
|
||||||
ASSERT_EQ(l.name, 0);
|
ASSERT_EQ(l.name, 0);
|
||||||
ASSERT_EQ(l.len, LIBSCOMM_MAXARG);
|
ASSERT_EQ(l.len, LIBSCOMM_MAXARG);
|
||||||
|
ASSERT_EQ(p, &s[sizeof s - 1]);
|
||||||
|
|
||||||
for (i = 1; i <= l.len; i++) {
|
for (i = 1; i <= l.len; i++) {
|
||||||
sprintf(tbuf, " %d", i);
|
sprintf(tbuf, " %d", i);
|
||||||
|
@ -98,6 +102,7 @@ TEST too_many_arg(void) {
|
||||||
|
|
||||||
libscomm_reset(&in);
|
libscomm_reset(&in);
|
||||||
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_ARG_OVERFLOW);
|
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_ARG_OVERFLOW);
|
||||||
|
ASSERT_EQ(p, &s[sizeof s - 1]);
|
||||||
PASS();
|
PASS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue