diff options
| author | jvoisin | 2023-07-10 23:34:34 +0200 |
|---|---|---|
| committer | jvoisin | 2023-07-10 23:36:08 +0200 |
| commit | 875b469a6dd588702a4d84a9e8f3f4002a482021 (patch) | |
| tree | 6ac774df36336a88683fb81a8f95aa9f5dcff59d | |
| parent | 874c40f5bc16819f4ddd0eaa0fc19e9f344a6cc8 (diff) | |
Add tests for sys/socket
| -rw-r--r-- | tests/Makefile | 4 | ||||
| -rw-r--r-- | tests/test_FD_CLR_SETSIZE.c | 14 | ||||
| -rw-r--r-- | tests/test_FD_CLR_negative.c | 14 | ||||
| -rw-r--r-- | tests/test_FD_SET_SETSIZE.c | 14 | ||||
| -rw-r--r-- | tests/test_FD_SET_negative.c | 14 |
5 files changed, 60 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile index 5dc4390..9a65cf3 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -62,6 +62,10 @@ TARGETS= \ | |||
| 62 | test_recvfrom \ | 62 | test_recvfrom \ |
| 63 | test_send \ | 63 | test_send \ |
| 64 | test_sendto \ | 64 | test_sendto \ |
| 65 | test_FD_CLR_negative \ | ||
| 66 | test_FD_CLR_SETSIZE \ | ||
| 67 | test_FD_SET_negative \ | ||
| 68 | test_FD_SET_SETSIZE \ | ||
| 65 | 69 | ||
| 66 | .SILENT: | 70 | .SILENT: |
| 67 | 71 | ||
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <sys/select.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | fd_set rfds; | ||
| 7 | |||
| 8 | CHK_FAIL_START | ||
| 9 | FD_CLR(FD_SETSIZE, &rfds); | ||
| 10 | CHK_FAIL_END | ||
| 11 | |||
| 12 | puts((const char*)&rfds); | ||
| 13 | return ret; | ||
| 14 | } | ||
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <sys/select.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | fd_set rfds; | ||
| 7 | |||
| 8 | CHK_FAIL_START | ||
| 9 | FD_CLR(-1, &rfds); | ||
| 10 | CHK_FAIL_END | ||
| 11 | |||
| 12 | puts((const char*)&rfds); | ||
| 13 | return ret; | ||
| 14 | } | ||
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <sys/select.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | fd_set rfds; | ||
| 7 | |||
| 8 | CHK_FAIL_START | ||
| 9 | FD_SET(FD_SETSIZE, &rfds); | ||
| 10 | CHK_FAIL_END | ||
| 11 | |||
| 12 | puts((const char*)&rfds); | ||
| 13 | return ret; | ||
| 14 | } | ||
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <sys/select.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | fd_set rfds; | ||
| 7 | |||
| 8 | CHK_FAIL_START | ||
| 9 | FD_SET(-1, &rfds); | ||
| 10 | CHK_FAIL_END | ||
| 11 | |||
| 12 | puts((const char*)&rfds); | ||
| 13 | return ret; | ||
| 14 | } | ||
