From 875b469a6dd588702a4d84a9e8f3f4002a482021 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 10 Jul 2023 23:34:34 +0200 Subject: Add tests for sys/socket --- tests/Makefile | 4 ++++ tests/test_FD_CLR_SETSIZE.c | 14 ++++++++++++++ tests/test_FD_CLR_negative.c | 14 ++++++++++++++ tests/test_FD_SET_SETSIZE.c | 14 ++++++++++++++ tests/test_FD_SET_negative.c | 14 ++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 tests/test_FD_CLR_SETSIZE.c create mode 100644 tests/test_FD_CLR_negative.c create mode 100644 tests/test_FD_SET_SETSIZE.c create mode 100644 tests/test_FD_SET_negative.c diff --git a/tests/Makefile b/tests/Makefile index 5dc4390..9a65cf3 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -62,6 +62,10 @@ TARGETS= \ test_recvfrom \ test_send \ test_sendto \ + test_FD_CLR_negative \ + test_FD_CLR_SETSIZE \ + test_FD_SET_negative \ + test_FD_SET_SETSIZE \ .SILENT: diff --git a/tests/test_FD_CLR_SETSIZE.c b/tests/test_FD_CLR_SETSIZE.c new file mode 100644 index 0000000..cd571f1 --- /dev/null +++ b/tests/test_FD_CLR_SETSIZE.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +int main(int argc, char** argv) { + fd_set rfds; + + CHK_FAIL_START + FD_CLR(FD_SETSIZE, &rfds); + CHK_FAIL_END + + puts((const char*)&rfds); + return ret; +} diff --git a/tests/test_FD_CLR_negative.c b/tests/test_FD_CLR_negative.c new file mode 100644 index 0000000..43b5e42 --- /dev/null +++ b/tests/test_FD_CLR_negative.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +int main(int argc, char** argv) { + fd_set rfds; + + CHK_FAIL_START + FD_CLR(-1, &rfds); + CHK_FAIL_END + + puts((const char*)&rfds); + return ret; +} diff --git a/tests/test_FD_SET_SETSIZE.c b/tests/test_FD_SET_SETSIZE.c new file mode 100644 index 0000000..87e197e --- /dev/null +++ b/tests/test_FD_SET_SETSIZE.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +int main(int argc, char** argv) { + fd_set rfds; + + CHK_FAIL_START + FD_SET(FD_SETSIZE, &rfds); + CHK_FAIL_END + + puts((const char*)&rfds); + return ret; +} diff --git a/tests/test_FD_SET_negative.c b/tests/test_FD_SET_negative.c new file mode 100644 index 0000000..df0aa0c --- /dev/null +++ b/tests/test_FD_SET_negative.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +int main(int argc, char** argv) { + fd_set rfds; + + CHK_FAIL_START + FD_SET(-1, &rfds); + CHK_FAIL_END + + puts((const char*)&rfds); + return ret; +} -- cgit v1.3