cJSON
[Ported from github.com/DaveGamble/cJSON] Fix: heap-use-after-free in merge_patch when patch is subtree of target (#1065)
Brought by drakestapleton
cJSON / tests / unity / test / testdata / testRunnerGeneratorSmall.c
| 1 | /* This Test File Is Used To Verify Many Combinations Of Using the Generate Test Runner Script */ |
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include "unity.h" |
| 5 | #include "Defs.h" |
| 6 | |
| 7 | TEST_FILE("some_file.c") |
| 8 | |
| 9 | /* Notes about prefixes: |
| 10 | test - normal default prefix. these are "always run" tests for this procedure |
| 11 | spec - normal default prefix. required to run default setup/teardown calls. |
| 12 | */ |
| 13 | |
| 14 | /* Support for Meta Test Rig */ |
| 15 | #define TEST_CASE(a) |
| 16 | void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests |
| 17 | |
| 18 | /* Global Variables Used During These Tests */ |
| 19 | int CounterSetup = 0; |
| 20 | int CounterTeardown = 0; |
| 21 | int CounterSuiteSetup = 0; |
| 22 | |
| 23 | void setUp(void) |
| 24 | { |
| 25 | CounterSetup = 1; |
| 26 | } |
| 27 | |
| 28 | void tearDown(void) |
| 29 | { |
| 30 | CounterTeardown = 1; |
| 31 | } |
| 32 | |
| 33 | void custom_setup(void) |
| 34 | { |
| 35 | CounterSetup = 2; |
| 36 | } |
| 37 | |
| 38 | void custom_teardown(void) |
| 39 | { |
| 40 | CounterTeardown = 2; |
| 41 | } |
| 42 | |
| 43 | void test_ThisTestAlwaysPasses(void) |
| 44 | { |
| 45 | TEST_PASS(); |
| 46 | } |
| 47 | |
| 48 | void test_ThisTestAlwaysFails(void) |
| 49 | { |
| 50 | TEST_FAIL_MESSAGE("This Test Should Fail"); |
| 51 | } |
| 52 | |
| 53 | void test_ThisTestAlwaysIgnored(void) |
| 54 | { |
| 55 | TEST_IGNORE_MESSAGE("This Test Should Be Ignored"); |
| 56 | } |
| 57 | |
| 58 | void spec_ThisTestPassesWhenNormalSetupRan(void) |
| 59 | { |
| 60 | TEST_ASSERT_EQUAL_MESSAGE(1, CounterSetup, "Normal Setup Wasn't Run"); |
| 61 | } |
| 62 | |
| 63 | void spec_ThisTestPassesWhenNormalTeardownRan(void) |
| 64 | { |
| 65 | TEST_ASSERT_EQUAL_MESSAGE(1, CounterTeardown, "Normal Teardown Wasn't Run"); |
| 66 | } |
| 67 |