提交 962ce941 编写于 作者: M mvandervoord

- caught up runner generator script tests

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@105 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 780c17d0
...@@ -32,7 +32,7 @@ task :summary do ...@@ -32,7 +32,7 @@ task :summary do
end end
desc "Build and test Unity" desc "Build and test Unity"
task :all => [:clean, :unit, :summary] task :all => [:clean, :scripts, :unit, :summary]
task :default => [:clobber, :all] task :default => [:clobber, :all]
task :ci => [:no_color, :default] task :ci => [:no_color, :default]
task :cruise => [:no_color, :default] task :cruise => [:no_color, :default]
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
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(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
#include "CException.h" #include "CException.h"
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CEXCEPTION_T e;
Try {
setUp();
test();
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); }
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
tearDown(); tearDown();
...@@ -34,12 +42,11 @@ void resetTest() ...@@ -34,12 +42,11 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
Unity.TestFile = "test/testdata/testsample.c"; Unity.TestFile = "test/testdata/testsample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
setUp(); \
TestFunc(); \
} \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
setUp();
test();
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
tearDown(); tearDown();
...@@ -30,12 +38,11 @@ void resetTest() ...@@ -30,12 +38,11 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
Unity.TestFile = "test/testdata/testsample.c"; Unity.TestFile = "test/testdata/testsample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
CEXCEPTION_T e; \
Try { \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "cmock.h" #include "cmock.h"
#include <setjmp.h> #include <setjmp.h>
...@@ -6,14 +32,14 @@ ...@@ -6,14 +32,14 @@
#include "CException.h" #include "CException.h"
#include "Mockstanky.h" #include "Mockstanky.h"
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Mock Management=====
static void CMock_Init(void) static void CMock_Init(void)
{ {
Mockstanky_Init(); Mockstanky_Init();
...@@ -26,24 +52,8 @@ static void CMock_Destroy(void) ...@@ -26,24 +52,8 @@ static void CMock_Destroy(void)
{ {
Mockstanky_Destroy(); Mockstanky_Destroy();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CEXCEPTION_T e;
Try {
CMock_Init();
setUp();
test();
CMock_Verify();
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); }
}
CMock_Destroy();
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
CMock_Verify(); CMock_Verify();
...@@ -54,12 +64,11 @@ void resetTest() ...@@ -54,12 +64,11 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
Unity.TestFile = "test/testdata/mocksample.c"; Unity.TestFile = "test/testdata/mocksample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "cmock.h" #include "cmock.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
#include "Mockstanky.h" #include "Mockstanky.h"
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Mock Management=====
static void CMock_Init(void) static void CMock_Init(void)
{ {
Mockstanky_Init(); Mockstanky_Init();
...@@ -25,21 +48,8 @@ static void CMock_Destroy(void) ...@@ -25,21 +48,8 @@ static void CMock_Destroy(void)
{ {
Mockstanky_Destroy(); Mockstanky_Destroy();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CMock_Init();
setUp();
test();
CMock_Verify();
}
CMock_Destroy();
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
CMock_Verify(); CMock_Verify();
...@@ -50,12 +60,11 @@ void resetTest() ...@@ -50,12 +60,11 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
Unity.TestFile = "test/testdata/mocksample.c"; Unity.TestFile = "test/testdata/mocksample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
CEXCEPTION_T e; \
Try { \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "cmock.h" #include "cmock.h"
#include "one.h" #include "one.h"
...@@ -8,17 +34,18 @@ ...@@ -8,17 +34,18 @@
#include "CException.h" #include "CException.h"
#include "Mockstanky.h" #include "Mockstanky.h"
char MessageBuffer[50];
int GlobalExpectCount; int GlobalExpectCount;
int GlobalVerifyOrder; int GlobalVerifyOrder;
char* GlobalOrderError; char* GlobalOrderError;
//=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Mock Management=====
static void CMock_Init(void) static void CMock_Init(void)
{ {
GlobalExpectCount = 0; GlobalExpectCount = 0;
...@@ -34,24 +61,8 @@ static void CMock_Destroy(void) ...@@ -34,24 +61,8 @@ static void CMock_Destroy(void)
{ {
Mockstanky_Destroy(); Mockstanky_Destroy();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CEXCEPTION_T e;
Try {
CMock_Init();
setUp();
test();
CMock_Verify();
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); }
}
CMock_Destroy();
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
CMock_Verify(); CMock_Verify();
...@@ -62,12 +73,11 @@ void resetTest() ...@@ -62,12 +73,11 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
Unity.TestFile = "test/testdata/mocksample.c"; Unity.TestFile = "test/testdata/mocksample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "cmock.h" #include "cmock.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
#include "Mockstanky.h" #include "Mockstanky.h"
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Mock Management=====
static void CMock_Init(void) static void CMock_Init(void)
{ {
Mockstanky_Init(); Mockstanky_Init();
...@@ -25,29 +48,20 @@ static void CMock_Destroy(void) ...@@ -25,29 +48,20 @@ static void CMock_Destroy(void)
{ {
Mockstanky_Destroy(); Mockstanky_Destroy();
} }
//=======Suite Setup=====
static int suite_setup(void) static int suite_setup(void)
{ {
a_custom_setup(); a_custom_setup();
} }
//=======Suite Teardown=====
static int suite_teardown(int num_failures) static int suite_teardown(int num_failures)
{ {
a_custom_teardown(); a_custom_teardown();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CMock_Init();
setUp();
test();
CMock_Verify();
}
CMock_Destroy();
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
CMock_Verify(); CMock_Verify();
...@@ -58,13 +72,12 @@ void resetTest() ...@@ -58,13 +72,12 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
suite_setup(); suite_setup();
Unity.TestFile = "test/testdata/mocksample.c"; Unity.TestFile = "test/testdata/mocksample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum, ...) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(__VA_ARGS__); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h"
#include "cmock.h"
#include <setjmp.h>
#include <stdio.h>
#include "Mockstanky.h"
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void);
//=======Mock Management=====
static void CMock_Init(void)
{
Mockstanky_Init();
}
static void CMock_Verify(void)
{
Mockstanky_Verify();
}
static void CMock_Destroy(void)
{
Mockstanky_Destroy();
}
//=======Test Reset Option=====
void resetTest()
{
CMock_Verify();
CMock_Destroy();
tearDown();
CMock_Init();
setUp();
}
//=======MAIN=====
int main(void)
{
Unity.TestFile = "test/testdata/mocksample.c";
UnityBegin();
RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43);
return (UnityEnd());
}
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
CEXCEPTION_T e; \
Try { \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "cmock.h" #include "cmock.h"
#include "one.h" #include "one.h"
...@@ -8,17 +34,18 @@ ...@@ -8,17 +34,18 @@
#include "CException.h" #include "CException.h"
#include "Mockstanky.h" #include "Mockstanky.h"
char MessageBuffer[50];
int GlobalExpectCount; int GlobalExpectCount;
int GlobalVerifyOrder; int GlobalVerifyOrder;
char* GlobalOrderError; char* GlobalOrderError;
//=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Mock Management=====
static void CMock_Init(void) static void CMock_Init(void)
{ {
GlobalExpectCount = 0; GlobalExpectCount = 0;
...@@ -34,24 +61,8 @@ static void CMock_Destroy(void) ...@@ -34,24 +61,8 @@ static void CMock_Destroy(void)
{ {
Mockstanky_Destroy(); Mockstanky_Destroy();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CEXCEPTION_T e;
Try {
CMock_Init();
setUp();
test();
CMock_Verify();
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); }
}
CMock_Destroy();
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
CMock_Verify(); CMock_Verify();
...@@ -62,12 +73,11 @@ void resetTest() ...@@ -62,12 +73,11 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
Unity.TestFile = "test/testdata/mocksample.c"; Unity.TestFile = "test/testdata/mocksample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "cmock.h" #include "cmock.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
#include "Mockstanky.h" #include "Mockstanky.h"
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Mock Management=====
static void CMock_Init(void) static void CMock_Init(void)
{ {
Mockstanky_Init(); Mockstanky_Init();
...@@ -25,29 +48,20 @@ static void CMock_Destroy(void) ...@@ -25,29 +48,20 @@ static void CMock_Destroy(void)
{ {
Mockstanky_Destroy(); Mockstanky_Destroy();
} }
//=======Suite Setup=====
static int suite_setup(void) static int suite_setup(void)
{ {
a_custom_setup(); a_custom_setup();
} }
//=======Suite Teardown=====
static int suite_teardown(int num_failures) static int suite_teardown(int num_failures)
{ {
a_custom_teardown(); a_custom_teardown();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CMock_Init();
setUp();
test();
CMock_Verify();
}
CMock_Destroy();
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
CMock_Verify(); CMock_Verify();
...@@ -58,13 +72,12 @@ void resetTest() ...@@ -58,13 +72,12 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
suite_setup(); suite_setup();
Unity.TestFile = "test/testdata/mocksample.c"; Unity.TestFile = "test/testdata/mocksample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "cmock.h" #include "cmock.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
#include "Mockstanky.h" #include "Mockstanky.h"
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Mock Management=====
static void CMock_Init(void) static void CMock_Init(void)
{ {
Mockstanky_Init(); Mockstanky_Init();
...@@ -25,25 +48,14 @@ static void CMock_Destroy(void) ...@@ -25,25 +48,14 @@ static void CMock_Destroy(void)
{ {
Mockstanky_Destroy(); Mockstanky_Destroy();
} }
//=======Suite Setup=====
static int suite_setup(void) static int suite_setup(void)
{ {
a_yaml_setup(); a_yaml_setup();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CMock_Init();
setUp();
test();
CMock_Verify();
}
CMock_Destroy();
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
CMock_Verify(); CMock_Verify();
...@@ -54,13 +66,12 @@ void resetTest() ...@@ -54,13 +66,12 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
suite_setup(); suite_setup();
Unity.TestFile = "test/testdata/mocksample.c"; Unity.TestFile = "test/testdata/mocksample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
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(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "one.h" #include "one.h"
#include "two.h" #include "two.h"
...@@ -6,32 +29,18 @@ ...@@ -6,32 +29,18 @@
#include <stdio.h> #include <stdio.h>
#include "CException.h" #include "CException.h"
char MessageBuffer[50];
int GlobalExpectCount; int GlobalExpectCount;
int GlobalVerifyOrder; int GlobalVerifyOrder;
char* GlobalOrderError; char* GlobalOrderError;
//=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CEXCEPTION_T e;
Try {
setUp();
test();
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); }
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
tearDown(); tearDown();
...@@ -39,12 +48,11 @@ void resetTest() ...@@ -39,12 +48,11 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
Unity.TestFile = "test/testdata/testsample.c"; Unity.TestFile = "test/testdata/testsample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
setUp(); \
TestFunc(); \
} \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Suite Setup=====
static int suite_setup(void) static int suite_setup(void)
{ {
a_custom_setup(); a_custom_setup();
} }
//=======Suite Teardown=====
static int suite_teardown(int num_failures) static int suite_teardown(int num_failures)
{ {
a_custom_teardown(); a_custom_teardown();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
setUp();
test();
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
tearDown(); tearDown();
...@@ -38,13 +50,12 @@ void resetTest() ...@@ -38,13 +50,12 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
suite_setup(); suite_setup();
Unity.TestFile = "test/testdata/testsample.c"; Unity.TestFile = "test/testdata/testsample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum, ...) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
setUp(); \
TestFunc(__VA_ARGS__); \
} \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h"
#include <setjmp.h>
#include <stdio.h>
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void);
//=======Test Reset Option=====
void resetTest()
{
tearDown();
setUp();
}
//=======MAIN=====
int main(void)
{
Unity.TestFile = "test/testdata/testsample.c";
UnityBegin();
RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43);
return (UnityEnd());
}
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
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(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include "one.h" #include "one.h"
#include "two.h" #include "two.h"
...@@ -6,32 +29,18 @@ ...@@ -6,32 +29,18 @@
#include <stdio.h> #include <stdio.h>
#include "CException.h" #include "CException.h"
char MessageBuffer[50];
int GlobalExpectCount; int GlobalExpectCount;
int GlobalVerifyOrder; int GlobalVerifyOrder;
char* GlobalOrderError; char* GlobalOrderError;
//=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
CEXCEPTION_T e;
Try {
setUp();
test();
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); }
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
tearDown(); tearDown();
...@@ -39,12 +48,11 @@ void resetTest() ...@@ -39,12 +48,11 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
Unity.TestFile = "test/testdata/testsample.c"; Unity.TestFile = "test/testdata/testsample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
setUp(); \
TestFunc(); \
} \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Suite Setup=====
static int suite_setup(void) static int suite_setup(void)
{ {
a_custom_setup(); a_custom_setup();
} }
//=======Suite Teardown=====
static int suite_teardown(int num_failures) static int suite_teardown(int num_failures)
{ {
a_custom_teardown(); a_custom_teardown();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
setUp();
test();
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
tearDown(); tearDown();
...@@ -38,13 +50,12 @@ void resetTest() ...@@ -38,13 +50,12 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
suite_setup(); suite_setup();
Unity.TestFile = "test/testdata/testsample.c"; Unity.TestFile = "test/testdata/testsample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
/* AUTOGENERATED FILE. DO NOT EDIT. */ /* AUTOGENERATED FILE. DO NOT EDIT. */
//=======Test Runner Used To Run Each Test Below=====
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
setUp(); \
TestFunc(); \
} \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
//=======Automagically Detected Files To Include=====
#include "unity.h" #include "unity.h"
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
char MessageBuffer[50]; //=======External Functions This Runner Calls=====
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_TheFirstThingToTest(void); extern void test_TheFirstThingToTest(void);
extern void test_TheSecondThingToTest(void); extern void test_TheSecondThingToTest(void);
//=======Suite Setup=====
static int suite_setup(void) static int suite_setup(void)
{ {
a_yaml_setup(); a_yaml_setup();
} }
static void runTest(UnityTestFunction test)
{ //=======Test Reset Option=====
if (TEST_PROTECT())
{
setUp();
test();
}
if (TEST_PROTECT() && !TEST_IS_IGNORED)
{
tearDown();
}
}
void resetTest() void resetTest()
{ {
tearDown(); tearDown();
...@@ -34,13 +44,12 @@ void resetTest() ...@@ -34,13 +44,12 @@ void resetTest()
} }
//=======MAIN=====
int main(void) int main(void)
{ {
suite_setup(); suite_setup();
Unity.TestFile = "test/testdata/testsample.c"; Unity.TestFile = "test/testdata/testsample.c";
UnityBegin(); UnityBegin();
// RUN_TEST calls runTest
RUN_TEST(test_TheFirstThingToTest, 21); RUN_TEST(test_TheFirstThingToTest, 21);
RUN_TEST(test_TheSecondThingToTest, 43); RUN_TEST(test_TheSecondThingToTest, 43);
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
ruby_version = RUBY_VERSION.split('.') ruby_version = RUBY_VERSION.split('.')
if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1) if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1)
require 'gems' require 'rubygems'
gem 'test-unit' gem 'test-unit'
end end
require 'test/unit' require 'test/unit'
require 'auto/generate_test_runner.rb' require './auto/generate_test_runner.rb'
TEST_FILE = 'test/testdata/testsample.c' TEST_FILE = 'test/testdata/testsample.c'
TEST_MOCK = 'test/testdata/mocksample.c' TEST_MOCK = 'test/testdata/mocksample.c'
...@@ -79,4 +79,16 @@ class TestGenerateTestRunner < Test::Unit::TestCase ...@@ -79,4 +79,16 @@ class TestGenerateTestRunner < Test::Unit::TestCase
verify_output_equal('mock_' + subtest) verify_output_equal('mock_' + subtest)
end end
def test_ShouldGenerateARunnerThatUsesParameterizedTests
sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true }
}
sets.each_pair do |subtest, options|
UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c')
verify_output_equal(subtest)
UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c')
verify_output_equal('mock_' + subtest)
end
end
end end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册