Explorar el Código

[test] Add self-tests for strdup()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown hace 10 años
padre
commit
5249368950
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10
    0
      src/tests/string_test.c

+ 10
- 0
src/tests/string_test.c Ver fichero

@@ -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…
Cancelar
Guardar