at work
This commit is contained in:
38
clib/rcache_test.c
Normal file
38
clib/rcache_test.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2022 Oleg Borodin <borodin@unix7.org>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <rcache.h>
|
||||
#include <massert.h>
|
||||
|
||||
|
||||
void test_getnc(void) {
|
||||
|
||||
int fd = open("test.json", O_RDONLY);
|
||||
|
||||
MASSERT(fd > 0);
|
||||
|
||||
rcache_t stream;
|
||||
|
||||
rcache_init(&stream, fd);
|
||||
|
||||
char c = rcache_getc(&stream);
|
||||
|
||||
printf("%c\n", c);
|
||||
printf("%s", (char *)stream.data);
|
||||
|
||||
rcache_destroy(&stream);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
test_getnc();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user