git » libfiu » commit 46bd609

tests/generated: Add a test for strdup()

author Alberto Bertogli
2014-05-25 12:45:09 UTC
committer Alberto Bertogli
2014-05-25 23:44:45 UTC
parent a99308ff6b981fc575838b839e20b2a78b459c15

tests/generated: Add a test for strdup()

This patch adds an auto-generated test for strdup().

Note overriding strdup() does not work on some platforms where the libc
defines it as a macro; the test accounts for that and will be skipped with a
warning in those cases.

tests/generated/tests/strdup.conf +11 -0

diff --git a/tests/generated/tests/strdup.conf b/tests/generated/tests/strdup.conf
new file mode 100644
index 0000000..f1b7796
--- /dev/null
+++ b/tests/generated/tests/strdup.conf
@@ -0,0 +1,11 @@
+
+[strdup]
+fp: libc/str/strdup
+include: string.h
+if: !(defined strdup)
+prep: char *dup, *s = "test string\n";
+call: dup = strdup(s);
+success_cond: strcmp(s, dup) == 0
+failure_cond: dup == NULL
+errno_on_fail: ENOMEM
+