diff options
| author | jvoisin | 2023-07-10 23:20:32 +0200 |
|---|---|---|
| committer | jvoisin | 2023-07-10 23:20:32 +0200 |
| commit | 874c40f5bc16819f4ddd0eaa0fc19e9f344a6cc8 (patch) | |
| tree | 2280a8bf4eedfb520b5e70f071ebc673c674ae3b /tests | |
| parent | 106785b6bba515566637a028a602061fdef1e184 (diff) | |
Add tests for sys/socket.h
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile | 4 | ||||
| -rw-r--r-- | tests/test_recv.c | 14 | ||||
| -rw-r--r-- | tests/test_recvfrom.c | 14 | ||||
| -rw-r--r-- | tests/test_send.c | 14 | ||||
| -rw-r--r-- | tests/test_sendto.c | 14 |
5 files changed, 60 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile index 6075ec8..5dc4390 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -58,6 +58,10 @@ TARGETS= \ | |||
| 58 | test_vsnprintf \ | 58 | test_vsnprintf \ |
| 59 | test_vsprintf \ | 59 | test_vsprintf \ |
| 60 | test_malloc \ | 60 | test_malloc \ |
| 61 | test_recv \ | ||
| 62 | test_recvfrom \ | ||
| 63 | test_send \ | ||
| 64 | test_sendto \ | ||
| 61 | 65 | ||
| 62 | .SILENT: | 66 | .SILENT: |
| 63 | 67 | ||
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <sys/socket.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[12] = {0}; | ||
| 7 | |||
| 8 | CHK_FAIL_START | ||
| 9 | recv(0, buffer, 14, 0); | ||
| 10 | CHK_FAIL_END | ||
| 11 | |||
| 12 | puts(buffer); | ||
| 13 | return ret; | ||
| 14 | } | ||
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <sys/socket.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[12] = {0}; | ||
| 7 | |||
| 8 | CHK_FAIL_START | ||
| 9 | recvfrom(0, buffer, 14, 0, NULL, NULL); | ||
| 10 | CHK_FAIL_END | ||
| 11 | |||
| 12 | puts(buffer); | ||
| 13 | return ret; | ||
| 14 | } | ||
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <sys/socket.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[12] = {0}; | ||
| 7 | |||
| 8 | CHK_FAIL_START | ||
| 9 | send(0, buffer, 14, 0); | ||
| 10 | CHK_FAIL_END | ||
| 11 | |||
| 12 | puts(buffer); | ||
| 13 | return ret; | ||
| 14 | } | ||
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 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <sys/socket.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[12] = {0}; | ||
| 7 | |||
| 8 | CHK_FAIL_START | ||
| 9 | sendto(0, buffer, 14, 0, NULL, 0); | ||
| 10 | CHK_FAIL_END | ||
| 11 | |||
| 12 | puts(buffer); | ||
| 13 | return ret; | ||
| 14 | } | ||
