diff options
| author | jvoisin | 2023-06-23 00:28:01 +0200 |
|---|---|---|
| committer | jvoisin | 2023-06-23 00:28:01 +0200 |
| commit | 5827cef597d2b9b87b950c9b50023d11b1363c04 (patch) | |
| tree | e3797ed1feedda57bc15e8aac39c1cae43759025 /tests | |
| parent | 44a71e36ed37781fa850662f479734cce1c354ce (diff) | |
Add a test for fgets
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile | 4 | ||||
| -rw-r--r-- | tests/test_fgets.c | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile index 0e415a5..ee43a93 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -2,7 +2,9 @@ CC=../x86_64-linux-musl-native/bin/gcc | |||
| 2 | GCOV=../x86_64-linux-musl-native/bin/gcov | 2 | GCOV=../x86_64-linux-musl-native/bin/gcov |
| 3 | CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 | 3 | CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 |
| 4 | 4 | ||
| 5 | TARGETS=test_memcpy_static_write \ | 5 | TARGETS= \ |
| 6 | test_fgets \ | ||
| 7 | test_memcpy_static_write \ | ||
| 6 | test_memcpy_dynamic_write \ | 8 | test_memcpy_dynamic_write \ |
| 7 | test_memcpy_static_read \ | 9 | test_memcpy_static_read \ |
| 8 | test_memcpy_dynamic_read \ | 10 | test_memcpy_dynamic_read \ |
diff --git a/tests/test_fgets.c b/tests/test_fgets.c new file mode 100644 index 0000000..f01d7c6 --- /dev/null +++ b/tests/test_fgets.c | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #define _GNU_SOURCE | ||
| 4 | #include <poll.h> | ||
| 5 | |||
| 6 | int main(int argc, char** argv) { | ||
| 7 | char buffer[12] = {0}; | ||
| 8 | |||
| 9 | CHK_FAIL_START | ||
| 10 | fgets(buffer, 14, NULL); | ||
| 11 | CHK_FAIL_END | ||
| 12 | |||
| 13 | puts(buffer); | ||
| 14 | return ret; | ||
| 15 | } | ||
