Browse Source

[test] Add self-tests for strdup()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
5249368950
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      src/tests/string_test.c

+ 10
- 0
src/tests/string_test.c View File

@@ -124,6 +124,16 @@ static void string_test_exec ( void ) {
124 124
 		memswap ( ( test + 1 ), ( test + 4 ), 3 );
125 125
 		ok ( memcmp ( test, expected, sizeof ( test ) ) == 0 );
126 126
 	}
127
+
128
+	/* Test strdup() */
129
+	{
130
+		const char *orig = "testing testing";
131
+		char *dup = strdup ( orig );
132
+		ok ( dup != NULL );
133
+		ok ( dup != orig );
134
+		ok ( strcmp ( dup, orig ) == 0 );
135
+		free ( dup );
136
+	}
127 137
 }
128 138
 
129 139
 /** String self-test */

Loading…
Cancel
Save