30 lines
578 B
C
30 lines
578 B
C
|
#include "greatest.h"
|
||
|
#include "../input.h"
|
||
|
|
||
|
#define s(x) {x, sizeof(x) - 1}
|
||
|
|
||
|
TEST one_pass(void) {
|
||
|
struct libscomm_input in;
|
||
|
struct libscomm_inbuf b = s("Arg 1\tArg \r\v\t!\n");
|
||
|
struct libscomm_line l;
|
||
|
|
||
|
libscomm_reset(&in);
|
||
|
ASSERT_EQ(libscomm_read(&in, &b, &l), LIBSCOMM_COMPLETE);
|
||
|
ASSERT_EQ(l.len, 3);
|
||
|
ASSERT_EQ(l.name, 0);
|
||
|
|
||
|
ASSERT_STR_EQ(l.buf[0], "Arg 1");
|
||
|
ASSERT_STR_EQ(l.buf[1], "Arg \r\v");
|
||
|
ASSERT_STR_EQ(l.buf[2], "!");
|
||
|
|
||
|
PASS();
|
||
|
}
|
||
|
|
||
|
GREATEST_MAIN_DEFS();
|
||
|
|
||
|
int main(int argc, char *argv[]) {
|
||
|
GREATEST_MAIN_BEGIN();
|
||
|
RUN_TEST(one_pass);
|
||
|
GREATEST_MAIN_END();
|
||
|
}
|