summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjvoisin2023-04-13 23:44:52 +0200
committerjvoisin2023-04-13 23:49:02 +0200
commitfa40365faea6b87288504f0d8ad39dab8ff302b4 (patch)
tree378ad91e5bedb268e2ecc15e668830189dfe32b0 /tests
parent56d760c5cb1c07dfa409742d51f836792a09d824 (diff)
Add tests for strcat and strcpy
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile2
-rw-r--r--tests/test_strcat_static_write.c16
-rw-r--r--tests/test_strcpy_static_write.c16
3 files changed, 34 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 25f6f66..9cca6f5 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -11,6 +11,8 @@ TARGETS=test_memcpy_static_write \
11 test_memmove_dynamic_read \ 11 test_memmove_dynamic_read \
12 test_memset_static_write \ 12 test_memset_static_write \
13 test_memset_dynamic_write \ 13 test_memset_dynamic_write \
14 test_strcpy_static_write \
15 test_strcat_static_write \
14 16
15.SILENT: 17.SILENT:
16 18
diff --git a/tests/test_strcat_static_write.c b/tests/test_strcat_static_write.c
new file mode 100644
index 0000000..d0cb903
--- /dev/null
+++ b/tests/test_strcat_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 strcat(buffer, "1234567");
8 puts(buffer);
9
10 CHK_FAIL_START
11 strcat(buffer, "1234567890");
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_strcpy_static_write.c b/tests/test_strcpy_static_write.c
new file mode 100644
index 0000000..a3e8100
--- /dev/null
+++ b/tests/test_strcpy_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 strcpy(buffer, "1234567");
8 puts(buffer);
9
10 CHK_FAIL_START
11 strcpy(buffer, "1234567890");
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}