| 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 |
|
| 17 |
/* Include Passthroughs for Linking Tests */ |
| 18 |
void putcharSpy(int c) { (void)putchar(c);} |
| 19 |
void flushSpy(void) {} |
| 20 |
|
| 21 |
/* Global Variables Used During These Tests */ |
| 22 |
int CounterSetup = 0; |
| 23 |
int CounterTeardown = 0; |
| 24 |
int CounterSuiteSetup = 0; |
| 25 |
|
| 26 |
void setUp(void) |
| 27 |
{ |
| 28 |
CounterSetup = 1; |
| 29 |
} |
| 30 |
|
| 31 |
void tearDown(void) |
| 32 |
{ |
| 33 |
CounterTeardown = 1; |
| 34 |
} |
| 35 |
|
| 36 |
void custom_setup(void) |
| 37 |
{ |
| 38 |
CounterSetup = 2; |
| 39 |
} |
| 40 |
|
| 41 |
void custom_teardown(void) |
| 42 |
{ |
| 43 |
CounterTeardown = 2; |
| 44 |
} |
| 45 |
|
| 46 |
void test_ThisTestAlwaysPasses(void) |
| 47 |
{ |
| 48 |
TEST_PASS(); |
| 49 |
} |
| 50 |
|
| 51 |
void test_ThisTestAlwaysFails(void) |
| 52 |
{ |
| 53 |
TEST_FAIL_MESSAGE("This Test Should Fail"); |
| 54 |
} |
| 55 |
|
| 56 |
void test_ThisTestAlwaysIgnored(void) |
| 57 |
{ |
| 58 |
TEST_IGNORE_MESSAGE("This Test Should Be Ignored"); |
| 59 |
} |
| 60 |
|
| 61 |
void spec_ThisTestPassesWhenNormalSetupRan(void) |
| 62 |
{ |
| 63 |
TEST_ASSERT_EQUAL_MESSAGE(1, CounterSetup, "Normal Setup Wasn't Run"); |
| 64 |
} |
| 65 |
|
| 66 |
void spec_ThisTestPassesWhenNormalTeardownRan(void) |
| 67 |
{ |
| 68 |
TEST_ASSERT_EQUAL_MESSAGE(1, CounterTeardown, "Normal Teardown Wasn't Run"); |
| 69 |
} |
| 70 |
|