david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[test] Add self-tests for strdup()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2014-05-18 20:39:04 +01:00
parent e5878ce65d
commit 5249368950
1 changed files with 10 additions and 0 deletions

View File

@ -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 */