]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[test] Add self-tests for strdup()
authorMichael Brown <mcb30@ipxe.org>
Sun, 18 May 2014 19:39:04 +0000 (20:39 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sun, 18 May 2014 19:39:58 +0000 (20:39 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/tests/string_test.c

index 88181cc21796db40473f561a76e57c06481cf1a1..934c537cfc81e2b9d88fc644238c999ceda8078f 100644 (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 */