Просмотр исходного кода

libdpkg: Add test cases for dpkg_ar_member_is_illegal()

Guillem Jover лет назад: 12
Родитель
Сommit
0954647136
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      lib/dpkg/test/t-ar.c

+ 14 - 1
lib/dpkg/test/t-ar.c

@@ -38,10 +38,23 @@ test_ar_normalize_name(void)
 	test_str(arh.ar_name, ==, "member-name");
 }
 
+static void
+test_ar_member_is_illegal(void)
+{
+	struct ar_hdr arh;
+
+	memset(&arh, ' ', sizeof(arh));
+	test_pass(dpkg_ar_member_is_illegal(&arh));
+
+	memcpy(arh.ar_fmag, ARFMAG, sizeof(arh.ar_fmag));
+	test_fail(dpkg_ar_member_is_illegal(&arh));
+}
+
 static void
 test(void)
 {
-	test_plan(2);
+	test_plan(4);
 
 	test_ar_normalize_name();
+	test_ar_member_is_illegal();
 }