Add tests for some utils

This commit is contained in:
2022-12-10 01:33:16 +01:00
parent 933aac0f09
commit 0f75aeea7a
10 changed files with 248 additions and 52 deletions

15
test/test_sock.c Normal file
View File

@ -0,0 +1,15 @@
#include <criterion/criterion.h>
#include "mock_socket.h"
#include "../src/lib/sock.h"
Test(sock, sock_send_1) {
int fd = socket(AF_INET6, SOCK_STREAM, 0);
sock s;
s.enc = 0;
s.socket = fd;
long ret = sock_send(&s, "Hello", 5, 0);
cr_assert_eq(ret, 5);
}