summaryrefslogtreecommitdiff
path: root/lab_6/unity/test
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-26 10:24:00 -0800
committerFuwn <[email protected]>2026-02-26 10:31:15 -0800
commita14f361a60f55299e0057c419cc59e5194a77854 (patch)
treeedf54089f5849ee4dfdac48bd04bd8c271cfb62a /lab_6/unity/test
parentfeat(homework_2): Add implementation (diff)
downloadcst456-a14f361a60f55299e0057c419cc59e5194a77854.tar.xz
cst456-a14f361a60f55299e0057c419cc59e5194a77854.zip
feat(lab_6): Add initial files
Diffstat (limited to 'lab_6/unity/test')
-rw-r--r--lab_6/unity/test/expectdata/testsample_cmd.c57
-rw-r--r--lab_6/unity/test/expectdata/testsample_def.c53
-rw-r--r--lab_6/unity/test/expectdata/testsample_mock_cmd.c79
-rw-r--r--lab_6/unity/test/expectdata/testsample_mock_def.c75
-rw-r--r--lab_6/unity/test/expectdata/testsample_mock_new1.c88
-rw-r--r--lab_6/unity/test/expectdata/testsample_mock_new2.c88
-rw-r--r--lab_6/unity/test/expectdata/testsample_mock_param.c76
-rw-r--r--lab_6/unity/test/expectdata/testsample_mock_run1.c88
-rw-r--r--lab_6/unity/test/expectdata/testsample_mock_run2.c88
-rw-r--r--lab_6/unity/test/expectdata/testsample_mock_yaml.c89
-rw-r--r--lab_6/unity/test/expectdata/testsample_new1.c63
-rw-r--r--lab_6/unity/test/expectdata/testsample_new2.c66
-rw-r--r--lab_6/unity/test/expectdata/testsample_param.c54
-rw-r--r--lab_6/unity/test/expectdata/testsample_run1.c63
-rw-r--r--lab_6/unity/test/expectdata/testsample_run2.c66
-rw-r--r--lab_6/unity/test/expectdata/testsample_yaml.c67
-rw-r--r--lab_6/unity/test/rakefile60
-rw-r--r--lab_6/unity/test/rakefile_helper.rb249
-rw-r--r--lab_6/unity/test/targets/clang_strict.yml83
-rw-r--r--lab_6/unity/test/targets/gcc_32.yml49
-rw-r--r--lab_6/unity/test/targets/gcc_64.yml50
-rw-r--r--lab_6/unity/test/targets/gcc_auto_limits.yml46
-rw-r--r--lab_6/unity/test/targets/gcc_auto_sizeof.yml47
-rw-r--r--lab_6/unity/test/targets/gcc_auto_stdint.yml61
-rw-r--r--lab_6/unity/test/targets/hitech_picc18.yml101
-rw-r--r--lab_6/unity/test/targets/iar_arm_v4.yml89
-rw-r--r--lab_6/unity/test/targets/iar_arm_v5.yml79
-rw-r--r--lab_6/unity/test/targets/iar_arm_v5_3.yml79
-rw-r--r--lab_6/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml93
-rw-r--r--lab_6/unity/test/targets/iar_cortexm3_v5.yml83
-rw-r--r--lab_6/unity/test/targets/iar_msp430.yml94
-rw-r--r--lab_6/unity/test/targets/iar_sh2a_v6.yml85
-rw-r--r--lab_6/unity/test/testdata/mocksample.c51
-rw-r--r--lab_6/unity/test/testdata/sample.yml9
-rw-r--r--lab_6/unity/test/testdata/testsample.c51
-rw-r--r--lab_6/unity/test/tests/Testfoo.c84
-rw-r--r--lab_6/unity/test/tests/test_generate_test_runner.rb88
37 files changed, 2791 insertions, 0 deletions
diff --git a/lab_6/unity/test/expectdata/testsample_cmd.c b/lab_6/unity/test/expectdata/testsample_cmd.c
new file mode 100644
index 0000000..3bd5c08
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_cmd.c
@@ -0,0 +1,57 @@
+/* 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 <setjmp.h>
+#include <stdio.h>
+#include "CException.h"
+#include "funky.h"
+#include "stanky.h"
+#include <setjmp.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(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/testsample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_def.c b/lab_6/unity/test/expectdata/testsample_def.c
new file mode 100644
index 0000000..0c95c76
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_def.c
@@ -0,0 +1,53 @@
+/* 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 <setjmp.h>
+#include <stdio.h>
+#include "funky.h"
+#include "stanky.h"
+#include <setjmp.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(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/testsample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_mock_cmd.c b/lab_6/unity/test/expectdata/testsample_mock_cmd.c
new file mode 100644
index 0000000..d047b2a
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_mock_cmd.c
@@ -0,0 +1,79 @@
+/* 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++; \
+ CMock_Init(); \
+ 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(); \
+ CMock_Verify(); \
+ } \
+ CMock_Destroy(); \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include "cmock.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "CException.h"
+#include "funky.h"
+#include <setjmp.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(void);
+void resetTest(void)
+{
+ CMock_Verify();
+ CMock_Destroy();
+ tearDown();
+ CMock_Init();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/mocksample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ CMock_Guts_MemFreeFinal();
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_mock_def.c b/lab_6/unity/test/expectdata/testsample_mock_def.c
new file mode 100644
index 0000000..3a90549
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_mock_def.c
@@ -0,0 +1,75 @@
+/* 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++; \
+ CMock_Init(); \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ CMock_Verify(); \
+ } \
+ CMock_Destroy(); \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include "cmock.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "funky.h"
+#include <setjmp.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(void);
+void resetTest(void)
+{
+ CMock_Verify();
+ CMock_Destroy();
+ tearDown();
+ CMock_Init();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/mocksample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ CMock_Guts_MemFreeFinal();
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_mock_new1.c b/lab_6/unity/test/expectdata/testsample_mock_new1.c
new file mode 100644
index 0000000..7f49c2e
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_mock_new1.c
@@ -0,0 +1,88 @@
+/* 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++; \
+ CMock_Init(); \
+ 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(); \
+ CMock_Verify(); \
+ } \
+ CMock_Destroy(); \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include "cmock.h"
+#include "one.h"
+#include "two.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "CException.h"
+#include "funky.h"
+#include <setjmp.h>
+#include "Mockstanky.h"
+
+int GlobalExpectCount;
+int GlobalVerifyOrder;
+char* GlobalOrderError;
+
+//=======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)
+{
+ GlobalExpectCount = 0;
+ GlobalVerifyOrder = 0;
+ GlobalOrderError = NULL;
+ Mockstanky_Init();
+}
+static void CMock_Verify(void)
+{
+ Mockstanky_Verify();
+}
+static void CMock_Destroy(void)
+{
+ Mockstanky_Destroy();
+}
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ CMock_Verify();
+ CMock_Destroy();
+ tearDown();
+ CMock_Init();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/mocksample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ CMock_Guts_MemFreeFinal();
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_mock_new2.c b/lab_6/unity/test/expectdata/testsample_mock_new2.c
new file mode 100644
index 0000000..daeb82e
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_mock_new2.c
@@ -0,0 +1,88 @@
+/* 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++; \
+ CMock_Init(); \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ CMock_Verify(); \
+ } \
+ CMock_Destroy(); \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include "cmock.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "funky.h"
+#include <setjmp.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();
+}
+
+//=======Suite Setup=====
+static int suite_setup(void)
+{
+a_custom_setup();
+}
+
+//=======Suite Teardown=====
+static int suite_teardown(int num_failures)
+{
+a_custom_teardown();
+}
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ CMock_Verify();
+ CMock_Destroy();
+ tearDown();
+ CMock_Init();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ suite_setup();
+ UnityBegin("testdata/mocksample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ CMock_Guts_MemFreeFinal();
+ return suite_teardown(UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_mock_param.c b/lab_6/unity/test/expectdata/testsample_mock_param.c
new file mode 100644
index 0000000..0f6b05a
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_mock_param.c
@@ -0,0 +1,76 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST_NO_ARGS
+#define RUN_TEST(TestFunc, TestLineNum, ...) \
+{ \
+ Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ CMock_Init(); \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(__VA_ARGS__); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ CMock_Verify(); \
+ } \
+ CMock_Destroy(); \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include "cmock.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "funky.h"
+#include <setjmp.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(void);
+void resetTest(void)
+{
+ CMock_Verify();
+ CMock_Destroy();
+ tearDown();
+ CMock_Init();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/mocksample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS);
+ RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS);
+
+ CMock_Guts_MemFreeFinal();
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_mock_run1.c b/lab_6/unity/test/expectdata/testsample_mock_run1.c
new file mode 100644
index 0000000..7f49c2e
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_mock_run1.c
@@ -0,0 +1,88 @@
+/* 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++; \
+ CMock_Init(); \
+ 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(); \
+ CMock_Verify(); \
+ } \
+ CMock_Destroy(); \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include "cmock.h"
+#include "one.h"
+#include "two.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "CException.h"
+#include "funky.h"
+#include <setjmp.h>
+#include "Mockstanky.h"
+
+int GlobalExpectCount;
+int GlobalVerifyOrder;
+char* GlobalOrderError;
+
+//=======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)
+{
+ GlobalExpectCount = 0;
+ GlobalVerifyOrder = 0;
+ GlobalOrderError = NULL;
+ Mockstanky_Init();
+}
+static void CMock_Verify(void)
+{
+ Mockstanky_Verify();
+}
+static void CMock_Destroy(void)
+{
+ Mockstanky_Destroy();
+}
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ CMock_Verify();
+ CMock_Destroy();
+ tearDown();
+ CMock_Init();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/mocksample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ CMock_Guts_MemFreeFinal();
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_mock_run2.c b/lab_6/unity/test/expectdata/testsample_mock_run2.c
new file mode 100644
index 0000000..daeb82e
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_mock_run2.c
@@ -0,0 +1,88 @@
+/* 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++; \
+ CMock_Init(); \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ CMock_Verify(); \
+ } \
+ CMock_Destroy(); \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include "cmock.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "funky.h"
+#include <setjmp.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();
+}
+
+//=======Suite Setup=====
+static int suite_setup(void)
+{
+a_custom_setup();
+}
+
+//=======Suite Teardown=====
+static int suite_teardown(int num_failures)
+{
+a_custom_teardown();
+}
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ CMock_Verify();
+ CMock_Destroy();
+ tearDown();
+ CMock_Init();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ suite_setup();
+ UnityBegin("testdata/mocksample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ CMock_Guts_MemFreeFinal();
+ return suite_teardown(UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_mock_yaml.c b/lab_6/unity/test/expectdata/testsample_mock_yaml.c
new file mode 100644
index 0000000..35377d7
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_mock_yaml.c
@@ -0,0 +1,89 @@
+/* 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++; \
+ CMock_Init(); \
+ 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(); \
+ CMock_Verify(); \
+ } \
+ CMock_Destroy(); \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include "cmock.h"
+#include "two.h"
+#include "three.h"
+#include <four.h>
+#include <setjmp.h>
+#include <stdio.h>
+#include "CException.h"
+#include "funky.h"
+#include <setjmp.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();
+}
+
+//=======Suite Setup=====
+static int suite_setup(void)
+{
+a_yaml_setup();
+}
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ CMock_Verify();
+ CMock_Destroy();
+ tearDown();
+ CMock_Init();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ suite_setup();
+ UnityBegin("testdata/mocksample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ CMock_Guts_MemFreeFinal();
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_new1.c b/lab_6/unity/test/expectdata/testsample_new1.c
new file mode 100644
index 0000000..1bba7ea
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_new1.c
@@ -0,0 +1,63 @@
+/* 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 "one.h"
+#include "two.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "CException.h"
+#include "funky.h"
+#include "stanky.h"
+#include <setjmp.h>
+
+int GlobalExpectCount;
+int GlobalVerifyOrder;
+char* GlobalOrderError;
+
+//=======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(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/testsample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_new2.c b/lab_6/unity/test/expectdata/testsample_new2.c
new file mode 100644
index 0000000..4ce6639
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_new2.c
@@ -0,0 +1,66 @@
+/* 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 <setjmp.h>
+#include <stdio.h>
+#include "funky.h"
+#include "stanky.h"
+#include <setjmp.h>
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_TheFirstThingToTest(void);
+extern void test_TheSecondThingToTest(void);
+
+
+//=======Suite Setup=====
+static int suite_setup(void)
+{
+a_custom_setup();
+}
+
+//=======Suite Teardown=====
+static int suite_teardown(int num_failures)
+{
+a_custom_teardown();
+}
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ suite_setup();
+ UnityBegin("testdata/testsample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ return suite_teardown(UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_param.c b/lab_6/unity/test/expectdata/testsample_param.c
new file mode 100644
index 0000000..950eeb3
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_param.c
@@ -0,0 +1,54 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST_NO_ARGS
+#define RUN_TEST(TestFunc, TestLineNum, ...) \
+{ \
+ Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \
+ 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>
+#include "funky.h"
+#include "stanky.h"
+#include <setjmp.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(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/testsample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS);
+ RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS);
+
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_run1.c b/lab_6/unity/test/expectdata/testsample_run1.c
new file mode 100644
index 0000000..1bba7ea
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_run1.c
@@ -0,0 +1,63 @@
+/* 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 "one.h"
+#include "two.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "CException.h"
+#include "funky.h"
+#include "stanky.h"
+#include <setjmp.h>
+
+int GlobalExpectCount;
+int GlobalVerifyOrder;
+char* GlobalOrderError;
+
+//=======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(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ UnityBegin("testdata/testsample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_run2.c b/lab_6/unity/test/expectdata/testsample_run2.c
new file mode 100644
index 0000000..4ce6639
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_run2.c
@@ -0,0 +1,66 @@
+/* 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 <setjmp.h>
+#include <stdio.h>
+#include "funky.h"
+#include "stanky.h"
+#include <setjmp.h>
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_TheFirstThingToTest(void);
+extern void test_TheSecondThingToTest(void);
+
+
+//=======Suite Setup=====
+static int suite_setup(void)
+{
+a_custom_setup();
+}
+
+//=======Suite Teardown=====
+static int suite_teardown(int num_failures)
+{
+a_custom_teardown();
+}
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ suite_setup();
+ UnityBegin("testdata/testsample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ return suite_teardown(UnityEnd());
+}
diff --git a/lab_6/unity/test/expectdata/testsample_yaml.c b/lab_6/unity/test/expectdata/testsample_yaml.c
new file mode 100644
index 0000000..96ba511
--- /dev/null
+++ b/lab_6/unity/test/expectdata/testsample_yaml.c
@@ -0,0 +1,67 @@
+/* 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 "two.h"
+#include "three.h"
+#include <four.h>
+#include <setjmp.h>
+#include <stdio.h>
+#include "CException.h"
+#include "funky.h"
+#include "stanky.h"
+#include <setjmp.h>
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_TheFirstThingToTest(void);
+extern void test_TheSecondThingToTest(void);
+
+
+//=======Suite Setup=====
+static int suite_setup(void)
+{
+a_yaml_setup();
+}
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ suite_setup();
+ UnityBegin("testdata/testsample.c");
+ RUN_TEST(test_TheFirstThingToTest, 21);
+ RUN_TEST(test_TheSecondThingToTest, 43);
+
+ return (UnityEnd());
+}
diff --git a/lab_6/unity/test/rakefile b/lab_6/unity/test/rakefile
new file mode 100644
index 0000000..779605e
--- /dev/null
+++ b/lab_6/unity/test/rakefile
@@ -0,0 +1,60 @@
+# ==========================================
+# Unity Project - A Test Framework for C
+# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
+# [Released under MIT License. Please refer to license.txt for details]
+# ==========================================
+
+UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/'
+
+require 'rake'
+require 'rake/clean'
+require UNITY_ROOT + 'rakefile_helper'
+
+TEMP_DIRS = [
+ File.join(UNITY_ROOT, 'build')
+]
+
+TEMP_DIRS.each do |dir|
+ directory(dir)
+ CLOBBER.include(dir)
+end
+
+task :prepare_for_tests => TEMP_DIRS
+
+include RakefileHelpers
+
+# Load proper GCC as defult configuration
+DEFAULT_CONFIG_FILE = 'gcc_32.yml'
+configure_toolchain(DEFAULT_CONFIG_FILE)
+
+desc "Test unity with its own unit tests"
+task :unit => [:prepare_for_tests] do
+ run_tests get_unit_test_files
+end
+
+desc "Test unity's helper scripts"
+task :scripts => [:prepare_for_tests] do
+ Dir['tests/test_*.rb'].each do |scriptfile|
+ require "./"+scriptfile
+ end
+end
+
+desc "Generate test summary"
+task :summary do
+ report_summary
+end
+
+desc "Build and test Unity"
+task :all => [:clean, :prepare_for_tests, :scripts, :unit, :summary]
+task :default => [:clobber, :all]
+task :ci => [:no_color, :default]
+task :cruise => [:no_color, :default]
+
+desc "Load configuration"
+task :config, :config_file do |t, args|
+ configure_toolchain(args[:config_file])
+end
+
+task :no_color do
+ $colour_output = false
+end
diff --git a/lab_6/unity/test/rakefile_helper.rb b/lab_6/unity/test/rakefile_helper.rb
new file mode 100644
index 0000000..935a4f4
--- /dev/null
+++ b/lab_6/unity/test/rakefile_helper.rb
@@ -0,0 +1,249 @@
+# ==========================================
+# Unity Project - A Test Framework for C
+# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
+# [Released under MIT License. Please refer to license.txt for details]
+# ==========================================
+
+require 'yaml'
+require 'fileutils'
+require UNITY_ROOT + '../auto/unity_test_summary'
+require UNITY_ROOT + '../auto/generate_test_runner'
+require UNITY_ROOT + '../auto/colour_reporter'
+
+module RakefileHelpers
+
+ C_EXTENSION = '.c'
+
+ def load_configuration(config_file)
+ unless ($configured)
+ $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/)
+ $cfg = YAML.safe_load(File.read($cfg_file), permitted_classes: [Symbol], permitted_symbols: [], aliases: true)
+ $colour_output = false unless $cfg['colour']
+ $configured = true if (config_file != DEFAULT_CONFIG_FILE)
+ end
+ end
+
+ def configure_clean
+ CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil?
+ end
+
+ def configure_toolchain(config_file=DEFAULT_CONFIG_FILE)
+ config_file += '.yml' unless config_file =~ /\.yml$/
+ config_file = config_file unless config_file =~ /[\\|\/]/
+ load_configuration(config_file)
+ configure_clean
+ end
+
+ def get_unit_test_files
+ path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION
+ path.gsub!(/\\/, '/')
+ FileList.new(path)
+ end
+
+ def get_local_include_dirs
+ include_dirs = $cfg['compiler']['includes']['items'].dup
+ include_dirs.delete_if {|dir| dir.is_a?(Array)}
+ return include_dirs
+ end
+
+ def extract_headers(filename)
+ includes = []
+ lines = File.readlines(filename)
+ lines.each do |line|
+ m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/)
+ if not m.nil?
+ includes << m[1]
+ end
+ end
+ return includes
+ end
+
+ def find_source_file(header, paths)
+ paths.each do |dir|
+ src_file = dir + header.ext(C_EXTENSION)
+ if (File.exist?(src_file))
+ return src_file
+ end
+ end
+ return nil
+ end
+
+ def tackit(strings)
+ if strings.is_a?(Array)
+ result = "\"#{strings.join}\""
+ else
+ result = strings
+ end
+ return result
+ end
+
+ def squash(prefix, items)
+ result = ''
+ items.each { |item| result += " #{prefix}#{tackit(item)}" }
+ return result
+ end
+
+ def should(behave, &block)
+ if block
+ puts "Should " + behave
+ yield block
+ else
+ puts "UNIMPLEMENTED CASE: Should #{behave}"
+ end
+ end
+
+ def build_compiler_fields
+ command = tackit($cfg['compiler']['path'])
+ if $cfg['compiler']['defines']['items'].nil?
+ defines = ''
+ else
+ defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'])
+ end
+ options = squash('', $cfg['compiler']['options'])
+ includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
+ includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
+ return {:command => command, :defines => defines, :options => options, :includes => includes}
+ end
+
+ def compile(file, defines=[])
+ compiler = build_compiler_fields
+ cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " +
+ "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}"
+ obj_file = "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
+ execute(cmd_str + obj_file)
+ return obj_file
+ end
+
+ def build_linker_fields
+ command = tackit($cfg['linker']['path'])
+ if $cfg['linker']['options'].nil?
+ options = ''
+ else
+ options = squash('', $cfg['linker']['options'])
+ end
+ if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?)
+ includes = ''
+ else
+ includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
+ end
+ includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
+ return {:command => command, :options => options, :includes => includes}
+ end
+
+ def link_it(exe_name, obj_list)
+ linker = build_linker_fields
+ cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
+ (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join +
+ $cfg['linker']['bin_files']['prefix'] + ' ' +
+ $cfg['linker']['bin_files']['destination'] +
+ exe_name + $cfg['linker']['bin_files']['extension']
+ execute(cmd_str)
+ end
+
+ def build_simulator_fields
+ return nil if $cfg['simulator'].nil?
+ if $cfg['simulator']['path'].nil?
+ command = ''
+ else
+ command = (tackit($cfg['simulator']['path']) + ' ')
+ end
+ if $cfg['simulator']['pre_support'].nil?
+ pre_support = ''
+ else
+ pre_support = squash('', $cfg['simulator']['pre_support'])
+ end
+ if $cfg['simulator']['post_support'].nil?
+ post_support = ''
+ else
+ post_support = squash('', $cfg['simulator']['post_support'])
+ end
+ return {:command => command, :pre_support => pre_support, :post_support => post_support}
+ end
+
+ def execute(command_string, verbose=true)
+ report command_string
+ output = `#{command_string}`.chomp
+ report(output) if (verbose && !output.nil? && (output.length > 0))
+ if $?.exitstatus != 0
+ raise "Command failed. (Returned #{$?.exitstatus})"
+ end
+ return output
+ end
+
+ def report_summary
+ summary = UnityTestSummary.new
+ summary.set_root_path(UNITY_ROOT)
+ results_glob = "#{$cfg['compiler']['build_path']}*.test*"
+ results_glob.gsub!(/\\/, '/')
+ results = Dir[results_glob]
+ summary.set_targets(results)
+ report summary.run
+ end
+
+ def run_tests(test_files)
+ report 'Running Unity system tests...'
+
+ # Tack on TEST define for compiling unit tests
+ load_configuration($cfg_file)
+ test_defines = ['TEST']
+ $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
+ $cfg['compiler']['defines']['items'] << 'TEST'
+
+ include_dirs = get_local_include_dirs
+
+ # Build and execute each unit test
+ test_files.each do |test|
+ obj_list = []
+
+ # Detect dependencies and build required modules
+ extract_headers(test).each do |header|
+ # Compile corresponding source file if it exists
+ src_file = find_source_file(header, include_dirs)
+ if !src_file.nil?
+ obj_list << compile(src_file, test_defines)
+ end
+ end
+
+ # Build the test runner (generate if configured to do so)
+ test_base = File.basename(test, C_EXTENSION)
+
+ runner_name = test_base + '_Runner.c'
+ runner_path = ''
+
+ if $cfg['compiler']['runner_path'].nil?
+ runner_path = $cfg['compiler']['build_path'] + runner_name
+ else
+ runner_path = $cfg['compiler']['runner_path'] + runner_name
+ end
+
+ options = $cfg[:unity]
+ options[:use_param_tests] = (test =~ /parameterized/) ? true : false
+ UnityTestRunnerGenerator.new(options).run(test, runner_path)
+ obj_list << compile(runner_path, test_defines)
+
+ # Build the test module
+ obj_list << compile(test, test_defines)
+
+ # Link the test executable
+ link_it(test_base, obj_list)
+
+ # Execute unit test and generate results file
+ simulator = build_simulator_fields
+ executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension']
+ if simulator.nil?
+ cmd_str = executable
+ else
+ cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
+ end
+ output = execute(cmd_str)
+ test_results = $cfg['compiler']['build_path'] + test_base
+ if output.match(/OK$/m).nil?
+ test_results += '.testfail'
+ else
+ test_results += '.testpass'
+ end
+ File.open(test_results, 'w') { |f| f.print output }
+
+ end
+ end
+end
diff --git a/lab_6/unity/test/targets/clang_strict.yml b/lab_6/unity/test/targets/clang_strict.yml
new file mode 100644
index 0000000..3e2bdc2
--- /dev/null
+++ b/lab_6/unity/test/targets/clang_strict.yml
@@ -0,0 +1,83 @@
+---
+compiler:
+ path: clang
+ source_path: '../src/'
+ unit_tests_path: &unit_tests_path 'tests/'
+ build_path: &build_path 'build/'
+ options:
+ - '-c'
+ - '-Wall'
+ - '-Wextra'
+ - '-Werror'
+ - '-Wcast-qual'
+ - '-Wconversion'
+ - '-Wdisabled-optimization'
+ - '-Wformat=2'
+ - '-Winit-self'
+ - '-Winline'
+ - '-Winvalid-pch'
+ - '-Wmissing-declarations'
+ - '-Wmissing-include-dirs'
+ - '-Wmissing-prototypes'
+ - '-Wnonnull'
+ - '-Wpacked'
+ - '-Wpointer-arith'
+ - '-Wredundant-decls'
+ - '-Wswitch-default'
+ - '-Wstrict-aliasing'
+ - '-Wstrict-overflow=5'
+ - '-Wuninitialized'
+ - '-Wunused'
+ - '-Wunreachable-code'
+ - '-Wreturn-type'
+ - '-Wshadow'
+ - '-Wundef'
+ - '-Wwrite-strings'
+ - '-Wno-missing-declarations'
+ - '-Wno-missing-prototypes'
+ - '-Wno-nested-externs'
+ - '-Wno-redundant-decls'
+ - '-Wno-unused-parameter'
+ - '-Wno-variadic-macros'
+ - '-Wbad-function-cast'
+ - '-fms-extensions'
+ - '-fno-omit-frame-pointer'
+ - '-ffloat-store'
+ - '-fno-common'
+ - '-fstrict-aliasing'
+ - '-std=gnu99'
+ - '-pedantic'
+ - '-O0'
+ includes:
+ prefix: '-I'
+ items:
+ - 'src/'
+ - '../src/'
+ - *unit_tests_path
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_INCLUDE_DOUBLE
+ - UNITY_SUPPORT_TEST_CASES
+ - UNITY_SUPPORT_64
+ object_files:
+ prefix: '-o'
+ extension: '.o'
+ destination: *build_path
+linker:
+ path: gcc
+ options:
+ - -lm
+ - '-m64'
+ includes:
+ prefix: '-I'
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.exe'
+ destination: *build_path
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/gcc_32.yml b/lab_6/unity/test/targets/gcc_32.yml
new file mode 100644
index 0000000..dbed355
--- /dev/null
+++ b/lab_6/unity/test/targets/gcc_32.yml
@@ -0,0 +1,49 @@
+compiler:
+ path: gcc
+ source_path: '../src/'
+ unit_tests_path: &unit_tests_path 'tests/'
+ build_path: &build_path 'build/'
+ options:
+ - '-c'
+ - '-m32'
+ - '-Wall'
+ - '-Wno-address'
+ - '-std=c99'
+ - '-pedantic'
+ includes:
+ prefix: '-I'
+ items:
+ - 'src/'
+ - '../src/'
+ - *unit_tests_path
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_EXCLUDE_STDINT_H
+ - UNITY_EXCLUDE_LIMITS_H
+ - UNITY_EXCLUDE_SIZEOF
+ - UNITY_INCLUDE_DOUBLE
+ - UNITY_SUPPORT_TEST_CASES
+ - UNITY_INT_WIDTH=32
+ - UNITY_LONG_WIDTH=32
+ object_files:
+ prefix: '-o'
+ extension: '.o'
+ destination: *build_path
+linker:
+ path: gcc
+ options:
+ - -lm
+ - '-m32'
+ includes:
+ prefix: '-I'
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.exe'
+ destination: *build_path
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/gcc_64.yml b/lab_6/unity/test/targets/gcc_64.yml
new file mode 100644
index 0000000..8f60340
--- /dev/null
+++ b/lab_6/unity/test/targets/gcc_64.yml
@@ -0,0 +1,50 @@
+compiler:
+ path: gcc
+ source_path: '../src/'
+ unit_tests_path: &unit_tests_path 'tests/'
+ build_path: &build_path 'build/'
+ options:
+ - '-c'
+ - '-m64'
+ - '-Wall'
+ - '-Wno-address'
+ - '-std=c99'
+ - '-pedantic'
+ includes:
+ prefix: '-I'
+ items:
+ - 'src/'
+ - '../src/'
+ - *unit_tests_path
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_EXCLUDE_STDINT_H
+ - UNITY_EXCLUDE_LIMITS_H
+ - UNITY_EXCLUDE_SIZEOF
+ - UNITY_INCLUDE_DOUBLE
+ - UNITY_SUPPORT_TEST_CASES
+ - UNITY_SUPPORT_64
+ - UNITY_INT_WIDTH=32
+ - UNITY_LONG_WIDTH=64
+ object_files:
+ prefix: '-o'
+ extension: '.o'
+ destination: *build_path
+linker:
+ path: gcc
+ options:
+ - -lm
+ - '-m64'
+ includes:
+ prefix: '-I'
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.exe'
+ destination: *build_path
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/gcc_auto_limits.yml b/lab_6/unity/test/targets/gcc_auto_limits.yml
new file mode 100644
index 0000000..72ed555
--- /dev/null
+++ b/lab_6/unity/test/targets/gcc_auto_limits.yml
@@ -0,0 +1,46 @@
+compiler:
+ path: gcc
+ source_path: '../src/'
+ unit_tests_path: &unit_tests_path 'tests/'
+ build_path: &build_path 'build/'
+ options:
+ - '-c'
+ - '-m64'
+ - '-Wall'
+ - '-Wno-address'
+ - '-std=c99'
+ - '-pedantic'
+ includes:
+ prefix: '-I'
+ items:
+ - 'src/'
+ - '../src/'
+ - *unit_tests_path
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_EXCLUDE_STDINT_H
+ - UNITY_INCLUDE_DOUBLE
+ - UNITY_SUPPORT_TEST_CASES
+ - UNITY_SUPPORT_64
+ object_files:
+ prefix: '-o'
+ extension: '.o'
+ destination: *build_path
+linker:
+ path: gcc
+ options:
+ - -lm
+ - '-m64'
+ includes:
+ prefix: '-I'
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.exe'
+ destination: *build_path
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/gcc_auto_sizeof.yml b/lab_6/unity/test/targets/gcc_auto_sizeof.yml
new file mode 100644
index 0000000..b7076ea
--- /dev/null
+++ b/lab_6/unity/test/targets/gcc_auto_sizeof.yml
@@ -0,0 +1,47 @@
+compiler:
+ path: gcc
+ source_path: '../src/'
+ unit_tests_path: &unit_tests_path 'tests/'
+ build_path: &build_path 'build/'
+ options:
+ - '-c'
+ - '-m64'
+ - '-Wall'
+ - '-Wno-address'
+ - '-std=c99'
+ - '-pedantic'
+ includes:
+ prefix: '-I'
+ items:
+ - 'src/'
+ - '../src/'
+ - *unit_tests_path
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_EXCLUDE_STDINT_H
+ - UNITY_EXCLUDE_LIMTIS_H
+ - UNITY_INCLUDE_DOUBLE
+ - UNITY_SUPPORT_TEST_CASES
+ - UNITY_SUPPORT_64
+ object_files:
+ prefix: '-o'
+ extension: '.o'
+ destination: *build_path
+linker:
+ path: gcc
+ options:
+ - -lm
+ - '-m64'
+ includes:
+ prefix: '-I'
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.exe'
+ destination: *build_path
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/gcc_auto_stdint.yml b/lab_6/unity/test/targets/gcc_auto_stdint.yml
new file mode 100644
index 0000000..4e642c1
--- /dev/null
+++ b/lab_6/unity/test/targets/gcc_auto_stdint.yml
@@ -0,0 +1,61 @@
+compiler:
+ path: gcc
+ source_path: '../src/'
+ unit_tests_path: &unit_tests_path 'tests/'
+ build_path: &build_path 'build/'
+ options:
+ - '-c'
+ - '-m64'
+ - '-Wall'
+ - '-Wno-address'
+ - '-std=c99'
+ - '-pedantic'
+ - '-Wextra'
+ - '-Werror'
+ - '-Wpointer-arith'
+ - '-Wcast-align'
+ - '-Wwrite-strings'
+ - '-Wswitch-default'
+ - '-Wunreachable-code'
+ - '-Winit-self'
+ - '-Wlogical-op'
+ - '-Wmissing-field-initializers'
+ - '-Wno-unknown-pragmas'
+ - '-Wjump-misses-init'
+ - '-Wstrict-prototypes'
+ - '-Wundef'
+ - '-Wunsafe-loop-optimizations'
+ - '-Wold-style-definition'
+ includes:
+ prefix: '-I'
+ items:
+ - 'src/'
+ - '../src/'
+ - *unit_tests_path
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_INCLUDE_DOUBLE
+ - UNITY_SUPPORT_TEST_CASES
+ - UNITY_SUPPORT_64
+ object_files:
+ prefix: '-o'
+ extension: '.o'
+ destination: *build_path
+linker:
+ path: gcc
+ options:
+ - -lm
+ - '-m64'
+ includes:
+ prefix: '-I'
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.exe'
+ destination: *build_path
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/hitech_picc18.yml b/lab_6/unity/test/targets/hitech_picc18.yml
new file mode 100644
index 0000000..1e42989
--- /dev/null
+++ b/lab_6/unity/test/targets/hitech_picc18.yml
@@ -0,0 +1,101 @@
+# rumor has it that this yaml file works for the standard edition of the
+# hitech PICC18 compiler, but not the pro version.
+#
+compiler:
+ path: cd build && picc18
+ source_path: '..\src\'
+ unit_tests_path: &unit_tests_path 'tests\'
+ build_path: &build_path 'build\'
+ options:
+ - --chip=18F87J10
+ - --ide=hitide
+ - --q #quiet please
+ - --asmlist
+ - --codeoffset=0
+ - --emi=wordwrite # External memory interface protocol
+ - --warn=0 # allow all normal warning messages
+ - --errors=10 # Number of errors before aborting compile
+ - --char=unsigned
+ - -Bl # Large memory model
+ - -G # generate symbol file
+ - --cp=16 # 16-bit pointers
+ - --double=24
+ - -N255 # 255-char symbol names
+ - --opt=none # Do not use any compiler optimziations
+ - -c # compile only
+ - -M
+ includes:
+ prefix: '-I'
+ items:
+ - 'c:/Projects/NexGen/Prototypes/CMockTest/src/'
+ - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/'
+ - 'c:/CMock/src/'
+ - 'c:/CMock/examples/src/'
+ - 'c:/CMock/vendor/unity/src/'
+ - 'c:/CMock/vendor/unity/examples/helper/'
+ - *unit_tests_path
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_INT_WIDTH=16
+ - UNITY_POINTER_WIDTH=16
+ - CMOCK_MEM_STATIC
+ - CMOCK_MEM_SIZE=3000
+ - UNITY_SUPPORT_TEST_CASES
+ - _PICC18
+ object_files:
+ # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead
+ extension: '.obj'
+ destination: *build_path
+
+linker:
+ path: cd build && picc18
+ options:
+ - --chip=18F87J10
+ - --ide=hitide
+ - --cp=24 # 24-bit pointers. Is this needed for linker??
+ - --double=24 # Is this needed for linker??
+ - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory
+ - --summary=mem,file # info listing
+ - --summary=+psect
+ - --summary=+hex
+ - --output=+intel
+ - --output=+mcof
+ - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM.
+ - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects
+ - --runtime=+clib # link in the c-runtime
+ - --runtime=+keep # Keep the generated startup src after its obj is linked
+ - -G # Generate src-level symbol file
+ - -MIWasTheLastToBuild.map
+ - --warn=0 # allow all normal warning messages
+ - -Bl # Large memory model (probably not needed for linking)
+ includes:
+ prefix: '-I'
+ object_files:
+ path: *build_path
+ extension: '.obj'
+ bin_files:
+ prefix: '-O'
+ extension: '.hex'
+ destination: *build_path
+
+simulator:
+ path:
+ pre_support:
+ - 'java -client -jar ' # note space
+ - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar']
+ - 18F87J10
+ post_support:
+
+:cmock:
+ :plugins: []
+ :includes:
+ - Types.h
+ :suite_teardown: |
+ if (num_failures)
+ _FAILED_TEST();
+ else
+ _PASSED_TESTS();
+ return 0;
+
+colour: true
diff --git a/lab_6/unity/test/targets/iar_arm_v4.yml b/lab_6/unity/test/targets/iar_arm_v4.yml
new file mode 100644
index 0000000..ce847b9
--- /dev/null
+++ b/lab_6/unity/test/targets/iar_arm_v4.yml
@@ -0,0 +1,89 @@
+tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
+compiler:
+ path: [*tools_root, 'arm\bin\iccarm.exe']
+ source_path: '..\src\'
+ unit_tests_path: &unit_tests_path 'tests\'
+ build_path: &build_path 'build\'
+ options:
+ - --dlib_config
+ - [*tools_root, 'arm\lib\dl4tptinl8n.h']
+ - -z3
+ - --no_cse
+ - --no_unroll
+ - --no_inline
+ - --no_code_motion
+ - --no_tbaa
+ - --no_clustering
+ - --no_scheduling
+ - --debug
+ - --cpu_mode thumb
+ - --endian little
+ - --cpu ARM7TDMI
+ - --stack_align 4
+ - --interwork
+ - -e
+ - --silent
+ - --warnings_are_errors
+ - --fpu None
+ - --diag_suppress Pa050
+ includes:
+ prefix: '-I'
+ items:
+ - [*tools_root, 'arm\inc\']
+ - 'src\'
+ - '..\src\'
+ - *unit_tests_path
+ - 'vendor\unity\src\'
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_SUPPORT_64
+ - 'UNITY_SUPPORT_TEST_CASES'
+ object_files:
+ prefix: '-o'
+ extension: '.r79'
+ destination: *build_path
+linker:
+ path: [*tools_root, 'common\bin\xlink.exe']
+ options:
+ - -rt
+ - [*tools_root, 'arm\lib\dl4tptinl8n.r79']
+ - -D_L_EXTMEM_START=0
+ - -D_L_EXTMEM_SIZE=0
+ - -D_L_HEAP_SIZE=120
+ - -D_L_STACK_SIZE=32
+ - -e_small_write=_formatted_write
+ - -s
+ - __program_start
+ - -f
+ - [*tools_root, '\arm\config\lnkarm.xcl']
+ includes:
+ prefix: '-I'
+ items:
+ - [*tools_root, 'arm\config\']
+ - [*tools_root, 'arm\lib\']
+ object_files:
+ path: *build_path
+ extension: '.r79'
+ bin_files:
+ prefix: '-o'
+ extension: '.d79'
+ destination: *build_path
+simulator:
+ path: [*tools_root, 'common\bin\CSpyBat.exe']
+ pre_support:
+ - --silent
+ - [*tools_root, 'arm\bin\armproc.dll']
+ - [*tools_root, 'arm\bin\armsim.dll']
+ post_support:
+ - --plugin
+ - [*tools_root, 'arm\bin\armbat.dll']
+ - --backend
+ - -B
+ - -p
+ - [*tools_root, 'arm\config\ioat91sam7X256.ddf']
+ - -d
+ - sim
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/iar_arm_v5.yml b/lab_6/unity/test/targets/iar_arm_v5.yml
new file mode 100644
index 0000000..22daad4
--- /dev/null
+++ b/lab_6/unity/test/targets/iar_arm_v5.yml
@@ -0,0 +1,79 @@
+tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
+compiler:
+ path: [*tools_root, 'arm\bin\iccarm.exe']
+ source_path: '..\src\'
+ unit_tests_path: &unit_tests_path 'tests\'
+ build_path: &build_path 'build\'
+ options:
+ - --dlib_config
+ - [*tools_root, 'arm\inc\DLib_Config_Normal.h']
+ - --no_cse
+ - --no_unroll
+ - --no_inline
+ - --no_code_motion
+ - --no_tbaa
+ - --no_clustering
+ - --no_scheduling
+ - --debug
+ - --cpu_mode thumb
+ - --endian=little
+ - --cpu=ARM7TDMI
+ - --interwork
+ - --warnings_are_errors
+ - --fpu=None
+ - --diag_suppress=Pa050
+ - --diag_suppress=Pe111
+ - -e
+ - -On
+ includes:
+ prefix: '-I'
+ items:
+ - [*tools_root, 'arm\inc\']
+ - 'src\'
+ - '..\src\'
+ - *unit_tests_path
+ - 'vendor\unity\src\'
+ - 'iar\iar_v5\incIAR\'
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_SUPPORT_64
+ - 'UNITY_SUPPORT_TEST_CASES'
+ object_files:
+ prefix: '-o'
+ extension: '.r79'
+ destination: *build_path
+linker:
+ path: [*tools_root, 'arm\bin\ilinkarm.exe']
+ options:
+ - --redirect _Printf=_PrintfLarge
+ - --redirect _Scanf=_ScanfSmall
+ - --semihosting
+ - --entry __iar_program_start
+ - --config
+ - [*tools_root, 'arm\config\generic.icf']
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.out'
+ destination: *build_path
+simulator:
+ path: [*tools_root, 'common\bin\CSpyBat.exe']
+ pre_support:
+ - --silent
+ - [*tools_root, 'arm\bin\armproc.dll']
+ - [*tools_root, 'arm\bin\armsim.dll']
+ post_support:
+ - --plugin
+ - [*tools_root, 'arm\bin\armbat.dll']
+ - --backend
+ - -B
+ - -p
+ - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf']
+ - -d
+ - sim
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/iar_arm_v5_3.yml b/lab_6/unity/test/targets/iar_arm_v5_3.yml
new file mode 100644
index 0000000..22daad4
--- /dev/null
+++ b/lab_6/unity/test/targets/iar_arm_v5_3.yml
@@ -0,0 +1,79 @@
+tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
+compiler:
+ path: [*tools_root, 'arm\bin\iccarm.exe']
+ source_path: '..\src\'
+ unit_tests_path: &unit_tests_path 'tests\'
+ build_path: &build_path 'build\'
+ options:
+ - --dlib_config
+ - [*tools_root, 'arm\inc\DLib_Config_Normal.h']
+ - --no_cse
+ - --no_unroll
+ - --no_inline
+ - --no_code_motion
+ - --no_tbaa
+ - --no_clustering
+ - --no_scheduling
+ - --debug
+ - --cpu_mode thumb
+ - --endian=little
+ - --cpu=ARM7TDMI
+ - --interwork
+ - --warnings_are_errors
+ - --fpu=None
+ - --diag_suppress=Pa050
+ - --diag_suppress=Pe111
+ - -e
+ - -On
+ includes:
+ prefix: '-I'
+ items:
+ - [*tools_root, 'arm\inc\']
+ - 'src\'
+ - '..\src\'
+ - *unit_tests_path
+ - 'vendor\unity\src\'
+ - 'iar\iar_v5\incIAR\'
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_SUPPORT_64
+ - 'UNITY_SUPPORT_TEST_CASES'
+ object_files:
+ prefix: '-o'
+ extension: '.r79'
+ destination: *build_path
+linker:
+ path: [*tools_root, 'arm\bin\ilinkarm.exe']
+ options:
+ - --redirect _Printf=_PrintfLarge
+ - --redirect _Scanf=_ScanfSmall
+ - --semihosting
+ - --entry __iar_program_start
+ - --config
+ - [*tools_root, 'arm\config\generic.icf']
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.out'
+ destination: *build_path
+simulator:
+ path: [*tools_root, 'common\bin\CSpyBat.exe']
+ pre_support:
+ - --silent
+ - [*tools_root, 'arm\bin\armproc.dll']
+ - [*tools_root, 'arm\bin\armsim.dll']
+ post_support:
+ - --plugin
+ - [*tools_root, 'arm\bin\armbat.dll']
+ - --backend
+ - -B
+ - -p
+ - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf']
+ - -d
+ - sim
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml b/lab_6/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml
new file mode 100644
index 0000000..91c184d
--- /dev/null
+++ b/lab_6/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml
@@ -0,0 +1,93 @@
+#Default tool path for IAR 5.4 on Windows XP 64bit
+tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\'
+compiler:
+ path: [*tools_root, 'arm\bin\iccarm.exe']
+ source_path: '..\src\'
+ unit_tests_path: &unit_tests_path 'tests\'
+ build_path: &build_path 'build\'
+ options:
+ - --diag_suppress=Pa050
+ #- --diag_suppress=Pe111
+ - --debug
+ - --endian=little
+ - --cpu=Cortex-M3
+ - --no_path_in_file_macros
+ - -e
+ - --fpu=None
+ - --dlib_config
+ - [*tools_root, 'arm\inc\DLib_Config_Normal.h']
+ #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h
+ - --interwork
+ - --warnings_are_errors
+# - Ohz
+ - -Oh
+# - --no_cse
+# - --no_unroll
+# - --no_inline
+# - --no_code_motion
+# - --no_tbaa
+# - --no_clustering
+# - --no_scheduling
+
+ includes:
+ prefix: '-I'
+ items:
+ - [*tools_root, 'arm\inc\']
+ - 'src\'
+ - '..\src\'
+ - *unit_tests_path
+ - 'vendor\unity\src\'
+ - 'iar\iar_v5\incIAR\'
+ defines:
+ prefix: '-D'
+ items:
+ - ewarm
+ - PART_LM3S9B92
+ - TARGET_IS_TEMPEST_RB1
+ - USE_ROM_DRIVERS
+ - UART_BUFFERED
+ - UNITY_SUPPORT_64
+ object_files:
+ prefix: '-o'
+ extension: '.r79'
+ destination: *build_path
+linker:
+ path: [*tools_root, 'arm\bin\ilinkarm.exe']
+ options:
+ - --redirect _Printf=_PrintfLarge
+ - --redirect _Scanf=_ScanfSmall
+ - --semihosting
+ - --entry __iar_program_start
+ - --config
+ - [*tools_root, 'arm\config\generic.icf']
+# - ['C:\Temp\lm3s9b92.icf']
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.out'
+ destination: *build_path
+simulator:
+ path: [*tools_root, 'common\bin\CSpyBat.exe']
+ pre_support:
+ #- --silent
+ - [*tools_root, 'arm\bin\armproc.dll']
+ - [*tools_root, 'arm\bin\armsim2.dll']
+ post_support:
+ - --plugin
+ - [*tools_root, 'arm\bin\armbat.dll']
+ - --backend
+ - -B
+ - --endian=little
+ - --cpu=Cortex-M3
+ - --fpu=None
+ - -p
+ - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf']
+ - --semihosting
+ - --device=LM3SxBxx
+ #- -d
+ #- sim
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/iar_cortexm3_v5.yml b/lab_6/unity/test/targets/iar_cortexm3_v5.yml
new file mode 100644
index 0000000..30d7178
--- /dev/null
+++ b/lab_6/unity/test/targets/iar_cortexm3_v5.yml
@@ -0,0 +1,83 @@
+# unit testing under iar compiler / simulator for STM32 Cortex-M3
+
+tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\'
+compiler:
+ path: [*tools_root, 'arm\bin\iccarm.exe']
+ source_path: '..\src\'
+ unit_tests_path: &unit_tests_path 'tests\'
+ build_path: &build_path 'build\'
+ options:
+ - --dlib_config
+ - [*tools_root, 'arm\inc\DLib_Config_Normal.h']
+ - --no_cse
+ - --no_unroll
+ - --no_inline
+ - --no_code_motion
+ - --no_tbaa
+ - --no_clustering
+ - --no_scheduling
+ - --debug
+ - --cpu_mode thumb
+ - --endian=little
+ - --cpu=Cortex-M3
+ - --interwork
+ - --warnings_are_errors
+ - --fpu=None
+ - --diag_suppress=Pa050
+ - --diag_suppress=Pe111
+ - -e
+ - -On
+ includes:
+ prefix: '-I'
+ items:
+ - [*tools_root, 'arm\inc\']
+ - 'src\'
+ - '..\src\'
+ - *unit_tests_path
+ - 'vendor\unity\src\'
+ - 'iar\iar_v5\incIAR\'
+ defines:
+ prefix: '-D'
+ items:
+ - 'IAR'
+ - 'UNITY_SUPPORT_64'
+ - 'UNITY_SUPPORT_TEST_CASES'
+ object_files:
+ prefix: '-o'
+ extension: '.r79'
+ destination: *build_path
+linker:
+ path: [*tools_root, 'arm\bin\ilinkarm.exe']
+ options:
+ - --redirect _Printf=_PrintfLarge
+ - --redirect _Scanf=_ScanfSmall
+ - --semihosting
+ - --entry __iar_program_start
+ - --config
+ - [*tools_root, 'arm\config\generic_cortex.icf']
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.out'
+ destination: *build_path
+simulator:
+ path: [*tools_root, 'common\bin\CSpyBat.exe']
+ pre_support:
+ - --silent
+ - [*tools_root, 'arm\bin\armproc.dll']
+ - [*tools_root, 'arm\bin\armsim.dll']
+ post_support:
+ - --plugin
+ - [*tools_root, 'arm\bin\armbat.dll']
+ - --backend
+ - -B
+ - -p
+ - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf']
+ - --cpu=Cortex-M3
+ - -d
+ - sim
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/iar_msp430.yml b/lab_6/unity/test/targets/iar_msp430.yml
new file mode 100644
index 0000000..a36d27f
--- /dev/null
+++ b/lab_6/unity/test/targets/iar_msp430.yml
@@ -0,0 +1,94 @@
+tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\'
+core_root: &core_root [*tools_root, '430\']
+core_bin: &core_bin [*core_root, 'bin\']
+core_config: &core_config [*core_root, 'config\']
+core_lib: &core_lib [*core_root, 'lib\']
+core_inc: &core_inc [*core_root, 'inc\']
+core_config: &core_config [*core_root, 'config\']
+
+compiler:
+ path: [*core_bin, 'icc430.exe']
+ source_path: '..\src\'
+ unit_tests_path: &unit_tests_path 'tests\'
+ build_path: &build_path 'build\'
+ options:
+ - --dlib_config
+ - [*core_lib, 'dlib\dl430fn.h']
+ - --no_cse
+ - --no_unroll
+ - --no_inline
+ - --no_code_motion
+ - --no_tbaa
+ - --debug
+ - -e
+ - -Ol
+ - --multiplier=16
+ - --double=32
+ - --diag_suppress Pa050
+ - --diag_suppress Pe111
+ includes:
+ prefix: '-I'
+ items:
+ - *core_inc
+ - [*core_inc, 'dlib']
+ - [*core_lib, 'dlib']
+ - 'src\'
+ - '../src/'
+ - *unit_tests_path
+ - 'vendor\unity\src'
+ defines:
+ prefix: '-D'
+ items:
+ - '__MSP430F149__'
+ - 'INT_WIDTH=16'
+ - 'UNITY_EXCLUDE_FLOAT'
+ - 'UNITY_SUPPORT_TEST_CASES'
+ object_files:
+ prefix: '-o'
+ extension: '.r43'
+ destination: *build_path
+linker:
+ path: [*core_bin, 'xlink.exe']
+ options:
+ - -rt
+ - [*core_lib, 'dlib\dl430fn.r43']
+ - -e_PrintfTiny=_Printf
+ - -e_ScanfSmall=_Scanf
+ - -s __program_start
+ - -D_STACK_SIZE=50
+ - -D_DATA16_HEAP_SIZE=50
+ - -D_DATA20_HEAP_SIZE=50
+ - -f
+ - [*core_config, 'lnk430f5438.xcl']
+ - -f
+ - [*core_config, 'multiplier.xcl']
+ includes:
+ prefix: '-I'
+ items:
+ - *core_config
+ - *core_lib
+ - [*core_lib, 'dlib']
+ object_files:
+ path: *build_path
+ extension: '.r79'
+ bin_files:
+ prefix: '-o'
+ extension: '.d79'
+ destination: *build_path
+simulator:
+ path: [*tools_root, 'common\bin\CSpyBat.exe']
+ pre_support:
+ - --silent
+ - [*core_bin, '430proc.dll']
+ - [*core_bin, '430sim.dll']
+ post_support:
+ - --plugin
+ - [*core_bin, '430bat.dll']
+ - --backend -B
+ - --cpu MSP430F5438
+ - -p
+ - [*core_config, 'MSP430F5438.ddf']
+ - -d sim
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/targets/iar_sh2a_v6.yml b/lab_6/unity/test/targets/iar_sh2a_v6.yml
new file mode 100644
index 0000000..cb264f2
--- /dev/null
+++ b/lab_6/unity/test/targets/iar_sh2a_v6.yml
@@ -0,0 +1,85 @@
+tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\'
+compiler:
+ path: [*tools_root, 'sh\bin\iccsh.exe']
+ source_path: '..\src\'
+ unit_tests_path: &unit_tests_path 'tests\'
+ build_path: &build_path 'build\'
+ options:
+ - -e
+ - --char_is_signed
+ - -Ol
+ - --no_cse
+ - --no_unroll
+ - --no_inline
+ - --no_code_motion
+ - --no_tbaa
+ - --no_scheduling
+ - --no_clustering
+ - --debug
+ - --dlib_config
+ - [*tools_root, 'sh\inc\DLib_Product.h']
+ - --double=32
+ - --code_model=huge
+ - --data_model=huge
+ - --core=sh2afpu
+ - --warnings_affect_exit_code
+ - --warnings_are_errors
+ - --mfc
+ - --use_unix_directory_separators
+ - --diag_suppress=Pe161
+ includes:
+ prefix: '-I'
+ items:
+ - [*tools_root, 'sh\inc\']
+ - [*tools_root, 'sh\inc\c']
+ - 'src\'
+ - '..\src\'
+ - *unit_tests_path
+ - 'vendor\unity\src\'
+ defines:
+ prefix: '-D'
+ items:
+ - UNITY_SUPPORT_64
+ - 'UNITY_SUPPORT_TEST_CASES'
+ object_files:
+ prefix: '-o'
+ extension: '.o'
+ destination: *build_path
+linker:
+ path: [*tools_root, 'sh\bin\ilinksh.exe']
+ options:
+ - --redirect __Printf=__PrintfSmall
+ - --redirect __Scanf=__ScanfSmall
+ - --config
+ - [*tools_root, 'sh\config\generic.icf']
+ - --config_def _CSTACK_SIZE=0x800
+ - --config_def _HEAP_SIZE=0x800
+ - --config_def _INT_TABLE=0x10
+ - --entry __iar_program_start
+ - --debug_lib
+ object_files:
+ path: *build_path
+ extension: '.o'
+ bin_files:
+ prefix: '-o'
+ extension: '.out'
+ destination: *build_path
+simulator:
+ path: [*tools_root, 'common\bin\CSpyBat.exe']
+ pre_support:
+ - --silent
+ - [*tools_root, 'sh\bin\shproc.dll']
+ - [*tools_root, 'sh\bin\shsim.dll']
+ post_support:
+ - --plugin
+ - [*tools_root, 'sh\bin\shbat.dll']
+ - --backend
+ - -B
+ - --core sh2afpu
+ - -p
+ - [*tools_root, 'sh\config\debugger\io7264.ddf']
+ - -d
+ - sim
+colour: true
+:unity:
+ :plugins: []
diff --git a/lab_6/unity/test/testdata/mocksample.c b/lab_6/unity/test/testdata/mocksample.c
new file mode 100644
index 0000000..847d87f
--- /dev/null
+++ b/lab_6/unity/test/testdata/mocksample.c
@@ -0,0 +1,51 @@
+// This is just a sample test file to be used to test the generator script
+#ifndef TEST_SAMPLE_H
+#define TEST_SAMPLE_H
+
+#include <setjmp.h>
+#include "unity.h"
+#include "funky.h"
+#include "Mockstanky.h"
+
+void setUp(void)
+{
+ CustomSetupStuff();
+}
+
+void tearDown(void)
+{
+ CustomTeardownStuff
+}
+
+//Yup, nice comment
+void test_TheFirstThingToTest(void)
+{
+ TEST_ASSERT(1);
+
+ TEST_ASSERT_TRUE(1);
+}
+
+/*
+void test_ShouldBeIgnored(void)
+{
+ DoesStuff();
+}
+*/
+
+//void test_ShouldAlsoNotBeTested(void)
+//{
+// Call_An_Expect();
+//
+// CallAFunction();
+// test_CallAFunctionThatLooksLikeATest();
+//}
+
+void test_TheSecondThingToTest(void)
+{
+ Call_An_Expect();
+
+ CallAFunction();
+ test_CallAFunctionThatLooksLikeATest();
+}
+
+#endif //TEST_SAMPLE_H
diff --git a/lab_6/unity/test/testdata/sample.yml b/lab_6/unity/test/testdata/sample.yml
new file mode 100644
index 0000000..52ec96b
--- /dev/null
+++ b/lab_6/unity/test/testdata/sample.yml
@@ -0,0 +1,9 @@
+:unity:
+ :includes:
+ - two.h
+ - three.h
+ - <four.h>
+ :plugins:
+ - :cexception
+ :suite_setup: |
+ a_yaml_setup(); \ No newline at end of file
diff --git a/lab_6/unity/test/testdata/testsample.c b/lab_6/unity/test/testdata/testsample.c
new file mode 100644
index 0000000..e5a2b18
--- /dev/null
+++ b/lab_6/unity/test/testdata/testsample.c
@@ -0,0 +1,51 @@
+// This is just a sample test file to be used to test the generator script
+#ifndef TEST_SAMPLE_H
+#define TEST_SAMPLE_H
+
+#include <setjmp.h>
+#include "unity.h"
+#include "funky.h"
+#include "stanky.h"
+
+void setUp(void)
+{
+ CustomSetupStuff();
+}
+
+void tearDown(void)
+{
+ CustomTeardownStuff
+}
+
+//Yup, nice comment
+void test_TheFirstThingToTest(void)
+{
+ TEST_ASSERT(1);
+
+ TEST_ASSERT_TRUE(1);
+}
+
+/*
+void test_ShouldBeIgnored(void)
+{
+ DoesStuff();
+}
+*/
+
+//void test_ShouldAlsoNotBeTested(void)
+//{
+// Call_An_Expect();
+//
+// CallAFunction();
+// test_CallAFunctionThatLooksLikeATest();
+//}
+
+void test_TheSecondThingToTest(void)
+{
+ Call_An_Expect();
+
+ CallAFunction();
+ test_CallAFunctionThatLooksLikeATest();
+}
+
+#endif //TEST_SAMPLE_H
diff --git a/lab_6/unity/test/tests/Testfoo.c b/lab_6/unity/test/tests/Testfoo.c
new file mode 100644
index 0000000..72e0c1a
--- /dev/null
+++ b/lab_6/unity/test/tests/Testfoo.c
@@ -0,0 +1,84 @@
+#include "unity.h"
+#include "foo.h"
+
+void setUp(void)
+{
+}
+
+void tearDown(void)
+{
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_TRUE.
+void testTEST_ASSERT_TRUE (void)
+{
+ TEST_ASSERT_TRUE (1 == 1);
+ //TEST_ASSERT_TRUE (1 == 2); //failing
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_FALSE.
+void testTEST_ASSERT_FALSE (void)
+{
+ TEST_ASSERT_FALSE (1 == 2);
+ //TEST_ASSERT_FALSE (1 == 1); //failing
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_EQUAL_INT8.
+// Try it with negative decimal numbers, positive decimal numbers, and hexadecimal numbers.
+void testTEST_ASSERT_EQUAL_INT8 (void)
+{
+ TEST_ASSERT_EQUAL_INT8( 1, 1);
+ //TEST_ASSERT_EQUAL_INT8(-1, 1); //failing
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_EQUAL_UINT8.
+// Try it with negative decimal numbers, positive decimal numbers, and hexadecimal numbers.
+void testTEST_ASSERT_EQUAL_UINT8 (void)
+{
+ TEST_ASSERT_EQUAL_UINT8(1, 1);
+ //TEST_ASSERT_EQUAL_UINT8(1, -1); //failing
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_EQUAL_HEX8.
+// Try it with negative decimal numbers, positive decimal numbers, and hexadecimal numbers.
+void testTEST_ASSERT_EQUAL_HEX8 (void)
+{
+ TEST_ASSERT_EQUAL_HEX8( 0xff, 0xff );
+ //TEST_ASSERT_EQUAL_HEX8( 0x00, 0xff ); //failing
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_UINT_WITHIN.
+void testTEST_ASSERT_UINT_WITHIN (void)
+{
+ TEST_ASSERT_UINT_WITHIN(50, 75, 50);
+ //TEST_ASSERT_UINT_WITHIN(25, 75, 25);//failing
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_BITS.
+void testTEST_ASSERT_BITS (void)
+{
+ TEST_ASSERT_BITS(0xa5, 0xe7, 0xa5 );
+ //TEST_ASSERT_BITS(0xa5, 0xa4, 0xe7 );//failing
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_BITS_HIGH.
+void testTEST_ASSERT_BITS_HIGH (void)
+{
+ TEST_ASSERT_BITS_HIGH(0xa5, 0xe7);
+ //TEST_ASSERT_BITS_HIGH(0xe7, 0xa5);//failing
+}
+
+// Create one passing and one failing assertion using TEST_ASSERT_BIT_HIGH.
+void testTEST_ASSERT_BIT_HIGH (void)
+{
+ TEST_ASSERT_BIT_HIGH(2, 4);
+ //TEST_ASSERT_BIT_HIGH(3, 4);//failing
+}
+
+// Exhaustively test all 256 input values for the squareNumber function located in lab6\unity\src\foo.c.
+// squareNumber takes an 8-bit unsigned integer as input, squares it, and then returns the squared value as a 16-bit
+// unsigned integer.
+void testsquareNumber (void)
+{
+
+} \ No newline at end of file
diff --git a/lab_6/unity/test/tests/test_generate_test_runner.rb b/lab_6/unity/test/tests/test_generate_test_runner.rb
new file mode 100644
index 0000000..1f60f98
--- /dev/null
+++ b/lab_6/unity/test/tests/test_generate_test_runner.rb
@@ -0,0 +1,88 @@
+# ==========================================
+# CMock Project - Automatic Mock Generation for C
+# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
+# [Released under MIT License. Please refer to license.txt for details]
+# ==========================================
+
+require '../auto/generate_test_runner.rb'
+
+TEST_FILE = 'testdata/testsample.c'
+TEST_MOCK = 'testdata/mocksample.c'
+OUT_FILE = 'build/testsample_'
+EXP_FILE = 'expectdata/testsample_'
+
+$generate_test_runner_failures = 0
+
+def verify_output_equal(subtest)
+ expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n")
+ actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n")
+ if (expected != actual)
+ report(" #{subtest}:FAIL")
+ $generate_test_runner_failures += 1
+ else
+ report(" #{subtest}:PASS")
+ end
+end
+
+should "GenerateARunnerByCreatingRunnerWithOptions" do
+ sets = { 'def' => nil,
+ 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true },
+ 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" }
+ }
+
+ 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
+
+should "GenerateARunnerByRunningRunnerWithOptions" do
+ sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true },
+ 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" }
+ }
+
+ sets.each_pair do |subtest, options|
+ UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options)
+ verify_output_equal(subtest)
+ UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options)
+ verify_output_equal('mock_' + subtest)
+ end
+end
+
+should "GenerateARunnerByPullingYamlOptions" do
+ subtest = 'yaml'
+ cmdstr = "ruby ../auto/generate_test_runner.rb testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\""
+ `#{cmdstr}`
+ verify_output_equal(subtest)
+
+ cmdstr = "ruby ../auto/generate_test_runner.rb testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\""
+ `#{cmdstr}`
+ verify_output_equal('mock_' + subtest)
+end
+
+should "GenerateARunnerByPullingCommandlineOptions" do
+ subtest = 'cmd'
+ cmdstr = "ruby ../auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\""
+ `#{cmdstr}`
+ verify_output_equal(subtest)
+
+ cmdstr = "ruby ../auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\""
+ `#{cmdstr}`
+ verify_output_equal('mock_' + subtest)
+end
+
+should "GenerateARunnerThatUsesParameterizedTests" do
+ 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
+
+raise "There were #{$generate_test_runner_failures.to_s} failures while testing generate_test_runner.rb" if ($generate_test_runner_failures > 0)