diff options
author | Michael Brown <mcb30@ipxe.org> | 2014-05-18 20:39:04 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2014-05-18 20:39:58 +0100 |
commit | 524936895089772a3d1eac629b5f978fa076a161 (patch) | |
tree | 696c44def3bdf1160b579e20f375c18a6fd5bdf9 /src/tests/string_test.c | |
parent | e5878ce65db229e495adf9492233daa78c2eb0b7 (diff) | |
download | ipxe-524936895089772a3d1eac629b5f978fa076a161.tar.gz |
[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 88181cc21..934c537cf 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 */ |