"Fossies" - the Fresh Open Source Software Archive

Member "check-0.13.0/tests/check_check_limit.c" (22 Oct 2019, 1657 Bytes) of package /linux/privat/check-0.13.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "check_check_limit.c": 0.10.0_vs_0.11.0.

    1 /*
    2  * Check: a unit test framework for C
    3  * Copyright (C) 2001, 2002 Arien Malec
    4  *
    5  * This library is free software; you can redistribute it and/or
    6  * modify it under the terms of the GNU Lesser General Public
    7  * License as published by the Free Software Foundation; either
    8  * version 2.1 of the License, or (at your option) any later version.
    9  *
   10  * This library is distributed in the hope that it will be useful,
   11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13  * Lesser General Public License for more details.
   14  *
   15  * You should have received a copy of the GNU Lesser General Public
   16  * License along with this library; if not, write to the
   17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
   18  * MA 02110-1301, USA.
   19  */
   20 
   21 #include "../lib/libcompat.h"
   22 
   23 #include <stdlib.h>
   24 #include <string.h>
   25 #include <check.h>
   26 #include "check_check.h"
   27 #include "check_str.h"
   28 
   29 
   30 static SRunner *sr;
   31 
   32 static void limit_setup (void)
   33 {
   34   Suite *s = suite_create("Empty");
   35   sr = srunner_create(s);
   36   srunner_run_all(sr, CK_VERBOSE);
   37 }
   38 
   39 static void limit_teardown (void)
   40 {
   41   srunner_free(sr);
   42 } 
   43 
   44 START_TEST(test_summary)
   45 {
   46   char * string = sr_stat_str(sr);
   47   ck_assert_msg(strcmp(string,
   48              "100%: Checks: 0, Failures: 0, Errors: 0") == 0,
   49           "Bad statistics string for empty suite");
   50   free(string);
   51 }
   52 END_TEST
   53 
   54 Suite *make_limit_suite (void)
   55 {
   56   Suite *s = suite_create("Limit");
   57   TCase *tc = tcase_create("Empty");
   58 
   59   tcase_add_test(tc,test_summary);
   60   tcase_add_unchecked_fixture(tc,limit_setup,limit_teardown);
   61   
   62   suite_add_tcase(s, tc);
   63 
   64   return s;
   65 }