From 5827cef597d2b9b87b950c9b50023d11b1363c04 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 23 Jun 2023 00:28:01 +0200 Subject: Add a test for fgets --- tests/Makefile | 4 +++- tests/test_fgets.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/test_fgets.c 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 GCOV=../x86_64-linux-musl-native/bin/gcov CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 -TARGETS=test_memcpy_static_write \ +TARGETS= \ + test_fgets \ + test_memcpy_static_write \ test_memcpy_dynamic_write \ test_memcpy_static_read \ 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 @@ +#include "common.h" + +#define _GNU_SOURCE +#include + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + fgets(buffer, 14, NULL); + CHK_FAIL_END + + puts(buffer); + return ret; +} -- cgit v1.3