From 874c40f5bc16819f4ddd0eaa0fc19e9f344a6cc8 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 10 Jul 2023 23:20:32 +0200 Subject: Add tests for sys/socket.h --- tests/Makefile | 4 ++++ tests/test_recv.c | 14 ++++++++++++++ tests/test_recvfrom.c | 14 ++++++++++++++ tests/test_send.c | 14 ++++++++++++++ tests/test_sendto.c | 14 ++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 tests/test_recv.c create mode 100644 tests/test_recvfrom.c create mode 100644 tests/test_send.c create mode 100644 tests/test_sendto.c diff --git a/tests/Makefile b/tests/Makefile index 6075ec8..5dc4390 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -58,6 +58,10 @@ TARGETS= \ test_vsnprintf \ test_vsprintf \ test_malloc \ + test_recv \ + test_recvfrom \ + test_send \ + test_sendto \ .SILENT: diff --git a/tests/test_recv.c b/tests/test_recv.c new file mode 100644 index 0000000..21592eb --- /dev/null +++ b/tests/test_recv.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + recv(0, buffer, 14, 0); + CHK_FAIL_END + + puts(buffer); + return ret; +} diff --git a/tests/test_recvfrom.c b/tests/test_recvfrom.c new file mode 100644 index 0000000..8e95d43 --- /dev/null +++ b/tests/test_recvfrom.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + recvfrom(0, buffer, 14, 0, NULL, NULL); + CHK_FAIL_END + + puts(buffer); + return ret; +} diff --git a/tests/test_send.c b/tests/test_send.c new file mode 100644 index 0000000..f65811f --- /dev/null +++ b/tests/test_send.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + send(0, buffer, 14, 0); + CHK_FAIL_END + + puts(buffer); + return ret; +} diff --git a/tests/test_sendto.c b/tests/test_sendto.c new file mode 100644 index 0000000..5bfa851 --- /dev/null +++ b/tests/test_sendto.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + sendto(0, buffer, 14, 0, NULL, 0); + CHK_FAIL_END + + puts(buffer); + return ret; +} -- cgit v1.3