testRunnerGeneratorSmall.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* This Test File Is Used To Verify Many Combinations Of Using the Generate Test Runner Script */
  2. #include <stdio.h>
  3. #include "unity.h"
  4. #include "Defs.h"
  5. TEST_FILE("some_file.c")
  6. /* Notes about prefixes:
  7. test - normal default prefix. these are "always run" tests for this procedure
  8. spec - normal default prefix. required to run default setup/teardown calls.
  9. */
  10. /* Support for Meta Test Rig */
  11. #define TEST_CASE(a)
  12. void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests
  13. /* Global Variables Used During These Tests */
  14. int CounterSetup = 0;
  15. int CounterTeardown = 0;
  16. int CounterSuiteSetup = 0;
  17. void setUp(void)
  18. {
  19. CounterSetup = 1;
  20. }
  21. void tearDown(void)
  22. {
  23. CounterTeardown = 1;
  24. }
  25. void custom_setup(void)
  26. {
  27. CounterSetup = 2;
  28. }
  29. void custom_teardown(void)
  30. {
  31. CounterTeardown = 2;
  32. }
  33. void test_ThisTestAlwaysPasses(void)
  34. {
  35. TEST_PASS();
  36. }
  37. void test_ThisTestAlwaysFails(void)
  38. {
  39. TEST_FAIL_MESSAGE("This Test Should Fail");
  40. }
  41. void test_ThisTestAlwaysIgnored(void)
  42. {
  43. TEST_IGNORE_MESSAGE("This Test Should Be Ignored");
  44. }
  45. void spec_ThisTestPassesWhenNormalSetupRan(void)
  46. {
  47. TEST_ASSERT_EQUAL_MESSAGE(1, CounterSetup, "Normal Setup Wasn't Run");
  48. }
  49. void spec_ThisTestPassesWhenNormalTeardownRan(void)
  50. {
  51. TEST_ASSERT_EQUAL_MESSAGE(1, CounterTeardown, "Normal Teardown Wasn't Run");
  52. }