ceedling 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ceedling.gemspec +1 -1
- data/lib/ceedling/version.rb +2 -2
- data/lib/ceedling/version.rb.erb +1 -2
- data/test_graveyard/unit/busted/generator_test_runner_test.rb +2 -5
- data/vendor/cmock/Gemfile +1 -3
- data/vendor/cmock/Rakefile +10 -17
- data/vendor/cmock/docs/license.txt +18 -30
- data/vendor/cmock/examples/gcc.yml +2 -2
- data/vendor/cmock/examples/iar_v4.yml +3 -3
- data/vendor/cmock/examples/iar_v5.yml +3 -3
- data/vendor/cmock/examples/rakefile_helper.rb +35 -35
- data/vendor/cmock/lib/cmock_generator.rb +17 -5
- data/vendor/cmock/lib/cmock_generator_plugin_array.rb +9 -3
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +1 -1
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +1 -1
- data/vendor/cmock/lib/cmock_header_parser.rb +7 -3
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +1 -2
- data/vendor/cmock/test/c/TestCMockC_Runner.c +1 -1
- data/vendor/cmock/test/system/systest_generator.rb +6 -2
- data/vendor/cmock/test/system/test_compilation/const.h +3 -1
- data/vendor/cmock/test/test_helper.rb +38 -40
- data/vendor/cmock/test/unit/cmock_config_test.rb +26 -29
- data/vendor/cmock/test/unit/cmock_file_writer_test.rb +8 -11
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +82 -80
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +62 -43
- data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +44 -45
- data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +30 -31
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +15 -16
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb +76 -77
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +19 -19
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +17 -18
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +17 -17
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +74 -65
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +103 -76
- data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +46 -36
- data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +85 -85
- data/vendor/unity/auto/generate_test_runner.rb +4 -3
- data/vendor/unity/auto/type_sanitizer.rb +8 -0
- data/vendor/unity/auto/unity_test_summary.py +135 -0
- data/vendor/unity/examples/example_1/makefile +16 -0
- data/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -0
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +0 -13
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +0 -13
- data/vendor/unity/examples/example_2/makefile +20 -1
- data/vendor/unity/examples/example_2/src/ProductionCode2.c +2 -0
- data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +2 -2
- data/vendor/unity/examples/example_3/makefile +16 -0
- data/vendor/unity/examples/example_3/src/ProductionCode2.c +2 -0
- data/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +0 -13
- data/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +0 -13
- data/vendor/unity/extras/fixture/rakefile.rb +14 -3
- data/vendor/unity/extras/fixture/src/unity_fixture.c +21 -11
- data/vendor/unity/extras/fixture/src/unity_fixture.h +8 -4
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +5 -0
- data/vendor/unity/extras/fixture/test/main/AllTests.c +2 -2
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +8 -8
- data/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -2
- data/vendor/unity/extras/fixture/test/unity_output_Spy.h +2 -2
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +26 -19
- data/vendor/unity/src/unity_internals.h +9 -12
- data/vendor/unity/test/targets/gcc_auto_stdint.yml +13 -0
- metadata +4 -5
- data/vendor/cmock/test/spec/cmock_file_writer_spec.rb +0 -45
- data/vendor/cmock/test/spec/cmock_generator_plugin_array_spec.rb +0 -52
- data/vendor/cmock/test/spec/spec_helper.rb +0 -12
@@ -0,0 +1,135 @@
|
|
1
|
+
#! python3
|
2
|
+
# ==========================================
|
3
|
+
# Unity Project - A Test Framework for C
|
4
|
+
# Copyright (c) 2015 Alexander Mueller / XelaRellum@web.de
|
5
|
+
# [Released under MIT License. Please refer to license.txt for details]
|
6
|
+
# Based on the ruby script by Mike Karlesky, Mark VanderVoord, Greg Williams
|
7
|
+
# ==========================================
|
8
|
+
import sys
|
9
|
+
import os
|
10
|
+
import re
|
11
|
+
from glob import glob
|
12
|
+
|
13
|
+
class UnityTestSummary:
|
14
|
+
def __init__(self):
|
15
|
+
self.report = ''
|
16
|
+
self.total_tests = 0
|
17
|
+
self.failures = 0
|
18
|
+
self.ignored = 0
|
19
|
+
|
20
|
+
def run(self):
|
21
|
+
# Clean up result file names
|
22
|
+
results = []
|
23
|
+
for target in self.targets:
|
24
|
+
results.append(target.replace('\\', '/'))
|
25
|
+
|
26
|
+
# Dig through each result file, looking for details on pass/fail:
|
27
|
+
failure_output = []
|
28
|
+
ignore_output = []
|
29
|
+
|
30
|
+
for result_file in results:
|
31
|
+
lines = list(map(lambda line: line.rstrip(), open(result_file, "r").read().split('\n')))
|
32
|
+
if len(lines) == 0:
|
33
|
+
raise Exception("Empty test result file: %s" % result_file)
|
34
|
+
|
35
|
+
details = self.get_details(result_file, lines)
|
36
|
+
failures = details['failures']
|
37
|
+
ignores = details['ignores']
|
38
|
+
if len(failures) > 0: failure_output.append('\n'.join(failures))
|
39
|
+
if len(ignores) > 0: ignore_output.append('n'.join(ignores))
|
40
|
+
tests,failures,ignored = self.parse_test_summary('\n'.join(lines))
|
41
|
+
self.total_tests += tests
|
42
|
+
self.failures += failures
|
43
|
+
self.ignored += ignored
|
44
|
+
|
45
|
+
if self.ignored > 0:
|
46
|
+
self.report += "\n"
|
47
|
+
self.report += "--------------------------\n"
|
48
|
+
self.report += "UNITY IGNORED TEST SUMMARY\n"
|
49
|
+
self.report += "--------------------------\n"
|
50
|
+
self.report += "\n".join(ignore_output)
|
51
|
+
|
52
|
+
if self.failures > 0:
|
53
|
+
self.report += "\n"
|
54
|
+
self.report += "--------------------------\n"
|
55
|
+
self.report += "UNITY FAILED TEST SUMMARY\n"
|
56
|
+
self.report += "--------------------------\n"
|
57
|
+
self.report += '\n'.join(failure_output)
|
58
|
+
|
59
|
+
self.report += "\n"
|
60
|
+
self.report += "--------------------------\n"
|
61
|
+
self.report += "OVERALL UNITY TEST SUMMARY\n"
|
62
|
+
self.report += "--------------------------\n"
|
63
|
+
self.report += "{total_tests} TOTAL TESTS {failures} TOTAL FAILURES {ignored} IGNORED\n".format(total_tests = self.total_tests, failures=self.failures, ignored=self.ignored)
|
64
|
+
self.report += "\n"
|
65
|
+
|
66
|
+
return self.report
|
67
|
+
|
68
|
+
def set_targets(self, target_array):
|
69
|
+
self.targets = target_array
|
70
|
+
|
71
|
+
def set_root_path(self, path):
|
72
|
+
self.root = path
|
73
|
+
|
74
|
+
def usage(self, err_msg=None):
|
75
|
+
print("\nERROR: ")
|
76
|
+
if err_msg:
|
77
|
+
print(err_msg)
|
78
|
+
print("\nUsage: unity_test_summary.rb result_file_directory/ root_path/")
|
79
|
+
print(" result_file_directory - The location of your results files.")
|
80
|
+
print(" Defaults to current directory if not specified.")
|
81
|
+
print(" Should end in / if specified.")
|
82
|
+
print(" root_path - Helpful for producing more verbose output if using relative paths.")
|
83
|
+
sys.exit(1)
|
84
|
+
|
85
|
+
def get_details(self, result_file, lines):
|
86
|
+
results = { 'failures': [], 'ignores': [], 'successes': [] }
|
87
|
+
for line in lines:
|
88
|
+
parts = line.split(':')
|
89
|
+
if len(parts) != 5:
|
90
|
+
continue
|
91
|
+
src_file,src_line,test_name,status,msg = parts
|
92
|
+
if len(self.root) > 0:
|
93
|
+
line_out = "%s%s" % (self.root, line)
|
94
|
+
else:
|
95
|
+
line_out = line
|
96
|
+
if status == 'IGNORE':
|
97
|
+
results['ignores'].append(line_out)
|
98
|
+
elif status == 'FAIL':
|
99
|
+
results['failures'].append(line_out)
|
100
|
+
elif status == 'PASS':
|
101
|
+
results['successes'].append(line_out)
|
102
|
+
return results
|
103
|
+
|
104
|
+
def parse_test_summary(self, summary):
|
105
|
+
m = re.search(r"([0-9]+) Tests ([0-9]+) Failures ([0-9]+) Ignored", summary)
|
106
|
+
if not m:
|
107
|
+
raise Exception("Couldn't parse test results: %s" % summary)
|
108
|
+
|
109
|
+
return int(m.group(1)), int(m.group(2)), int(m.group(3))
|
110
|
+
|
111
|
+
|
112
|
+
if __name__ == '__main__':
|
113
|
+
uts = UnityTestSummary()
|
114
|
+
try:
|
115
|
+
#look in the specified or current directory for result files
|
116
|
+
if len(sys.argv) > 1:
|
117
|
+
targets_dir = sys.argv[1]
|
118
|
+
else:
|
119
|
+
targets_dir = './'
|
120
|
+
targets = list(map(lambda x: x.replace('\\', '/'), glob(targets_dir + '*.test*')))
|
121
|
+
if len(targets) == 0:
|
122
|
+
raise Exception("No *.testpass or *.testfail files found in '%s'" % targets_dir)
|
123
|
+
uts.set_targets(targets)
|
124
|
+
|
125
|
+
#set the root path
|
126
|
+
if len(sys.argv) > 2:
|
127
|
+
root_path = sys.argv[2]
|
128
|
+
else:
|
129
|
+
root_path = os.path.split(__file__)[0]
|
130
|
+
uts.set_root_path(root_path)
|
131
|
+
|
132
|
+
#run the summarizer
|
133
|
+
print(uts.run())
|
134
|
+
except Exception as e:
|
135
|
+
uts.usage(e)
|
@@ -21,7 +21,23 @@ endif
|
|
21
21
|
|
22
22
|
UNITY_ROOT=../..
|
23
23
|
C_COMPILER=gcc
|
24
|
+
|
24
25
|
CFLAGS=-std=c99
|
26
|
+
CFLAGS += -Wall
|
27
|
+
CFLAGS += -Wextra
|
28
|
+
CFLAGS += -Werror
|
29
|
+
CFLAGS += -Wpointer-arith
|
30
|
+
CFLAGS += -Wcast-align
|
31
|
+
CFLAGS += -Wwrite-strings
|
32
|
+
CFLAGS += -Wswitch-default
|
33
|
+
CFLAGS += -Wunreachable-code
|
34
|
+
CFLAGS += -Winit-self
|
35
|
+
CFLAGS += -Wmissing-field-initializers
|
36
|
+
CFLAGS += -Wno-unknown-pragmas
|
37
|
+
CFLAGS += -Wstrict-prototypes
|
38
|
+
CFLAGS += -Wundef
|
39
|
+
CFLAGS += -Wold-style-definition
|
40
|
+
|
25
41
|
TARGET_BASE1=test1
|
26
42
|
TARGET_BASE2=test2
|
27
43
|
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
|
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction)
|
5
5
|
{
|
6
|
+
(void)Poor;
|
7
|
+
(void)LittleFunction;
|
6
8
|
//Since There Are No Tests Yet, This Function Could Be Empty For All We Know.
|
7
9
|
// Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget
|
8
10
|
return (char*)0;
|
@@ -12,18 +12,6 @@ extern void test_IgnoredTest(void);
|
|
12
12
|
extern void test_AnotherIgnoredTest(void);
|
13
13
|
extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void);
|
14
14
|
|
15
|
-
static void runTest(UnityTestFunction test)
|
16
|
-
{
|
17
|
-
if (TEST_PROTECT())
|
18
|
-
{
|
19
|
-
setUp();
|
20
|
-
test();
|
21
|
-
}
|
22
|
-
if (TEST_PROTECT() && !TEST_IS_IGNORED)
|
23
|
-
{
|
24
|
-
tearDown();
|
25
|
-
}
|
26
|
-
}
|
27
15
|
void resetTest(void);
|
28
16
|
void resetTest(void)
|
29
17
|
{
|
@@ -36,7 +24,6 @@ int main(void)
|
|
36
24
|
{
|
37
25
|
UnityBegin("test/TestProductionCode2.c");
|
38
26
|
|
39
|
-
// RUN_TEST calls runTest
|
40
27
|
RUN_TEST(test_IgnoredTest, 13);
|
41
28
|
RUN_TEST(test_AnotherIgnoredTest, 18);
|
42
29
|
RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23);
|
@@ -14,18 +14,6 @@ extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounter
|
|
14
14
|
extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void);
|
15
15
|
extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void);
|
16
16
|
|
17
|
-
static void runTest(UnityTestFunction test)
|
18
|
-
{
|
19
|
-
if (TEST_PROTECT())
|
20
|
-
{
|
21
|
-
setUp();
|
22
|
-
test();
|
23
|
-
}
|
24
|
-
if (TEST_PROTECT() && !TEST_IS_IGNORED)
|
25
|
-
{
|
26
|
-
tearDown();
|
27
|
-
}
|
28
|
-
}
|
29
17
|
void resetTest(void);
|
30
18
|
void resetTest(void)
|
31
19
|
{
|
@@ -38,7 +26,6 @@ int main(void)
|
|
38
26
|
{
|
39
27
|
UnityBegin("test/TestProductionCode.c");
|
40
28
|
|
41
|
-
// RUN_TEST calls runTest
|
42
29
|
RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20);
|
43
30
|
RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30);
|
44
31
|
RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41);
|
@@ -21,6 +21,25 @@ endif
|
|
21
21
|
|
22
22
|
UNITY_ROOT=../..
|
23
23
|
C_COMPILER=gcc
|
24
|
+
|
25
|
+
CFLAGS = -std=c99
|
26
|
+
CFLAGS += -Wall
|
27
|
+
CFLAGS += -Wextra
|
28
|
+
CFLAGS += -Werror
|
29
|
+
CFLAGS += -Wpointer-arith
|
30
|
+
CFLAGS += -Wcast-align
|
31
|
+
CFLAGS += -Wwrite-strings
|
32
|
+
CFLAGS += -Wswitch-default
|
33
|
+
CFLAGS += -Wunreachable-code
|
34
|
+
CFLAGS += -Winit-self
|
35
|
+
CFLAGS += -Wmissing-field-initializers
|
36
|
+
CFLAGS += -Wno-unknown-pragmas
|
37
|
+
CFLAGS += -Wstrict-prototypes
|
38
|
+
CFLAGS += -Wundef
|
39
|
+
CFLAGS += -Wold-style-definition
|
40
|
+
CFLAGS += -Wmissing-prototypes
|
41
|
+
CFLAGS += -Wmissing-declarations
|
42
|
+
|
24
43
|
TARGET_BASE1=all_tests
|
25
44
|
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
|
26
45
|
SRC_FILES1=\
|
@@ -41,7 +60,7 @@ all: clean default
|
|
41
60
|
default:
|
42
61
|
# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c
|
43
62
|
# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c
|
44
|
-
$(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
|
63
|
+
$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
|
45
64
|
./$(TARGET1)
|
46
65
|
|
47
66
|
clean:
|
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction)
|
5
5
|
{
|
6
|
+
(void)Poor;
|
7
|
+
(void)LittleFunction;
|
6
8
|
//Since There Are No Tests Yet, This Function Could Be Empty For All We Know.
|
7
9
|
// Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget
|
8
10
|
return (char*)0;
|
@@ -21,7 +21,23 @@ endif
|
|
21
21
|
|
22
22
|
UNITY_ROOT=../..
|
23
23
|
C_COMPILER=gcc
|
24
|
+
|
24
25
|
CFLAGS=-std=c99
|
26
|
+
CFLAGS += -Wall
|
27
|
+
CFLAGS += -Wextra
|
28
|
+
CFLAGS += -Werror
|
29
|
+
CFLAGS += -Wpointer-arith
|
30
|
+
CFLAGS += -Wcast-align
|
31
|
+
CFLAGS += -Wwrite-strings
|
32
|
+
CFLAGS += -Wswitch-default
|
33
|
+
CFLAGS += -Wunreachable-code
|
34
|
+
CFLAGS += -Winit-self
|
35
|
+
CFLAGS += -Wmissing-field-initializers
|
36
|
+
CFLAGS += -Wno-unknown-pragmas
|
37
|
+
CFLAGS += -Wstrict-prototypes
|
38
|
+
CFLAGS += -Wundef
|
39
|
+
CFLAGS += -Wold-style-definition
|
40
|
+
|
25
41
|
TARGET_BASE1=test1
|
26
42
|
TARGET_BASE2=test2
|
27
43
|
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
|
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction)
|
5
5
|
{
|
6
|
+
(void)Poor;
|
7
|
+
(void)LittleFunction;
|
6
8
|
//Since There Are No Tests Yet, This Function Could Be Empty For All We Know.
|
7
9
|
// Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget
|
8
10
|
return (char*)0;
|
@@ -12,18 +12,6 @@ extern void test_IgnoredTest(void);
|
|
12
12
|
extern void test_AnotherIgnoredTest(void);
|
13
13
|
extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void);
|
14
14
|
|
15
|
-
static void runTest(UnityTestFunction test)
|
16
|
-
{
|
17
|
-
if (TEST_PROTECT())
|
18
|
-
{
|
19
|
-
setUp();
|
20
|
-
test();
|
21
|
-
}
|
22
|
-
if (TEST_PROTECT() && !TEST_IS_IGNORED)
|
23
|
-
{
|
24
|
-
tearDown();
|
25
|
-
}
|
26
|
-
}
|
27
15
|
void resetTest(void);
|
28
16
|
void resetTest(void)
|
29
17
|
{
|
@@ -36,7 +24,6 @@ int main(void)
|
|
36
24
|
{
|
37
25
|
UnityBegin("test/TestProductionCode2.c");
|
38
26
|
|
39
|
-
// RUN_TEST calls runTest
|
40
27
|
RUN_TEST(test_IgnoredTest, 13);
|
41
28
|
RUN_TEST(test_AnotherIgnoredTest, 18);
|
42
29
|
RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 23);
|
@@ -14,18 +14,6 @@ extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounter
|
|
14
14
|
extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void);
|
15
15
|
extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void);
|
16
16
|
|
17
|
-
static void runTest(UnityTestFunction test)
|
18
|
-
{
|
19
|
-
if (TEST_PROTECT())
|
20
|
-
{
|
21
|
-
setUp();
|
22
|
-
test();
|
23
|
-
}
|
24
|
-
if (TEST_PROTECT() && !TEST_IS_IGNORED)
|
25
|
-
{
|
26
|
-
tearDown();
|
27
|
-
}
|
28
|
-
}
|
29
17
|
void resetTest(void);
|
30
18
|
void resetTest(void)
|
31
19
|
{
|
@@ -38,7 +26,6 @@ int main(void)
|
|
38
26
|
{
|
39
27
|
UnityBegin("test/TestProductionCode.c");
|
40
28
|
|
41
|
-
// RUN_TEST calls runTest
|
42
29
|
RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20);
|
43
30
|
RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30);
|
44
31
|
RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Unity Project - A Test Framework for C
|
3
3
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
5
|
-
# ==========================================
|
5
|
+
# ==========================================
|
6
6
|
|
7
7
|
HERE = File.expand_path(File.dirname(__FILE__)) + '/'
|
8
8
|
|
@@ -11,13 +11,24 @@ require 'rake/clean'
|
|
11
11
|
require 'rake/testtask'
|
12
12
|
require HERE + 'rakefile_helper'
|
13
13
|
|
14
|
+
TEMP_DIRS = [
|
15
|
+
File.join(HERE, 'build')
|
16
|
+
]
|
17
|
+
|
18
|
+
TEMP_DIRS.each do |dir|
|
19
|
+
directory(dir)
|
20
|
+
CLOBBER.include(dir)
|
21
|
+
end
|
22
|
+
|
23
|
+
task :prepare_for_tests => TEMP_DIRS
|
24
|
+
|
14
25
|
include RakefileHelpers
|
15
26
|
|
16
27
|
# Load default configuration, for now
|
17
|
-
DEFAULT_CONFIG_FILE = '
|
28
|
+
DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml'
|
18
29
|
configure_toolchain(DEFAULT_CONFIG_FILE)
|
19
30
|
|
20
|
-
task :unit do
|
31
|
+
task :unit => [:prepare_for_tests] do
|
21
32
|
run_tests
|
22
33
|
end
|
23
34
|
|
@@ -17,10 +17,12 @@ int (*outputChar)(int) = putchar;
|
|
17
17
|
|
18
18
|
int verbose = 0;
|
19
19
|
|
20
|
+
void setUp(void);
|
21
|
+
void tearDown(void);
|
20
22
|
void setUp(void) { /*does nothing*/ }
|
21
23
|
void tearDown(void) { /*does nothing*/ }
|
22
24
|
|
23
|
-
void announceTestRun(unsigned int runNumber)
|
25
|
+
static void announceTestRun(unsigned int runNumber)
|
24
26
|
{
|
25
27
|
UnityPrint("Unity test run ");
|
26
28
|
UnityPrintNumber(runNumber+1);
|
@@ -29,7 +31,7 @@ void announceTestRun(unsigned int runNumber)
|
|
29
31
|
UNITY_OUTPUT_CHAR('\n');
|
30
32
|
}
|
31
33
|
|
32
|
-
int UnityMain(int argc, char* argv[], void (*runAllTests)(void))
|
34
|
+
int UnityMain(int argc, const char* argv[], void (*runAllTests)(void))
|
33
35
|
{
|
34
36
|
int result = UnityGetCommandLineOptions(argc, argv);
|
35
37
|
unsigned int r;
|
@@ -38,8 +40,8 @@ int UnityMain(int argc, char* argv[], void (*runAllTests)(void))
|
|
38
40
|
|
39
41
|
for (r = 0; r < UnityFixture.RepeatCount; r++)
|
40
42
|
{
|
41
|
-
announceTestRun(r);
|
42
43
|
UnityBegin(argv[0]);
|
44
|
+
announceTestRun(r);
|
43
45
|
runAllTests();
|
44
46
|
UNITY_OUTPUT_CHAR('\n');
|
45
47
|
UnityEnd();
|
@@ -65,7 +67,7 @@ static int groupSelected(const char* group)
|
|
65
67
|
return selected(UnityFixture.GroupFilter, group);
|
66
68
|
}
|
67
69
|
|
68
|
-
static void runTestCase()
|
70
|
+
static void runTestCase(void)
|
69
71
|
{
|
70
72
|
|
71
73
|
}
|
@@ -132,13 +134,13 @@ void UnityIgnoreTest(const char * printableName)
|
|
132
134
|
static int malloc_count;
|
133
135
|
static int malloc_fail_countdown = MALLOC_DONT_FAIL;
|
134
136
|
|
135
|
-
void UnityMalloc_StartTest()
|
137
|
+
void UnityMalloc_StartTest(void)
|
136
138
|
{
|
137
139
|
malloc_count = 0;
|
138
140
|
malloc_fail_countdown = MALLOC_DONT_FAIL;
|
139
141
|
}
|
140
142
|
|
141
|
-
void UnityMalloc_EndTest()
|
143
|
+
void UnityMalloc_EndTest(void)
|
142
144
|
{
|
143
145
|
malloc_fail_countdown = MALLOC_DONT_FAIL;
|
144
146
|
if (malloc_count != 0)
|
@@ -160,6 +162,14 @@ void UnityMalloc_MakeMallocFailAfterCount(int countdown)
|
|
160
162
|
#undef free
|
161
163
|
#endif
|
162
164
|
|
165
|
+
#ifdef calloc
|
166
|
+
#undef calloc
|
167
|
+
#endif
|
168
|
+
|
169
|
+
#ifdef realloc
|
170
|
+
#undef realloc
|
171
|
+
#endif
|
172
|
+
|
163
173
|
#include <stdlib.h>
|
164
174
|
#include <string.h>
|
165
175
|
|
@@ -274,7 +284,7 @@ enum {MAX_POINTERS=50};
|
|
274
284
|
static PointerPair pointer_store[MAX_POINTERS];
|
275
285
|
static int pointer_index = 0;
|
276
286
|
|
277
|
-
void UnityPointer_Init()
|
287
|
+
void UnityPointer_Init(void)
|
278
288
|
{
|
279
289
|
pointer_index = 0;
|
280
290
|
}
|
@@ -290,7 +300,7 @@ void UnityPointer_Set(void ** pointer, void * newValue)
|
|
290
300
|
pointer_index++;
|
291
301
|
}
|
292
302
|
|
293
|
-
void UnityPointer_UndoAllSets()
|
303
|
+
void UnityPointer_UndoAllSets(void)
|
294
304
|
{
|
295
305
|
while (pointer_index > 0)
|
296
306
|
{
|
@@ -301,12 +311,12 @@ void UnityPointer_UndoAllSets()
|
|
301
311
|
}
|
302
312
|
}
|
303
313
|
|
304
|
-
int UnityFailureCount()
|
314
|
+
int UnityFailureCount(void)
|
305
315
|
{
|
306
316
|
return Unity.TestFailures;
|
307
317
|
}
|
308
318
|
|
309
|
-
int UnityGetCommandLineOptions(int argc, char* argv[])
|
319
|
+
int UnityGetCommandLineOptions(int argc, const char* argv[])
|
310
320
|
{
|
311
321
|
int i;
|
312
322
|
UnityFixture.Verbose = 0;
|
@@ -360,7 +370,7 @@ int UnityGetCommandLineOptions(int argc, char* argv[])
|
|
360
370
|
return 0;
|
361
371
|
}
|
362
372
|
|
363
|
-
void UnityConcludeFixtureTest()
|
373
|
+
void UnityConcludeFixtureTest(void)
|
364
374
|
{
|
365
375
|
if (Unity.CurrentTestIgnored)
|
366
376
|
{
|