testRunnerGeneratorSmall.c 1.3 KB

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