check_check_limit.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include "../lib/libcompat.h"
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <check.h>
  24. #include "check_check.h"
  25. #include "check_str.h"
  26. static SRunner *sr;
  27. static void limit_setup (void)
  28. {
  29. Suite *s = suite_create("Empty");
  30. sr = srunner_create(s);
  31. srunner_run_all(sr, CK_VERBOSE);
  32. }
  33. static void limit_teardown (void)
  34. {
  35. srunner_free(sr);
  36. }
  37. START_TEST(test_summary)
  38. {
  39. char * string = sr_stat_str(sr);
  40. ck_assert_msg(strcmp(string,
  41. "100%: Checks: 0, Failures: 0, Errors: 0") == 0,
  42. "Bad statistics string for empty suite");
  43. free(string);
  44. }
  45. END_TEST
  46. Suite *make_limit_suite (void)
  47. {
  48. Suite *s = suite_create("Limit");
  49. TCase *tc = tcase_create("Empty");
  50. tcase_add_test(tc,test_summary);
  51. tcase_add_unchecked_fixture(tc,limit_setup,limit_teardown);
  52. suite_add_tcase(s, tc);
  53. return s;
  54. }