浏览代码

[test] Add self-tests for strdup()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 年前
父节点
当前提交
5249368950
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10
    0
      src/tests/string_test.c

+ 10
- 0
src/tests/string_test.c 查看文件

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

正在加载...
取消
保存