testsample_mock_run1.c 1.8 KB
Newer Older
1 2
/* AUTOGENERATED FILE. DO NOT EDIT. */

3
/*=======Test Runner Used To Run Each Test Below=====*/
4 5 6 7 8
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
  Unity.CurrentTestName = #TestFunc; \
  Unity.CurrentTestLineNumber = TestLineNum; \
  Unity.NumberOfTests++; \
9
  CMock_Init(); \
10
  UNITY_CLR_DETAILS(); \
11 12 13 14 15 16 17 18 19 20 21
  if (TEST_PROTECT()) \
  { \
    CEXCEPTION_T e; \
    Try { \
      setUp(); \
      TestFunc(); \
    } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
  } \
  if (TEST_PROTECT() && !TEST_IS_IGNORED) \
  { \
    tearDown(); \
22
    CMock_Verify(); \
23
  } \
24
  CMock_Destroy(); \
25 26 27
  UnityConcludeTest(); \
}

28
/*=======Automagically Detected Files To Include=====*/
29 30 31 32 33
#include "unity.h"
#include "cmock.h"
#include <setjmp.h>
#include <stdio.h>
#include "CException.h"
34 35
#include "one.h"
#include "two.h"
36 37 38 39 40 41 42 43
#include "funky.h"
#include <setjmp.h>
#include "Mockstanky.h"

int GlobalExpectCount;
int GlobalVerifyOrder;
char* GlobalOrderError;

44
/*=======External Functions This Runner Calls=====*/
45 46 47 48 49 50
extern void setUp(void);
extern void tearDown(void);
extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void);


51
/*=======Mock Management=====*/
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
static void CMock_Init(void)
{
  GlobalExpectCount = 0;
  GlobalVerifyOrder = 0;
  GlobalOrderError = NULL;
  Mockstanky_Init();
}
static void CMock_Verify(void)
{
  Mockstanky_Verify();
}
static void CMock_Destroy(void)
{
  Mockstanky_Destroy();
}

68
/*=======Test Reset Option=====*/
G
Greg Williams 已提交
69 70
void resetTest(void);
void resetTest(void)
71 72 73 74 75 76 77 78 79
{
  CMock_Verify();
  CMock_Destroy();
  tearDown();
  CMock_Init();
  setUp();
}


80
/*=======MAIN=====*/
81 82
int main(void)
{
83
  UnityBegin("testdata/mocksample.c");
84 85 86
  RUN_TEST(test_TheFirstThingToTest, 21);
  RUN_TEST(test_TheSecondThingToTest, 43);

87
  CMock_Guts_MemFreeFinal();
88 89
  return (UnityEnd());
}