commit fa40365faea6b87288504f0d8ad39dab8ff302b4
parent 56d760c5cb1c07dfa409742d51f836792a09d824
Author: jvoisin <julien.voisin@dustri.org>
Date: Thu, 13 Apr 2023 23:44:52 +0200
Add tests for strcat and strcpy
Diffstat:
3 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
@@ -11,6 +11,8 @@ TARGETS=test_memcpy_static_write \
test_memmove_dynamic_read \
test_memset_static_write \
test_memset_dynamic_write \
+ test_strcpy_static_write \
+ test_strcat_static_write \
.SILENT:
diff --git a/tests/test_strcat_static_write.c b/tests/test_strcat_static_write.c
@@ -0,0 +1,16 @@
+#include "common.h"
+
+#include <string.h>
+
+int main(int argc, char** argv) {
+ char buffer[8] = {0};
+ strcat(buffer, "1234567");
+ puts(buffer);
+
+ CHK_FAIL_START
+ strcat(buffer, "1234567890");
+ CHK_FAIL_END
+
+ puts(buffer);
+ return ret;
+}
diff --git a/tests/test_strcpy_static_write.c b/tests/test_strcpy_static_write.c
@@ -0,0 +1,16 @@
+#include "common.h"
+
+#include <string.h>
+
+int main(int argc, char** argv) {
+ char buffer[8] = {0};
+ strcpy(buffer, "1234567");
+ puts(buffer);
+
+ CHK_FAIL_START
+ strcpy(buffer, "1234567890");
+ CHK_FAIL_END
+
+ puts(buffer);
+ return ret;
+}