ceedling 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,9 @@
1
- //- Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- /* ==========================================
3
- Unity Project - A Test Framework for C
4
- Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- [Released under MIT License. Please refer to license.txt for details]
6
- ========================================== */
1
+ /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
+ * ==========================================
3
+ * Unity Project - A Test Framework for C
4
+ * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
+ * [Released under MIT License. Please refer to license.txt for details]
6
+ * ========================================== */
7
7
 
8
8
  #include <string.h>
9
9
  #include "unity_fixture.h"
@@ -11,9 +11,9 @@
11
11
 
12
12
  struct _UnityFixture UnityFixture;
13
13
 
14
- //If you decide to use the function pointer approach.
15
- //Build with -D UNITY_OUTPUT_CHAR=outputChar and include <stdio.h>
16
- //int (*outputChar)(int) = putchar;
14
+ /* If you decide to use the function pointer approach.
15
+ * Build with -D UNITY_OUTPUT_CHAR=outputChar and include <stdio.h>
16
+ * int (*outputChar)(int) = putchar; */
17
17
 
18
18
  #if !defined(UNITY_WEAK_ATTRIBUTE) && !defined(UNITY_WEAK_PRAGMA)
19
19
  void setUp(void) { /*does nothing*/ }
@@ -41,7 +41,7 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void))
41
41
  UnityBegin(argv[0]);
42
42
  announceTestRun(r);
43
43
  runAllTests();
44
- UNITY_PRINT_EOL();
44
+ if (!UnityFixture.Verbose) UNITY_PRINT_EOL();
45
45
  UnityEnd();
46
46
  }
47
47
 
@@ -123,9 +123,8 @@ void UnityIgnoreTest(const char* printableName, const char* group, const char* n
123
123
  }
124
124
 
125
125
 
126
- //-------------------------------------------------
127
- //Malloc and free stuff
128
- //
126
+ /*------------------------------------------------- */
127
+ /* Malloc and free stuff */
129
128
  #define MALLOC_DONT_FAIL -1
130
129
  static int malloc_count;
131
130
  static int malloc_fail_countdown = MALLOC_DONT_FAIL;
@@ -150,8 +149,8 @@ void UnityMalloc_MakeMallocFailAfterCount(int countdown)
150
149
  malloc_fail_countdown = countdown;
151
150
  }
152
151
 
153
- // These definitions are always included from unity_fixture_malloc_overrides.h
154
- // We undef to use them or avoid conflict with <stdlib.h> per the C standard
152
+ /* These definitions are always included from unity_fixture_malloc_overrides.h */
153
+ /* We undef to use them or avoid conflict with <stdlib.h> per the C standard */
155
154
  #undef malloc
156
155
  #undef free
157
156
  #undef calloc
@@ -207,9 +206,6 @@ void* unity_malloc(size_t size)
207
206
  mem = (char*)&(guard[1]);
208
207
  memcpy(&mem[size], end, sizeof(end));
209
208
 
210
- #ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_
211
- free(guard);
212
- #endif
213
209
  return (void*)mem;
214
210
  }
215
211
 
@@ -285,24 +281,24 @@ void* unity_realloc(void* oldMem, size_t size)
285
281
 
286
282
  if (guard->size >= size) return oldMem;
287
283
 
288
- #ifdef UNITY_EXCLUDE_STDLIB_MALLOC // Optimization if memory is expandable
284
+ #ifdef UNITY_EXCLUDE_STDLIB_MALLOC /* Optimization if memory is expandable */
289
285
  if (oldMem == unity_heap + heap_index - guard->size - sizeof(end) &&
290
286
  heap_index + size - guard->size <= UNITY_INTERNAL_HEAP_SIZE_BYTES)
291
287
  {
292
- release_memory(oldMem); // Not thread-safe, like unity_heap generally
293
- return unity_malloc(size); // No memcpy since data is in place
288
+ release_memory(oldMem); /* Not thread-safe, like unity_heap generally */
289
+ return unity_malloc(size); /* No memcpy since data is in place */
294
290
  }
295
291
  #endif
296
292
  newMem = unity_malloc(size);
297
- if (newMem == NULL) return NULL; // Do not release old memory
293
+ if (newMem == NULL) return NULL; /* Do not release old memory */
298
294
  memcpy(newMem, oldMem, guard->size);
299
295
  release_memory(oldMem);
300
296
  return newMem;
301
297
  }
302
298
 
303
299
 
304
- //--------------------------------------------------------
305
- //Automatic pointer restoration functions
300
+ /*-------------------------------------------------------- */
301
+ /*Automatic pointer restoration functions */
306
302
  struct PointerPair
307
303
  {
308
304
  void** pointer;
@@ -396,7 +392,7 @@ int UnityGetCommandLineOptions(int argc, const char* argv[])
396
392
  }
397
393
  }
398
394
  } else {
399
- // ignore unknown parameter
395
+ /* ignore unknown parameter */
400
396
  i++;
401
397
  }
402
398
  }
@@ -418,7 +414,7 @@ void UnityConcludeFixtureTest(void)
418
414
  UNITY_PRINT_EOL();
419
415
  }
420
416
  }
421
- else // Unity.CurrentTestFailed
417
+ else /* Unity.CurrentTestFailed */
422
418
  {
423
419
  Unity.TestFailures++;
424
420
  UNITY_PRINT_EOL();
@@ -1,9 +1,9 @@
1
- //- Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- /* ==========================================
3
- Unity Project - A Test Framework for C
4
- Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- [Released under MIT License. Please refer to license.txt for details]
6
- ========================================== */
1
+ /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
+ * ==========================================
3
+ * Unity Project - A Test Framework for C
4
+ * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
+ * [Released under MIT License. Please refer to license.txt for details]
6
+ * ========================================== */
7
7
 
8
8
  #ifndef UNITY_FIXTURE_H_
9
9
  #define UNITY_FIXTURE_H_
@@ -53,17 +53,17 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void));
53
53
  { void TEST_##group##_##name##_run(void);\
54
54
  TEST_##group##_##name##_run(); }
55
55
 
56
- //This goes at the bottom of each test file or in a separate c file
56
+ /* This goes at the bottom of each test file or in a separate c file */
57
57
  #define TEST_GROUP_RUNNER(group)\
58
58
  void TEST_##group##_GROUP_RUNNER(void);\
59
59
  void TEST_##group##_GROUP_RUNNER(void)
60
60
 
61
- //Call this from main
61
+ /* Call this from main */
62
62
  #define RUN_TEST_GROUP(group)\
63
63
  { void TEST_##group##_GROUP_RUNNER(void);\
64
64
  TEST_##group##_GROUP_RUNNER(); }
65
65
 
66
- //CppUTest Compatibility Macros
66
+ /* CppUTest Compatibility Macros */
67
67
  #define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&(ptr), (void*)(newPointerValue), __LINE__)
68
68
  #define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR((expected), (actual))
69
69
  #define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual))
@@ -1,13 +1,18 @@
1
- //- Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- /* ==========================================
3
- Unity Project - A Test Framework for C
4
- Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- [Released under MIT License. Please refer to license.txt for details]
6
- ========================================== */
1
+ /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
+ * ==========================================
3
+ * Unity Project - A Test Framework for C
4
+ * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
+ * [Released under MIT License. Please refer to license.txt for details]
6
+ * ========================================== */
7
7
 
8
8
  #ifndef UNITY_FIXTURE_INTERNALS_H_
9
9
  #define UNITY_FIXTURE_INTERNALS_H_
10
10
 
11
+ #ifdef __cplusplus
12
+ extern "C"
13
+ {
14
+ #endif
15
+
11
16
  struct _UnityFixture
12
17
  {
13
18
  int Verbose;
@@ -36,4 +41,8 @@ void UnityPointer_Set(void** ptr, void* newValue, UNITY_LINE_TYPE line);
36
41
  void UnityPointer_UndoAllSets(void);
37
42
  void UnityPointer_Init(void);
38
43
 
44
+ #ifdef __cplusplus
45
+ }
46
+ #endif
47
+
39
48
  #endif /* UNITY_FIXTURE_INTERNALS_H_ */
@@ -1,9 +1,9 @@
1
- //- Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- /* ==========================================
3
- Unity Project - A Test Framework for C
4
- Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- [Released under MIT License. Please refer to license.txt for details]
6
- ========================================== */
1
+ /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
+ * ==========================================
3
+ * Unity Project - A Test Framework for C
4
+ * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
+ * [Released under MIT License. Please refer to license.txt for details]
6
+ * ========================================== */
7
7
 
8
8
  #ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_
9
9
  #define UNITY_FIXTURE_MALLOC_OVERRIDES_H_
@@ -11,20 +11,20 @@
11
11
  #include <stddef.h>
12
12
 
13
13
  #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
14
- // Define this macro to remove the use of stdlib.h, malloc, and free.
15
- // Many embedded systems do not have a heap or malloc/free by default.
16
- // This internal unity_malloc() provides allocated memory deterministically from
17
- // the end of an array only, unity_free() only releases from end-of-array,
18
- // blocks are not coalesced, and memory not freed in LIFO order is stranded.
14
+ /* Define this macro to remove the use of stdlib.h, malloc, and free.
15
+ * Many embedded systems do not have a heap or malloc/free by default.
16
+ * This internal unity_malloc() provides allocated memory deterministically from
17
+ * the end of an array only, unity_free() only releases from end-of-array,
18
+ * blocks are not coalesced, and memory not freed in LIFO order is stranded. */
19
19
  #ifndef UNITY_INTERNAL_HEAP_SIZE_BYTES
20
20
  #define UNITY_INTERNAL_HEAP_SIZE_BYTES 256
21
21
  #endif
22
22
  #endif
23
23
 
24
- // These functions are used by the Unity Fixture to allocate and release memory
25
- // on the heap and can be overridden with platform-specific implementations.
26
- // For example, when using FreeRTOS UNITY_FIXTURE_MALLOC becomes pvPortMalloc()
27
- // and UNITY_FIXTURE_FREE becomes vPortFree().
24
+ /* These functions are used by the Unity Fixture to allocate and release memory
25
+ * on the heap and can be overridden with platform-specific implementations.
26
+ * For example, when using FreeRTOS UNITY_FIXTURE_MALLOC becomes pvPortMalloc()
27
+ * and UNITY_FIXTURE_FREE becomes vPortFree(). */
28
28
  #if !defined(UNITY_FIXTURE_MALLOC) || !defined(UNITY_FIXTURE_FREE)
29
29
  #define UNITY_FIXTURE_MALLOC(size) malloc(size)
30
30
  #define UNITY_FIXTURE_FREE(ptr) free(ptr)
@@ -3,11 +3,7 @@ ifeq ($(shell uname -s), Darwin)
3
3
  CC = clang
4
4
  endif
5
5
  #DEBUG = -O0 -g
6
- CFLAGS += -std=c99
7
- CFLAGS += -pedantic
8
- CFLAGS += -Wall
9
- CFLAGS += -Wextra
10
- CFLAGS += -Werror
6
+ CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
11
7
  CFLAGS += $(DEBUG)
12
8
  DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar
13
9
  SRC = ../src/unity_fixture.c \
@@ -38,13 +34,11 @@ noStdlibMalloc: $(BUILD_DIR)
38
34
  @ echo "build with noStdlibMalloc"
39
35
  ./$(TARGET)
40
36
 
41
- clang89: ../build/
42
- clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32 -std=c89 -Wno-comment
43
- clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32 \
44
- -D UNITY_EXCLUDE_STDLIB_MALLOC -std=c89 -Wno-comment ; ./$(TARGET)
45
-
46
- clangEverything:
47
- clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -Weverything
37
+ C89: CFLAGS += -D UNITY_EXCLUDE_STDINT_H # C89 did not have type 'long long', <stdint.h>
38
+ C89: $(BUILD_DIR)
39
+ $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -std=c89 && ./$(TARGET)
40
+ $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC -std=c89
41
+ ./$(TARGET)
48
42
 
49
43
  $(BUILD_DIR):
50
44
  mkdir -p $(BUILD_DIR)
@@ -52,7 +46,7 @@ $(BUILD_DIR):
52
46
  clean:
53
47
  rm -f $(TARGET) $(BUILD_DIR)/*.gc*
54
48
 
55
- coverage: $(BUILD_DIR)
49
+ cov: $(BUILD_DIR)
56
50
  cd $(BUILD_DIR) && \
57
51
  $(CC) $(DEFINES) $(foreach i, $(SRC), ../test/$(i)) $(INC_DIR) -o $(TARGET) -fprofile-arcs -ftest-coverage
58
52
  rm -f $(BUILD_DIR)/*.gcda
@@ -1,9 +1,9 @@
1
- //- Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- /* ==========================================
3
- Unity Project - A Test Framework for C
4
- Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- [Released under MIT License. Please refer to license.txt for details]
6
- ========================================== */
1
+ /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
+ * ==========================================
3
+ * Unity Project - A Test Framework for C
4
+ * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
+ * [Released under MIT License. Please refer to license.txt for details]
6
+ * ========================================== */
7
7
 
8
8
  #include "unity_fixture.h"
9
9
 
@@ -1,9 +1,9 @@
1
- //- Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- /* ==========================================
3
- Unity Project - A Test Framework for C
4
- Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- [Released under MIT License. Please refer to license.txt for details]
6
- ========================================== */
1
+ /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
+ * ==========================================
3
+ * Unity Project - A Test Framework for C
4
+ * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
+ * [Released under MIT License. Please refer to license.txt for details]
6
+ * ========================================== */
7
7
 
8
8
  #include "unity_fixture.h"
9
9
 
@@ -1,9 +1,9 @@
1
- //- Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- /* ==========================================
3
- Unity Project - A Test Framework for C
4
- Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- [Released under MIT License. Please refer to license.txt for details]
6
- ========================================== */
1
+ /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
+ * ==========================================
3
+ * Unity Project - A Test Framework for C
4
+ * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
+ * [Released under MIT License. Please refer to license.txt for details]
6
+ * ========================================== */
7
7
 
8
8
  #include "unity_fixture.h"
9
9
  #include "unity_output_Spy.h"
@@ -79,7 +79,7 @@ TEST(UnityFixture, ReallocLargerNeeded)
79
79
  CHECK(m1);
80
80
  strcpy((char*)m1, "123456789");
81
81
  m2 = realloc(m1, 15);
82
- // CHECK(m1 != m2); //Depends on implementation
82
+ /* CHECK(m1 != m2); //Depends on implementation */
83
83
  STRCMP_EQUAL("123456789", m2);
84
84
  free(m2);
85
85
  }
@@ -142,9 +142,9 @@ TEST(UnityFixture, ConcludeTestIncrementsFailCount)
142
142
  _U_UINT savedIgnores = Unity.TestIgnores;
143
143
  UnityOutputCharSpy_Enable(1);
144
144
  Unity.CurrentTestFailed = 1;
145
- UnityConcludeFixtureTest(); // Resets TestFailed for this test to pass
145
+ UnityConcludeFixtureTest(); /* Resets TestFailed for this test to pass */
146
146
  Unity.CurrentTestIgnored = 1;
147
- UnityConcludeFixtureTest(); // Resets TestIgnored
147
+ UnityConcludeFixtureTest(); /* Resets TestIgnored */
148
148
  UnityOutputCharSpy_Enable(0);
149
149
  TEST_ASSERT_EQUAL(savedFails + 1, Unity.TestFailures);
150
150
  TEST_ASSERT_EQUAL(savedIgnores + 1, Unity.TestIgnores);
@@ -152,7 +152,7 @@ TEST(UnityFixture, ConcludeTestIncrementsFailCount)
152
152
  Unity.TestIgnores = savedIgnores;
153
153
  }
154
154
 
155
- //------------------------------------------------------------
155
+ /*------------------------------------------------------------ */
156
156
 
157
157
  TEST_GROUP(UnityCommandOptions);
158
158
 
@@ -312,7 +312,7 @@ IGNORE_TEST(UnityCommandOptions, TestShouldBeIgnored)
312
312
  TEST_FAIL_MESSAGE("This test should not run!");
313
313
  }
314
314
 
315
- //------------------------------------------------------------
315
+ /*------------------------------------------------------------ */
316
316
 
317
317
  TEST_GROUP(LeakDetection);
318
318
 
@@ -342,7 +342,7 @@ TEST_TEAR_DOWN(LeakDetection)
342
342
  memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \
343
343
  }
344
344
 
345
- // This tricky set of defines lets us see if we are using the Spy, returns 1 if true
345
+ /* This tricky set of defines lets us see if we are using the Spy, returns 1 if true */
346
346
  #ifdef __STDC_VERSION__
347
347
 
348
348
  #if __STDC_VERSION__ >= 199901L
@@ -352,17 +352,17 @@ TEST_TEAR_DOWN(LeakDetection)
352
352
  #define EXPAND_AND_USE_2ND(a, b) SECOND_PARAM(a, b, throwaway)
353
353
  #define SECOND_PARAM(a, b, ...) b
354
354
  #if USING_SPY_AS(UNITY_OUTPUT_CHAR)
355
- #define USING_OUTPUT_SPY // UNITY_OUTPUT_CHAR = UnityOutputCharSpy_OutputChar
355
+ #define USING_OUTPUT_SPY /* UNITY_OUTPUT_CHAR = UnityOutputCharSpy_OutputChar */
356
356
  #endif
357
- #endif // >= 199901
357
+ #endif /* >= 199901 */
358
358
 
359
- #else // __STDC_VERSION__ else
359
+ #else /* __STDC_VERSION__ else */
360
360
  #define UnityOutputCharSpy_OutputChar 42
361
- #if UNITY_OUTPUT_CHAR == UnityOutputCharSpy_OutputChar // Works if no -Wundef -Werror
361
+ #if UNITY_OUTPUT_CHAR == UnityOutputCharSpy_OutputChar /* Works if no -Wundef -Werror */
362
362
  #define USING_OUTPUT_SPY
363
363
  #endif
364
364
  #undef UnityOutputCharSpy_OutputChar
365
- #endif // __STDC_VERSION__
365
+ #endif /* __STDC_VERSION__ */
366
366
 
367
367
  TEST(LeakDetection, DetectsLeak)
368
368
  {
@@ -428,7 +428,7 @@ TEST(LeakDetection, BufferGuardWriteFoundDuringFree)
428
428
  void* m = malloc(10);
429
429
  char* s = (char*)m;
430
430
  TEST_ASSERT_NOT_NULL(m);
431
- s[-1] = (char)0x00; // Will not detect 0
431
+ s[-1] = (char)0x00; /* Will not detect 0 */
432
432
  s[-2] = (char)0x01;
433
433
  UnityOutputCharSpy_Enable(1);
434
434
  EXPECT_ABORT_BEGIN
@@ -476,9 +476,13 @@ TEST(LeakDetection, PointerSettingMax)
476
476
  #endif
477
477
  }
478
478
 
479
- //------------------------------------------------------------
479
+ /*------------------------------------------------------------ */
480
480
 
481
481
  TEST_GROUP(InternalMalloc);
482
+ #define TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(first_mem_ptr, ptr) \
483
+ ptr = malloc(10); free(ptr); \
484
+ TEST_ASSERT_EQUAL_PTR_MESSAGE(first_mem_ptr, ptr, "Memory was stranded, free in LIFO order");
485
+
482
486
 
483
487
  TEST_SETUP(InternalMalloc) { }
484
488
  TEST_TEAR_DOWN(InternalMalloc) { }
@@ -488,9 +492,10 @@ TEST(InternalMalloc, MallocPastBufferFails)
488
492
  #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
489
493
  void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
490
494
  void* n = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2);
495
+ free(m);
491
496
  TEST_ASSERT_NOT_NULL(m);
492
497
  TEST_ASSERT_NULL(n);
493
- free(m);
498
+ TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(m, n);
494
499
  #endif
495
500
  }
496
501
 
@@ -499,9 +504,10 @@ TEST(InternalMalloc, CallocPastBufferFails)
499
504
  #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
500
505
  void* m = calloc(1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
501
506
  void* n = calloc(1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2);
507
+ free(m);
502
508
  TEST_ASSERT_NOT_NULL(m);
503
509
  TEST_ASSERT_NULL(n);
504
- free(m);
510
+ TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(m, n);
505
511
  #endif
506
512
  }
507
513
 
@@ -510,9 +516,10 @@ TEST(InternalMalloc, MallocThenReallocGrowsMemoryInPlace)
510
516
  #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
511
517
  void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
512
518
  void* n = realloc(m, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 9);
519
+ free(n);
513
520
  TEST_ASSERT_NOT_NULL(m);
514
521
  TEST_ASSERT_EQUAL(m, n);
515
- free(n);
522
+ TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(m, n);
516
523
  #endif
517
524
  }
518
525
 
@@ -523,14 +530,14 @@ TEST(InternalMalloc, ReallocFailDoesNotFreeMem)
523
530
  void* n1 = malloc(10);
524
531
  void* out_of_mem = realloc(n1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
525
532
  void* n2 = malloc(10);
526
- TEST_ASSERT_NOT_NULL(m);
527
- if (out_of_mem == NULL)
528
- {
529
- free(n1);
530
- TEST_ASSERT_NULL(out_of_mem);
531
- }
532
- TEST_ASSERT_NOT_EQUAL(n2, n1);
533
+
533
534
  free(n2);
535
+ if (out_of_mem == NULL) free(n1);
534
536
  free(m);
537
+
538
+ TEST_ASSERT_NOT_NULL(m); /* Got a real memory location */
539
+ TEST_ASSERT_NULL(out_of_mem); /* The realloc should have failed */
540
+ TEST_ASSERT_NOT_EQUAL(n2, n1); /* If n1 != n2 then realloc did not free n1 */
541
+ TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(m, n2);
535
542
  #endif
536
543
  }