Lines Matching refs:io
58 size_t buf_size, struct io *io) in setup_test() argument
63 io->fd = open(path, O_RDONLY); in setup_test()
64 if (io->fd < 0) { in setup_test()
69 io->buf = malloc(buf_size); in setup_test()
70 if (io->buf == NULL) { in setup_test()
72 close(io->fd); in setup_test()
76 io__init(io, io->fd, io->buf, buf_size); in setup_test()
80 static void cleanup_test(char path[PATH_MAX], struct io *io) in cleanup_test() argument
82 free(io->buf); in cleanup_test()
83 close(io->fd); in cleanup_test()
90 struct io io; in do_test_get_char() local
94 if (setup_test(path, test_string, buf_size, &io)) in do_test_get_char()
98 ch = io__get_char(&io); in do_test_get_char()
101 EXPECT_EQUAL(io.eof, false); in do_test_get_char()
103 ch = io__get_char(&io); in do_test_get_char()
105 EXPECT_EQUAL(io.eof, true); in do_test_get_char()
107 cleanup_test(path, &io); in do_test_get_char()
137 struct io io; in do_test_get_hex() local
141 if (setup_test(path, test_string, 4, &io)) in do_test_get_hex()
144 ch = io__get_hex(&io, &hex); in do_test_get_hex()
148 ch = io__get_hex(&io, &hex); in do_test_get_hex()
152 ch = io__get_hex(&io, &hex); in do_test_get_hex()
156 EXPECT_EQUAL(io.eof, end_eof); in do_test_get_hex()
158 cleanup_test(path, &io); in do_test_get_hex()
218 struct io io; in do_test_get_dec() local
222 if (setup_test(path, test_string, 4, &io)) in do_test_get_dec()
225 ch = io__get_dec(&io, &dec); in do_test_get_dec()
229 ch = io__get_dec(&io, &dec); in do_test_get_dec()
233 ch = io__get_dec(&io, &dec); in do_test_get_dec()
237 EXPECT_EQUAL(io.eof, end_eof); in do_test_get_dec()
239 cleanup_test(path, &io); in do_test_get_dec()