In an attempt to improve coverage a little, I've added some unit tests that 
check for a NULL destination for some of the base types. These pass, although 
I didn't actually run the coverage checker locally to verify that we're now 
testing correctly.

Patch attached. Please apply.

Brad 
=== modified file 'torture/unit/base/types/pdf-i64-abs.c'
--- torture/unit/base/types/pdf-i64-abs.c	2009-03-03 22:26:28 +0000
+++ torture/unit/base/types/pdf-i64-abs.c	2009-06-14 01:22:26 +0000
@@ -34,9 +34,9 @@
 /*
  * Test: pdf_i64_abs_001
  * Description:
- *   Checks if the result is the absolute of the number
+ *   Checks if the result is the absolute value of the input variable
  * Success conditions:
- * The call should produce a positive number from a negative
+ * The call should produce a positive number from a negative argument
  */
 START_TEST(pdf_i64_abs_001)
 {
@@ -62,9 +62,9 @@
 /*
  * Test: pdf_i64_abs_002
  * Description:
- *   Checks if result is absolute of the input variable
+ *   Checks if result is absolute value of the input variable
  * Success conditions:
- * The call should produce a positive number from a positive
+ * The call should produce a positive number from a positive argument
  */
 
 START_TEST(pdf_i64_abs_002)
@@ -88,6 +88,27 @@
 END_TEST
 
 /*
+ * Test: pdf_i64_abs_003
+ * Description:
+ *   Checks if an invalid destination correctly throws an error
+ * Success conditions:
+ * The call should return PDF_ERROR
+ */
+START_TEST(pdf_i64_abs_003)
+{
+  pdf_status_t p_status = PDF_OK;
+  pdf_i64_t src;
+  pdf_i64_t *dest = NULL;
+
+  pdf_i64_assign(&src,0, 3, &p_status);
+  fail_if(p_status != PDF_OK);
+
+  pdf_i64_abs(dest, src , &p_status);
+  fail_unless(p_status == PDF_ERROR);
+}
+END_TEST
+
+/*
  * Test case creation function
  */
 TCase *
@@ -96,6 +117,7 @@
   TCase *tc = tcase_create("pdf_i64_abs");
   tcase_add_test(tc, pdf_i64_abs_001);
   tcase_add_test(tc, pdf_i64_abs_002);
+  tcase_add_test(tc, pdf_i64_abs_003);
   return tc;
 }
 

=== modified file 'torture/unit/base/types/pdf-i64-mod.c'
--- torture/unit/base/types/pdf-i64-mod.c	2008-07-18 07:45:04 +0000
+++ torture/unit/base/types/pdf-i64-mod.c	2009-06-14 01:42:13 +0000
@@ -158,7 +158,28 @@
 }
 END_TEST
 
-
+/*
+ * Test: pdf_i64_neg_005
+ * Description:
+ *   Checks if an invalid destination correctly throws an error
+ * Success conditions:
+ * The call should return PDF_ERROR
+ */
+START_TEST(pdf_i64_mod_005)
+{
+  pdf_status_t p_status = PDF_OK;
+  pdf_i64_t mod1, mod2;
+  pdf_i64_t *dest = NULL;
+
+  pdf_i64_assign(&mod1,0, 5, &p_status);
+  fail_if(p_status != PDF_OK);
+  pdf_i64_assign(&mod2,0, 2, &p_status);
+  fail_if(p_status != PDF_OK);
+
+  pdf_i64_mod(dest, mod1, mod2, &p_status);
+  fail_unless(p_status == PDF_ERROR);
+}
+END_TEST
 
 /*
  * Test case creation function
@@ -171,6 +192,7 @@
   tcase_add_test(tc, pdf_i64_mod_002);
   tcase_add_test(tc, pdf_i64_mod_003);
   tcase_add_test(tc, pdf_i64_mod_004);
+  tcase_add_test(tc, pdf_i64_mod_005);
   return tc;
 }
 

=== modified file 'torture/unit/base/types/pdf-i64-neg.c'
--- torture/unit/base/types/pdf-i64-neg.c	2008-07-09 14:03:51 +0000
+++ torture/unit/base/types/pdf-i64-neg.c	2009-06-14 01:22:29 +0000
@@ -97,7 +97,26 @@
 END_TEST
 
 
-
+/*
+ * Test: pdf_i64_neg_003
+ * Description:
+ *   Checks if an invalid destination correctly throws an error
+ * Success conditions:
+ * The call should return PDF_ERROR
+ */
+START_TEST(pdf_i64_neg_003)
+{
+  pdf_status_t p_status = PDF_OK;
+  pdf_i64_t src;
+  pdf_i64_t *dest = NULL;
+
+  pdf_i64_assign(&src,0, 3, &p_status);
+  fail_if(p_status != PDF_OK);
+
+  pdf_i64_neg(dest, src , &p_status);
+  fail_unless(p_status == PDF_ERROR);
+}
+END_TEST
 
 
 
@@ -112,6 +131,7 @@
   TCase *tc = tcase_create("pdf_i64_neg");
   tcase_add_test(tc, pdf_i64_neg_001);
   tcase_add_test(tc, pdf_i64_neg_002);
+  tcase_add_test(tc, pdf_i64_neg_003);
   return tc;
 }
 

Reply via email to