ceedling 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/bin/ceedling +3 -5
- data/ceedling-0.21.0.gem +0 -0
- data/ceedling.gemspec +1 -0
- data/lib/ceedling/configurator.rb +7 -1
- data/lib/ceedling/configurator_plugins.rb +21 -21
- data/lib/ceedling/generator_test_runner.rb +3 -46
- data/lib/ceedling/setupinator.rb +1 -0
- data/lib/ceedling/version.rb +4 -4
- data/plugins/module_generator/lib/module_generator.rb +14 -127
- data/plugins/module_generator/module_generator.rake +15 -3
- data/spec/spec_system_helper.rb +1 -1
- data/vendor/c_exception/release/build.info +1 -1
- data/vendor/c_exception/release/version.info +1 -1
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -146
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +1 -1
- data/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/c_exception/vendor/unity/examples/example_2/makefile +1 -1
- data/vendor/c_exception/vendor/unity/examples/unity_config.h +11 -19
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +22 -26
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +9 -9
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +15 -6
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +15 -15
- data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +7 -13
- data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +6 -6
- data/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +6 -6
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +36 -29
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -6
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -6
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +6 -6
- data/vendor/c_exception/vendor/unity/release/build.info +1 -1
- data/vendor/c_exception/vendor/unity/release/version.info +1 -1
- data/vendor/c_exception/vendor/unity/src/unity.c +45 -72
- data/vendor/c_exception/vendor/unity/src/unity.h +3 -4
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +71 -109
- data/vendor/c_exception/vendor/unity/test/Makefile +25 -13
- data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +0 -1
- data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +0 -1
- data/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +11 -5
- data/vendor/c_exception/vendor/unity/test/tests/testunity.c +32 -29
- data/vendor/cmock/docs/CMock_Summary.md +4 -0
- data/vendor/cmock/lib/cmock_config.rb +7 -2
- data/vendor/cmock/lib/cmock_generator.rb +9 -1
- data/vendor/cmock/release/build.info +1 -1
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +7 -0
- data/vendor/cmock/vendor/c_exception/release/build.info +1 -1
- data/vendor/cmock/vendor/c_exception/release/version.info +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -146
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +11 -19
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +22 -26
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +9 -9
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +15 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +15 -15
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +7 -13
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +36 -29
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +45 -72
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +3 -4
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +71 -109
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +25 -13
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +0 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +0 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +11 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +32 -29
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +202 -146
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/makefile +1 -1
- data/vendor/cmock/vendor/unity/examples/unity_config.h +11 -19
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +22 -26
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +9 -9
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +15 -6
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +15 -15
- data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +7 -13
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +6 -6
- data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +6 -6
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +36 -29
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -6
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -6
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +6 -6
- data/vendor/cmock/vendor/unity/release/build.info +1 -1
- data/vendor/cmock/vendor/unity/release/version.info +1 -1
- data/vendor/cmock/vendor/unity/src/unity.c +45 -72
- data/vendor/cmock/vendor/unity/src/unity.h +3 -4
- data/vendor/cmock/vendor/unity/src/unity_internals.h +71 -109
- data/vendor/cmock/vendor/unity/test/Makefile +25 -13
- data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +0 -1
- data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +0 -1
- data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +11 -5
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +32 -29
- data/vendor/unity/auto/generate_module.rb +202 -146
- data/vendor/unity/auto/generate_test_runner.rb +1 -1
- data/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/unity/examples/example_2/makefile +1 -1
- data/vendor/unity/examples/unity_config.h +11 -19
- data/vendor/unity/extras/fixture/src/unity_fixture.c +22 -26
- data/vendor/unity/extras/fixture/src/unity_fixture.h +9 -9
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +15 -6
- data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +15 -15
- data/vendor/unity/extras/fixture/test/Makefile +7 -13
- data/vendor/unity/extras/fixture/test/main/AllTests.c +6 -6
- data/vendor/unity/extras/fixture/test/template_fixture_tests.c +6 -6
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +36 -29
- data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -6
- data/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -6
- data/vendor/unity/extras/fixture/test/unity_output_Spy.h +6 -6
- data/vendor/unity/release/build.info +1 -1
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +45 -72
- data/vendor/unity/src/unity.h +3 -4
- data/vendor/unity/src/unity_internals.h +71 -109
- data/vendor/unity/test/Makefile +25 -13
- data/vendor/unity/test/targets/gcc_32.yml +0 -1
- data/vendor/unity/test/targets/gcc_64.yml +0 -1
- data/vendor/unity/test/tests/testparameterized.c +11 -5
- data/vendor/unity/test/tests/testunity.c +32 -29
- metadata +17 -6
- data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -48
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -48
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -48
- data/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -48
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
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
|
-
|
154
|
-
|
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
|
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);
|
293
|
-
return unity_malloc(size);
|
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;
|
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
|
-
|
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
|
-
|
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
|
417
|
+
else /* Unity.CurrentTestFailed */
|
422
418
|
{
|
423
419
|
Unity.TestFailures++;
|
424
420
|
UNITY_PRINT_EOL();
|
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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))
|
data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
|
data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
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();
|
145
|
+
UnityConcludeFixtureTest(); /* Resets TestFailed for this test to pass */
|
146
146
|
Unity.CurrentTestIgnored = 1;
|
147
|
-
UnityConcludeFixtureTest();
|
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
|
-
|
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
|
355
|
+
#define USING_OUTPUT_SPY /* UNITY_OUTPUT_CHAR = UnityOutputCharSpy_OutputChar */
|
356
356
|
#endif
|
357
|
-
#endif
|
357
|
+
#endif /* >= 199901 */
|
358
358
|
|
359
|
-
#else
|
359
|
+
#else /* __STDC_VERSION__ else */
|
360
360
|
#define UnityOutputCharSpy_OutputChar 42
|
361
|
-
#if UNITY_OUTPUT_CHAR == UnityOutputCharSpy_OutputChar
|
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
|
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;
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
}
|