From: Michael Brown Date: Sun, 18 May 2014 19:39:04 +0000 (+0100) Subject: [test] Add self-tests for strdup() X-Git-Tag: v1.20.1~1175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=524936895089772a3d1eac629b5f978fa076a161;p=thirdparty%2Fipxe.git [test] Add self-tests for strdup() Signed-off-by: Michael Brown --- 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 */