diff options
author | Michael Brown | 2014-05-18 21:39:04 +0200 |
---|---|---|
committer | Michael Brown | 2014-05-18 21:39:58 +0200 |
commit | 524936895089772a3d1eac629b5f978fa076a161 (patch) | |
tree | 696c44def3bdf1160b579e20f375c18a6fd5bdf9 /src/tests/string_test.c | |
parent | [syslog] Strip invalid characters from hostname (diff) | |
download | ipxe-524936895089772a3d1eac629b5f978fa076a161.tar.gz ipxe-524936895089772a3d1eac629b5f978fa076a161.tar.xz ipxe-524936895089772a3d1eac629b5f978fa076a161.zip |
[test] Add self-tests for strdup()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/tests/string_test.c')
-rw-r--r-- | src/tests/string_test.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/string_test.c b/src/tests/string_test.c index 88181cc2..934c537c 100644 --- a/src/tests/string_test.c +++ b/src/tests/string_test.c @@ -124,6 +124,16 @@ static void string_test_exec ( void ) { memswap ( ( test + 1 ), ( test + 4 ), 3 ); ok ( memcmp ( test, expected, sizeof ( test ) ) == 0 ); } + + /* Test strdup() */ + { + const char *orig = "testing testing"; + char *dup = strdup ( orig ); + ok ( dup != NULL ); + ok ( dup != orig ); + ok ( strcmp ( dup, orig ) == 0 ); + free ( dup ); + } } /** String self-test */ |