]> granicus.if.org Git - check/commitdiff
* count checks in setup() as well; patch due to Roland Stigge
authorcpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 3 Mar 2008 13:48:38 +0000 (13:48 +0000)
committercpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 3 Mar 2008 13:48:38 +0000 (13:48 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@420 64e312b2-a51f-0410-8e61-82d0ca0eb02a

AUTHORS
src/check_run.c
tests/check_check_fixture.c

diff --git a/AUTHORS b/AUTHORS
index 71f4ba6e0b2efff17c0638bc52e5b4b103454ac6..d24580e90749552663756e0f2caf697c3c54dfa2 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -14,6 +14,7 @@ Patches:         Bernhard Reiter (configure issues)
                  Robert Lemmen (gcov description in manual)
                 Loic Martin (AM_PATH_CHECK patch)
                 Ross Burton (pkg-config patch)
+                Roland Stigge (bug fix)
 
 Anybody who has contributed code to Check or Check's build system is
 considered an author.  Send patches to this file to 
index a5b040a7b25fe8ad672cebf92fefbf279029c383..ec8c6255ed5a948999f6d7081b4d2bbb013c8374 100644 (file)
@@ -164,9 +164,7 @@ void srunner_run_all (SRunner *sr, enum print_output print_mode)
 static void srunner_add_failure (SRunner *sr, TestResult *tr)
 {  
   list_add_end (sr->resultlst, tr);
-  /* If the context is either of these, the test has run. */
-  if ((tr->ctx == CK_CTX_TEST) || (tr->ctx == CK_CTX_TEARDOWN))
-    sr->stats->n_checked++;
+  sr->stats->n_checked++; /* count checks during setup, test, and teardown */
   if (tr->rtype == CK_FAILURE)
     sr->stats->n_failed++;
   else if (tr->rtype == CK_ERROR)
index 23175d84e378e0edf4550884a15d749b64f5b122..8c7bb1283fe845720cb80928552421c4e8a57dae 100644 (file)
@@ -41,7 +41,7 @@ START_TEST(test_fixture_fail_counts)
   nrun = srunner_ntests_run(fixture_sr);
   nfail = srunner_ntests_failed(fixture_sr);
 
-  fail_unless (nrun == 0 && nfail == 1,
+  fail_unless (nrun == 1 && nfail == 1,
               "Counts for run and fail for fixture failure not correct");
 }
 END_TEST
@@ -49,7 +49,7 @@ END_TEST
 START_TEST(test_print_counts)
 {
   char *srstat = sr_stat_str(fixture_sr);
-  const char *exp = "0%: Checks: 0, Failures: 1, Errors: 0";
+  const char *exp = "0%: Checks: 1, Failures: 1, Errors: 0";
 
   fail_unless(strcmp(srstat, exp) == 0,
              "SRunner stat string incorrect with setup failure");
@@ -172,7 +172,7 @@ START_TEST(test_ch_setup_fail)
   sr = srunner_create(s);
   srunner_run_all(sr,CK_VERBOSE);
 
-  fail_unless (srunner_ntests_run(sr) == 0,
+  fail_unless (srunner_ntests_run(sr) == 1,
               "Test run counts not correct for checked setup failure");
   fail_unless (srunner_ntests_failed(sr) == 1,
               "Failure counts not correct for checked setup failure");
@@ -180,7 +180,7 @@ START_TEST(test_ch_setup_fail)
   strstat= sr_stat_str(sr);
 
   fail_unless(strcmp(strstat,
-                    "0%: Checks: 0, Failures: 1, Errors: 0") == 0,
+                    "0%: Checks: 1, Failures: 1, Errors: 0") == 0,
              "SRunner stat string incorrect with checked setup failure");
 
 
@@ -212,7 +212,7 @@ START_TEST(test_ch_setup_fail_nofork)
   srunner_set_fork_status(sr, CK_NOFORK);
   srunner_run_all(sr, CK_VERBOSE);
 
-  fail_unless (srunner_ntests_run(sr) == 0,
+  fail_unless (srunner_ntests_run(sr) == 1,
               "Test run counts not correct for checked setup failure");
   fail_unless (srunner_ntests_failed(sr) == 1,
               "Failure counts not correct for checked setup failure");
@@ -235,7 +235,7 @@ START_TEST(test_ch_setup_fail_nofork_2)
   srunner_set_fork_status(sr, CK_NOFORK);
   srunner_run_all(sr, CK_VERBOSE);
 
-  fail_unless (srunner_ntests_run(sr) == 0,
+  fail_unless (srunner_ntests_run(sr) == 1,
               "Test run counts not correct for checked setup failure");
   fail_unless (srunner_ntests_failed(sr) == 1,
               "Failure counts not correct for checked setup failure");
@@ -288,13 +288,13 @@ START_TEST(test_ch_setup_sig)
 
   fail_unless (srunner_ntests_failed(sr) == 1,
               "Failure counts not correct for checked setup signal");
-  fail_unless (srunner_ntests_run(sr) == 0,
+  fail_unless (srunner_ntests_run(sr) == 1,
               "Test run counts not correct for checked setup signal");
 
   strstat= sr_stat_str(sr);
 
   fail_unless(strcmp(strstat,
-                    "0%: Checks: 0, Failures: 0, Errors: 1") == 0,
+                    "0%: Checks: 1, Failures: 0, Errors: 1") == 0,
              "SRunner stat string incorrect with checked setup signal");