ceedling 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/bin/ceedling +3 -5
  4. data/ceedling-0.21.0.gem +0 -0
  5. data/ceedling.gemspec +1 -0
  6. data/lib/ceedling/configurator.rb +7 -1
  7. data/lib/ceedling/configurator_plugins.rb +21 -21
  8. data/lib/ceedling/generator_test_runner.rb +3 -46
  9. data/lib/ceedling/setupinator.rb +1 -0
  10. data/lib/ceedling/version.rb +4 -4
  11. data/plugins/module_generator/lib/module_generator.rb +14 -127
  12. data/plugins/module_generator/module_generator.rake +15 -3
  13. data/spec/spec_system_helper.rb +1 -1
  14. data/vendor/c_exception/release/build.info +1 -1
  15. data/vendor/c_exception/release/version.info +1 -1
  16. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -146
  17. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +1 -1
  18. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
  19. data/vendor/c_exception/vendor/unity/examples/example_2/makefile +1 -1
  20. data/vendor/c_exception/vendor/unity/examples/unity_config.h +11 -19
  21. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +22 -26
  22. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +9 -9
  23. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +15 -6
  24. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +15 -15
  25. data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +7 -13
  26. data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +6 -6
  27. data/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +6 -6
  28. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +36 -29
  29. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -6
  30. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -6
  31. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +6 -6
  32. data/vendor/c_exception/vendor/unity/release/build.info +1 -1
  33. data/vendor/c_exception/vendor/unity/release/version.info +1 -1
  34. data/vendor/c_exception/vendor/unity/src/unity.c +45 -72
  35. data/vendor/c_exception/vendor/unity/src/unity.h +3 -4
  36. data/vendor/c_exception/vendor/unity/src/unity_internals.h +71 -109
  37. data/vendor/c_exception/vendor/unity/test/Makefile +25 -13
  38. data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +0 -1
  39. data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +0 -1
  40. data/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +11 -5
  41. data/vendor/c_exception/vendor/unity/test/tests/testunity.c +32 -29
  42. data/vendor/cmock/docs/CMock_Summary.md +4 -0
  43. data/vendor/cmock/lib/cmock_config.rb +7 -2
  44. data/vendor/cmock/lib/cmock_generator.rb +9 -1
  45. data/vendor/cmock/release/build.info +1 -1
  46. data/vendor/cmock/release/version.info +1 -1
  47. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +7 -0
  48. data/vendor/cmock/vendor/c_exception/release/build.info +1 -1
  49. data/vendor/cmock/vendor/c_exception/release/version.info +1 -1
  50. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -146
  51. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +1 -1
  52. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
  53. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +1 -1
  54. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +11 -19
  55. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +22 -26
  56. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +9 -9
  57. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +15 -6
  58. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +15 -15
  59. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +7 -13
  60. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +6 -6
  61. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +6 -6
  62. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +36 -29
  63. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -6
  64. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -6
  65. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +6 -6
  66. data/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info +1 -1
  67. data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +1 -1
  68. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +45 -72
  69. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +3 -4
  70. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +71 -109
  71. data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +25 -13
  72. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +0 -1
  73. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +0 -1
  74. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +11 -5
  75. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +32 -29
  76. data/vendor/cmock/vendor/unity/auto/generate_module.rb +202 -146
  77. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +1 -1
  78. data/vendor/cmock/vendor/unity/examples/example_1/makefile +1 -1
  79. data/vendor/cmock/vendor/unity/examples/example_2/makefile +1 -1
  80. data/vendor/cmock/vendor/unity/examples/unity_config.h +11 -19
  81. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +22 -26
  82. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +9 -9
  83. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +15 -6
  84. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +15 -15
  85. data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +7 -13
  86. data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +6 -6
  87. data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +6 -6
  88. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +36 -29
  89. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -6
  90. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -6
  91. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +6 -6
  92. data/vendor/cmock/vendor/unity/release/build.info +1 -1
  93. data/vendor/cmock/vendor/unity/release/version.info +1 -1
  94. data/vendor/cmock/vendor/unity/src/unity.c +45 -72
  95. data/vendor/cmock/vendor/unity/src/unity.h +3 -4
  96. data/vendor/cmock/vendor/unity/src/unity_internals.h +71 -109
  97. data/vendor/cmock/vendor/unity/test/Makefile +25 -13
  98. data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +0 -1
  99. data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +0 -1
  100. data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +11 -5
  101. data/vendor/cmock/vendor/unity/test/tests/testunity.c +32 -29
  102. data/vendor/unity/auto/generate_module.rb +202 -146
  103. data/vendor/unity/auto/generate_test_runner.rb +1 -1
  104. data/vendor/unity/examples/example_1/makefile +1 -1
  105. data/vendor/unity/examples/example_2/makefile +1 -1
  106. data/vendor/unity/examples/unity_config.h +11 -19
  107. data/vendor/unity/extras/fixture/src/unity_fixture.c +22 -26
  108. data/vendor/unity/extras/fixture/src/unity_fixture.h +9 -9
  109. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +15 -6
  110. data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +15 -15
  111. data/vendor/unity/extras/fixture/test/Makefile +7 -13
  112. data/vendor/unity/extras/fixture/test/main/AllTests.c +6 -6
  113. data/vendor/unity/extras/fixture/test/template_fixture_tests.c +6 -6
  114. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +36 -29
  115. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -6
  116. data/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -6
  117. data/vendor/unity/extras/fixture/test/unity_output_Spy.h +6 -6
  118. data/vendor/unity/release/build.info +1 -1
  119. data/vendor/unity/release/version.info +1 -1
  120. data/vendor/unity/src/unity.c +45 -72
  121. data/vendor/unity/src/unity.h +3 -4
  122. data/vendor/unity/src/unity_internals.h +71 -109
  123. data/vendor/unity/test/Makefile +25 -13
  124. data/vendor/unity/test/targets/gcc_32.yml +0 -1
  125. data/vendor/unity/test/targets/gcc_64.yml +0 -1
  126. data/vendor/unity/test/tests/testparameterized.c +11 -5
  127. data/vendor/unity/test/tests/testunity.c +32 -29
  128. metadata +17 -6
  129. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -48
  130. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -48
  131. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -48
  132. data/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -48
@@ -1,9 +1,15 @@
1
- CC ?= gcc
1
+ CC = gcc
2
2
  ifeq ($(shell uname -s), Darwin)
3
- CC ?= clang
3
+ CC = clang
4
+ CFLAGS += -std=c99 -pedantic -Wall -Weverything -Werror
5
+ CFLAGS += -Wno-unknown-warning-option -Wno-switch-enum
6
+ CFLAGS += -Wno-padded -Wno-double-promotion -Wno-missing-noreturn
7
+ CFLAGS += -Wno-missing-prototypes
8
+ endif
9
+ ifeq ($(shell uname -s), Linux)
10
+ CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
4
11
  endif
5
12
  #DEBUG = -O0 -g
6
- CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror -Wredundant-decls
7
13
  CFLAGS += $(DEBUG)
8
14
  DEFINES = -D UNITY_OUTPUT_CHAR=putcharSpy
9
15
  DEFINES += -D UNITY_SUPPORT_64 -D UNITY_INCLUDE_DOUBLE -D UNITY_NO_WEAK
@@ -14,10 +20,9 @@ BUILD_DIR = build
14
20
  TARGET = build/testunity-cov.exe
15
21
 
16
22
  # To generate coverage, call 'make -s', the default target runs.
17
- # To see missing coverage, follow up with 'make uncovered'.
18
23
  # For verbose output of all the tests, run 'make test'.
19
24
  default: coverage
20
- .PHONY: default coverage uncovered test clean
25
+ .PHONY: default coverage test clean
21
26
  coverage: $(BUILD_DIR)/testunityRunner.c
22
27
  cd $(BUILD_DIR) && \
23
28
  $(CC) $(CFLAGS) $(DEFINES) $(foreach i,$(SRC), ../$i) $(COV_FLAGS) -o ../$(TARGET)
@@ -28,21 +33,28 @@ coverage: $(BUILD_DIR)/testunityRunner.c
28
33
  grep '###' $(BUILD_DIR)/unity.c.gcov -C2 || true
29
34
 
30
35
  test: CFLAGS += -Wbad-function-cast -Wcast-qual -Wconversion -Wformat=2 -Wold-style-definition \
31
- -Wpointer-arith -Wshadow -Wstrict-overflow=5 -Wstrict-prototypes -Wswitch-default -Wundef \
32
- -Wunreachable-code -Wunused -fstrict-aliasing
36
+ -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-overflow=5 -Wstrict-prototypes \
37
+ -Wswitch-default -Wundef -Wunreachable-code -Wunused -fstrict-aliasing
33
38
  test: $(BUILD_DIR)/testunityRunner.c
34
39
  $(CC) $(CFLAGS) $(DEFINES) $(INC_DIR) $(SRC) -o $(TARGET)
35
40
  ./$(TARGET)
36
41
 
42
+ # Compile only, for testing that preprocessor detection works
43
+ UNITY_C_ONLY =-c ../src/unity.c -o $(BUILD_DIR)/unity.o
44
+ intDetection:
45
+ $(CC) $(CFLAGS) $(INC_DIR) $(UNITY_C_ONLY) -D UNITY_EXCLUDE_STDINT_H
46
+ $(CC) $(CFLAGS) $(INC_DIR) $(UNITY_C_ONLY) -D UNITY_EXCLUDE_LIMITS_H
47
+
37
48
  $(BUILD_DIR)/testunityRunner.c: tests/testunity.c | $(BUILD_DIR)
38
49
  awk $(AWK_SCRIPT) tests/testunity.c > $@
39
50
 
40
- AWK_SCRIPT='/^void test/{ declarations[d++]=$$0; gsub(/\(?void\)? ?/,""); tests[t++]=$$0 } \
41
- END{ print "\#include \"unity.h\" //Autogenerated by awk in Makefile" ; \
42
- for (i=0; i<d; i++) { print declarations[i] ";" } \
43
- printf "int main()\n{\n UNITY_BEGIN();\n" ; \
44
- for (i=0; i<t; i++) { print " RUN_TEST(" tests[i] ");" } \
45
- printf " return UNITY_END();\n}\n" }'
51
+ AWK_SCRIPT=\
52
+ '/^void test/{ declarations[d++]=$$0; gsub(/\(?void\)? ?/,""); tests[t++]=$$0; line[u++]=NR } \
53
+ END{ print "\#include \"unity.h\" /* Autogenerated by awk in Makefile */" ; \
54
+ for (i=0; i<d; i++) { print declarations[i] ";" } \
55
+ printf "int main(void)\n{\n UNITY_BEGIN();\n" ; \
56
+ for (i=0; i<t; i++) { print " RUN_TEST(" tests[i] ", " line[i] ");" } \
57
+ printf " return UNITY_END();\n}\n" }'
46
58
 
47
59
  $(BUILD_DIR):
48
60
  mkdir -p $(BUILD_DIR)
@@ -22,7 +22,6 @@ compiler:
22
22
  items:
23
23
  - UNITY_EXCLUDE_STDINT_H
24
24
  - UNITY_EXCLUDE_LIMITS_H
25
- - UNITY_EXCLUDE_SIZEOF
26
25
  - UNITY_INCLUDE_DOUBLE
27
26
  - UNITY_SUPPORT_TEST_CASES
28
27
  - UNITY_INT_WIDTH=32
@@ -22,7 +22,6 @@ compiler:
22
22
  items:
23
23
  - UNITY_EXCLUDE_STDINT_H
24
24
  - UNITY_EXCLUDE_LIMITS_H
25
- - UNITY_EXCLUDE_SIZEOF
26
25
  - UNITY_INCLUDE_DOUBLE
27
26
  - UNITY_SUPPORT_TEST_CASES
28
27
  - UNITY_SUPPORT_64
@@ -18,20 +18,26 @@ void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking t
18
18
 
19
19
  #define VERIFY_FAILS_END \
20
20
  } \
21
- Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \
21
+ Unity.CurrentTestFailed = (Unity.CurrentTestFailed != 0) ? 0 : 1; \
22
22
  if (Unity.CurrentTestFailed == 1) { \
23
23
  SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
24
- UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \
24
+ UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
25
+ UNITY_OUTPUT_CHAR(':'); \
26
+ UnityPrint(Unity.CurrentTestName); \
27
+ UnityPrint(":FAIL: [[[[ Test Should Have Failed But Did Not ]]]]"); \
25
28
  UNITY_OUTPUT_CHAR('\n'); \
26
29
  }
27
30
 
28
31
  #define VERIFY_IGNORES_END \
29
32
  } \
30
- Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \
33
+ Unity.CurrentTestFailed = (Unity.CurrentTestIgnored != 0) ? 0 : 1; \
31
34
  Unity.CurrentTestIgnored = 0; \
32
35
  if (Unity.CurrentTestFailed == 1) { \
33
36
  SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
34
- UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \
37
+ UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
38
+ UNITY_OUTPUT_CHAR(':'); \
39
+ UnityPrint(Unity.CurrentTestName); \
40
+ UnityPrint(":FAIL: [[[[ Test Should Have Ignored But Did Not ]]]]"); \
35
41
  UNITY_OUTPUT_CHAR('\n'); \
36
42
  }
37
43
 
@@ -50,7 +56,7 @@ void tearDown(void)
50
56
  TEST_FAIL_MESSAGE("<= Failed in tearDown");
51
57
  if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0))
52
58
  {
53
- UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]");
59
+ UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]");
54
60
  UNITY_OUTPUT_CHAR('\n');
55
61
  }
56
62
  }
@@ -4,8 +4,8 @@
4
4
  [Released under MIT License. Please refer to license.txt for details]
5
5
  ========================================== */
6
6
 
7
- #include <setjmp.h>
8
7
  #include "unity.h"
8
+ #include <setjmp.h>
9
9
  #include <string.h>
10
10
 
11
11
  // Dividing by these constants produces +/- infinity.
@@ -19,31 +19,42 @@ static const _UD d_zero = 0.0;
19
19
  #endif
20
20
 
21
21
  #define EXPECT_ABORT_BEGIN \
22
+ startPutcharSpy(); \
22
23
  if (TEST_PROTECT()) \
23
24
  {
24
25
 
25
26
  #define VERIFY_FAILS_END \
26
27
  } \
28
+ endPutcharSpy(); /* start/end Spy to suppress output of failure message */ \
27
29
  Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \
28
30
  if (Unity.CurrentTestFailed == 1) { \
29
31
  SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
30
32
  UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
31
33
  UNITY_OUTPUT_CHAR(':'); \
32
34
  UnityPrint(Unity.CurrentTestName); \
33
- UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \
35
+ UnityPrint(":FAIL: [[[[ Test Should Have Failed But Did Not ]]]]"); \
34
36
  UNITY_OUTPUT_CHAR('\n'); \
35
37
  }
36
38
 
37
39
  #define VERIFY_IGNORES_END \
38
40
  } \
41
+ endPutcharSpy(); /* start/end Spy to suppress output of ignore message */ \
39
42
  Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \
40
43
  Unity.CurrentTestIgnored = 0; \
41
44
  if (Unity.CurrentTestFailed == 1) { \
42
45
  SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
43
- UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \
46
+ UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
47
+ UNITY_OUTPUT_CHAR(':'); \
48
+ UnityPrint(Unity.CurrentTestName); \
49
+ UnityPrint(":FAIL: [[[[ Test Should Have Ignored But Did Not ]]]]"); \
44
50
  UNITY_OUTPUT_CHAR('\n'); \
45
51
  }
46
52
 
53
+ void startPutcharSpy(void);
54
+ void endPutcharSpy(void);
55
+ char* getBufferPutcharSpy(void);
56
+ void putcharSpy(int c);
57
+
47
58
  static int SetToOneToFailInTearDown;
48
59
  static int SetToOneMeanWeAlreadyCheckedThisGuy;
49
60
 
@@ -59,7 +70,7 @@ void tearDown(void)
59
70
  TEST_FAIL_MESSAGE("<= Failed in tearDown");
60
71
  if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0))
61
72
  {
62
- UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]");
73
+ UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]");
63
74
  UNITY_OUTPUT_CHAR('\n');
64
75
  }
65
76
  }
@@ -1370,7 +1381,7 @@ void testNotEqualString4(void)
1370
1381
  void testNotEqualStringLen4(void)
1371
1382
  {
1372
1383
  EXPECT_ABORT_BEGIN
1373
- TEST_ASSERT_EQUAL_STRING_LEN("\r\x16", "bar\n", 4);
1384
+ TEST_ASSERT_EQUAL_STRING_LEN("ba\r\x16", "ba\r\n", 4);
1374
1385
  VERIFY_FAILS_END
1375
1386
  }
1376
1387
 
@@ -2272,6 +2283,14 @@ void testFailureCountIncrementsAndIsReturnedAtEnd(void)
2272
2283
  TEST_ASSERT_EQUAL(1, failures);
2273
2284
  }
2274
2285
 
2286
+ void testCstringsEscapeSequence(void)
2287
+ {
2288
+ startPutcharSpy();
2289
+ UnityPrint("\x16\x10");
2290
+ endPutcharSpy();
2291
+ TEST_ASSERT_EQUAL_STRING("\\x16\\x10", getBufferPutcharSpy());
2292
+ }
2293
+
2275
2294
  #define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \
2276
2295
  startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \
2277
2296
  TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \
@@ -2778,14 +2797,12 @@ void testFloatsNotEqualExpectedNaN(void)
2778
2797
  #endif
2779
2798
  }
2780
2799
 
2781
- void testFloatsNotEqualBothNaN(void)
2800
+ void testFloatsEqualBothNaN(void)
2782
2801
  {
2783
2802
  #ifdef UNITY_EXCLUDE_FLOAT
2784
2803
  TEST_IGNORE();
2785
2804
  #else
2786
- EXPECT_ABORT_BEGIN
2787
2805
  TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero);
2788
- VERIFY_FAILS_END
2789
2806
  #endif
2790
2807
  }
2791
2808
 
@@ -2833,14 +2850,12 @@ void testFloatsNotEqualExpectedInf(void)
2833
2850
  #endif
2834
2851
  }
2835
2852
 
2836
- void testFloatsNotEqualBothInf(void)
2853
+ void testFloatsEqualBothInf(void)
2837
2854
  {
2838
2855
  #ifdef UNITY_EXCLUDE_FLOAT
2839
2856
  TEST_IGNORE();
2840
2857
  #else
2841
- EXPECT_ABORT_BEGIN
2842
2858
  TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
2843
- VERIFY_FAILS_END
2844
2859
  #endif
2845
2860
  }
2846
2861
 
@@ -3175,7 +3190,7 @@ void testNotEqualFloatArraysNegative3(void)
3175
3190
  #endif
3176
3191
  }
3177
3192
 
3178
- void testNotEqualFloatArraysNaN(void)
3193
+ void testEqualFloatArraysNaN(void)
3179
3194
  {
3180
3195
  #ifdef UNITY_EXCLUDE_FLOAT
3181
3196
  TEST_IGNORE();
@@ -3183,13 +3198,11 @@ void testNotEqualFloatArraysNaN(void)
3183
3198
  float p0[] = {1.0f, 0.0f / f_zero, 25.4f, 0.253f};
3184
3199
  float p1[] = {1.0f, 0.0f / f_zero, 25.4f, 0.253f};
3185
3200
 
3186
- EXPECT_ABORT_BEGIN
3187
3201
  TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
3188
- VERIFY_FAILS_END
3189
3202
  #endif
3190
3203
  }
3191
3204
 
3192
- void testNotEqualFloatArraysInf(void)
3205
+ void testEqualFloatArraysInf(void)
3193
3206
  {
3194
3207
  #ifdef UNITY_EXCLUDE_FLOAT
3195
3208
  TEST_IGNORE();
@@ -3197,9 +3210,7 @@ void testNotEqualFloatArraysInf(void)
3197
3210
  float p0[] = {1.0f, 1.0f / f_zero, 25.4f, 0.253f};
3198
3211
  float p1[] = {1.0f, 1.0f / f_zero, 25.4f, 0.253f};
3199
3212
 
3200
- EXPECT_ABORT_BEGIN
3201
3213
  TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
3202
- VERIFY_FAILS_END
3203
3214
  #endif
3204
3215
  }
3205
3216
 
@@ -3310,14 +3321,12 @@ void testDoublesNotEqualExpectedNaN(void)
3310
3321
  #endif
3311
3322
  }
3312
3323
 
3313
- void testDoublesNotEqualBothNaN(void)
3324
+ void testDoublesEqualBothNaN(void)
3314
3325
  {
3315
3326
  #ifdef UNITY_EXCLUDE_DOUBLE
3316
3327
  TEST_IGNORE();
3317
3328
  #else
3318
- EXPECT_ABORT_BEGIN
3319
3329
  TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero);
3320
- VERIFY_FAILS_END
3321
3330
  #endif
3322
3331
  }
3323
3332
 
@@ -3365,14 +3374,12 @@ void testDoublesNotEqualExpectedInf(void)
3365
3374
  #endif
3366
3375
  }
3367
3376
 
3368
- void testDoublesNotEqualBothInf(void)
3377
+ void testDoublesEqualBothInf(void)
3369
3378
  {
3370
3379
  #ifdef UNITY_EXCLUDE_DOUBLE
3371
3380
  TEST_IGNORE();
3372
3381
  #else
3373
- EXPECT_ABORT_BEGIN
3374
3382
  TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
3375
- VERIFY_FAILS_END
3376
3383
  #endif
3377
3384
  }
3378
3385
 
@@ -3706,7 +3713,7 @@ void testNotEqualDoubleArraysNegative3(void)
3706
3713
  #endif
3707
3714
  }
3708
3715
 
3709
- void testNotEqualDoubleArraysNaN(void)
3716
+ void testEqualDoubleArraysNaN(void)
3710
3717
  {
3711
3718
  #ifdef UNITY_EXCLUDE_DOUBLE
3712
3719
  TEST_IGNORE();
@@ -3714,13 +3721,11 @@ void testNotEqualDoubleArraysNaN(void)
3714
3721
  double p0[] = {1.0, 0.0 / d_zero, 25.4, 0.253};
3715
3722
  double p1[] = {1.0, 0.0 / d_zero, 25.4, 0.253};
3716
3723
 
3717
- EXPECT_ABORT_BEGIN
3718
3724
  TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
3719
- VERIFY_FAILS_END
3720
3725
  #endif
3721
3726
  }
3722
3727
 
3723
- void testNotEqualDoubleArraysInf(void)
3728
+ void testEqualDoubleArraysInf(void)
3724
3729
  {
3725
3730
  #ifdef UNITY_EXCLUDE_DOUBLE
3726
3731
  TEST_IGNORE();
@@ -3728,9 +3733,7 @@ void testNotEqualDoubleArraysInf(void)
3728
3733
  double p0[] = {1.0, 1.0 / d_zero, 25.4, 0.253};
3729
3734
  double p1[] = {1.0, 1.0 / d_zero, 25.4, 0.253};
3730
3735
 
3731
- EXPECT_ABORT_BEGIN
3732
3736
  TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
3733
- VERIFY_FAILS_END
3734
3737
  #endif
3735
3738
  }
3736
3739
 
@@ -287,6 +287,10 @@ Defined in the yaml file, they look more like this:
287
287
  * `:mock_suffix`:
288
288
  The suffix to append to your mock files. Defaults to “”.
289
289
 
290
+ * `:weak`:
291
+ When set to some value, the generated mocks are defined as weak symbols using the configured format. Defaults to ''.
292
+ Set to '__attribute ((weak))' for weak mocks when using GCC. Set to any non-empty string for weak mocks when using IAR.
293
+
290
294
  * `:subdir`:
291
295
  Relative subdir for your mocks. Set this to e.g. "sys" in order to
292
296
  create mock for `sys/types.h` in `:mock_path`/sys/
@@ -12,6 +12,7 @@ class CMockConfig
12
12
  :mock_path => 'mocks',
13
13
  :mock_prefix => 'Mock',
14
14
  :mock_suffix => '',
15
+ :weak => '',
15
16
  :subdir => nil,
16
17
  :plugins => [],
17
18
  :strippables => ['(?:__attribute__\s*\(+.*?\)+)'],
@@ -58,6 +59,7 @@ class CMockConfig
58
59
  end
59
60
  end
60
61
  options[:unity_helper_path] ||= options[:unity_helper]
62
+ options[:unity_helper_path] = [options[:unity_helper_path]] if options[:unity_helper_path].is_a? String
61
63
  options[:plugins].compact!
62
64
  options[:plugins].map! {|p| p.to_sym}
63
65
  @options = options
@@ -84,8 +86,11 @@ class CMockConfig
84
86
  end
85
87
 
86
88
  def load_unity_helper
87
- return File.new(@options[:unity_helper_path]).read if (@options[:unity_helper_path])
88
- return nil
89
+ return nil unless (@options[:unity_helper_path])
90
+
91
+ return @options[:unity_helper_path].inject("") do |unity_helper, filename|
92
+ unity_helper + "\n" + File.new(filename).read
93
+ end
89
94
  end
90
95
 
91
96
  def standard_treat_as_map
@@ -6,7 +6,7 @@
6
6
 
7
7
  class CMockGenerator
8
8
 
9
- attr_accessor :config, :file_writer, :module_name, :clean_mock_name, :mock_name, :utils, :plugins, :ordered
9
+ attr_accessor :config, :file_writer, :module_name, :clean_mock_name, :mock_name, :utils, :plugins, :weak, :ordered
10
10
 
11
11
  def initialize(config, file_writer, utils, plugins)
12
12
  @file_writer = file_writer
@@ -15,6 +15,7 @@ class CMockGenerator
15
15
  @config = config
16
16
  @prefix = @config.mock_prefix
17
17
  @suffix = @config.mock_suffix
18
+ @weak = @config.weak
18
19
  @ordered = @config.enforce_strict_ordering
19
20
  @framework = @config.framework.to_s
20
21
 
@@ -211,6 +212,13 @@ class CMockGenerator
211
212
  args_string += (", " + function[:var_arg]) unless (function[:var_arg].nil?)
212
213
 
213
214
  # Create mock function
215
+ if (not @weak.empty?)
216
+ file << "#if defined (__IAR_SYSTEMS_ICC__)\n"
217
+ file << "#pragma weak #{function[:name]}\n"
218
+ file << "#else\n"
219
+ file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string}) #{weak};\n"
220
+ file << "#endif\n\n"
221
+ end
214
222
  file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n"
215
223
  file << "{\n"
216
224
  file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n"
@@ -1,2 +1,2 @@
1
- 214
1
+ 215
2
2
 
@@ -1,2 +1,2 @@
1
- 2.4.2
1
+ 2.4.3
2
2
 
@@ -44,6 +44,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
44
44
  #no strict handling
45
45
  @config.expect :mock_prefix, "Mock"
46
46
  @config.expect :mock_suffix, ""
47
+ @config.expect :weak, ""
47
48
  @config.expect :enforce_strict_ordering, nil
48
49
  @config.expect :framework, :unity
49
50
  @config.expect :includes, ["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]
@@ -60,6 +61,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
60
61
  #strict handling
61
62
  @config.expect :mock_prefix, "Mock"
62
63
  @config.expect :mock_suffix, ""
64
+ @config.expect :weak, ""
63
65
  @config.expect :enforce_strict_ordering, true
64
66
  @config.expect :framework, :unity
65
67
  @config.expect :includes, nil
@@ -80,6 +82,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
80
82
  it "create the top of a header file with optional include files from config and include file from plugin" do
81
83
  @config.expect :mock_prefix, "Mock"
82
84
  @config.expect :mock_suffix, ""
85
+ @config.expect :weak, ""
83
86
  orig_filename = "PoutPoutFish.h"
84
87
  define_name = "MOCKPOUTPOUTFISH_H"
85
88
  mock_name = "MockPoutPoutFish"
@@ -116,6 +119,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
116
119
  #no strict handling
117
120
  @config.expect :mock_prefix, "Mock"
118
121
  @config.expect :mock_suffix, ""
122
+ @config.expect :weak, ""
119
123
  @config.expect :enforce_strict_ordering, nil
120
124
  @config.expect :framework, :unity
121
125
  @config.expect :includes, ["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]
@@ -130,6 +134,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
130
134
 
131
135
  @config.expect :mock_prefix, "Mock"
132
136
  @config.expect :mock_suffix, ""
137
+ @config.expect :weak, ""
133
138
  orig_filename = "Pout-Pout Fish.h"
134
139
  define_name = "MOCKPOUT_POUT_FISH_H"
135
140
  mock_name = "MockPout_Pout_Fish"
@@ -165,6 +170,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
165
170
  it "create the top of a header file with optional include files from config" do
166
171
  @config.expect :mock_prefix, "Mock"
167
172
  @config.expect :mock_suffix, ""
173
+ @config.expect :weak, ""
168
174
  orig_filename = "PoutPoutFish.h"
169
175
  define_name = "MOCKPOUTPOUTFISH_H"
170
176
  mock_name = "MockPoutPoutFish"
@@ -199,6 +205,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
199
205
  it "create the top of a header file with include file from plugin" do
200
206
  @config.expect :mock_prefix, "Mock"
201
207
  @config.expect :mock_suffix, ""
208
+ @config.expect :weak, ""
202
209
  orig_filename = "PoutPoutFish.h"
203
210
  define_name = "MOCKPOUTPOUTFISH_H"
204
211
  mock_name = "MockPoutPoutFish"