diff options
| -rw-r--r-- | tests/Makefile | 4 | ||||
| -rw-r--r-- | tests/test_memset_dynamic_write.c | 16 | ||||
| -rw-r--r-- | tests/test_memset_static_write.c | 16 |
3 files changed, 35 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile index 1f80c32..25f6f66 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -8,7 +8,9 @@ TARGETS=test_memcpy_static_write \ | |||
| 8 | test_memmove_static_write \ | 8 | test_memmove_static_write \ |
| 9 | test_memmove_dynamic_write \ | 9 | test_memmove_dynamic_write \ |
| 10 | test_memmove_static_read \ | 10 | test_memmove_static_read \ |
| 11 | test_memmove_dynamic_read | 11 | test_memmove_dynamic_read \ |
| 12 | test_memset_static_write \ | ||
| 13 | test_memset_dynamic_write \ | ||
| 12 | 14 | ||
| 13 | .SILENT: | 15 | .SILENT: |
| 14 | 16 | ||
diff --git a/tests/test_memset_dynamic_write.c b/tests/test_memset_dynamic_write.c new file mode 100644 index 0000000..5e1d8a3 --- /dev/null +++ b/tests/test_memset_dynamic_write.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <string.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[8] = {0}; | ||
| 7 | memset(buffer, 0, sizeof(buffer) - 1); | ||
| 8 | puts(buffer); | ||
| 9 | |||
| 10 | CHK_FAIL_START | ||
| 11 | memset(buffer, 0, argc); | ||
| 12 | CHK_FAIL_END | ||
| 13 | |||
| 14 | puts(buffer); | ||
| 15 | return ret; | ||
| 16 | } | ||
diff --git a/tests/test_memset_static_write.c b/tests/test_memset_static_write.c new file mode 100644 index 0000000..dc30ed8 --- /dev/null +++ b/tests/test_memset_static_write.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <string.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[8] = {0}; | ||
| 7 | memset(buffer, 0, sizeof(buffer) - 1); | ||
| 8 | puts(buffer); | ||
| 9 | |||
| 10 | CHK_FAIL_START | ||
| 11 | memset(buffer, 0, sizeof(buffer) + 1); | ||
| 12 | CHK_FAIL_END | ||
| 13 | |||
| 14 | puts(buffer); | ||
| 15 | return ret; | ||
| 16 | } | ||
