ceedling 0.15.6 → 0.16.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ceedling/version.rb +3 -3
  3. data/lib/ceedling/version.rb.erb +1 -1
  4. data/vendor/cmock/lib/cmock_config.rb +1 -0
  5. data/vendor/cmock/lib/cmock_generator.rb +1 -1
  6. data/vendor/cmock/lib/cmock_generator_utils.rb +1 -0
  7. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +4 -0
  8. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +3 -0
  9. data/vendor/unity/README.md +203 -0
  10. data/vendor/unity/auto/generate_test_runner.rb +45 -18
  11. data/vendor/unity/docs/license.txt +18 -28
  12. data/vendor/unity/examples/example_1/makefile +18 -13
  13. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +3 -3
  14. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +3 -3
  15. data/vendor/unity/examples/example_2/makefile +14 -10
  16. data/vendor/unity/examples/example_3/makefile +18 -13
  17. data/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +3 -3
  18. data/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +3 -3
  19. data/vendor/unity/extras/fixture/rakefile_helper.rb +18 -18
  20. data/vendor/unity/extras/fixture/src/unity_fixture.c +2 -1
  21. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  22. data/vendor/unity/src/unity.c +78 -55
  23. data/vendor/unity/src/unity_internals.h +7 -3
  24. data/vendor/unity/test/expectdata/testsample_cmd.c +3 -3
  25. data/vendor/unity/test/expectdata/testsample_def.c +3 -3
  26. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +3 -3
  27. data/vendor/unity/test/expectdata/testsample_mock_def.c +3 -3
  28. data/vendor/unity/test/expectdata/testsample_mock_new1.c +3 -3
  29. data/vendor/unity/test/expectdata/testsample_mock_new2.c +3 -3
  30. data/vendor/unity/test/expectdata/testsample_mock_param.c +3 -3
  31. data/vendor/unity/test/expectdata/testsample_mock_run1.c +3 -3
  32. data/vendor/unity/test/expectdata/testsample_mock_run2.c +3 -3
  33. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +3 -3
  34. data/vendor/unity/test/expectdata/testsample_new1.c +3 -3
  35. data/vendor/unity/test/expectdata/testsample_new2.c +3 -3
  36. data/vendor/unity/test/expectdata/testsample_param.c +3 -3
  37. data/vendor/unity/test/expectdata/testsample_run1.c +3 -3
  38. data/vendor/unity/test/expectdata/testsample_run2.c +3 -3
  39. data/vendor/unity/test/expectdata/testsample_yaml.c +3 -3
  40. data/vendor/unity/test/rakefile +1 -1
  41. data/vendor/unity/test/tests/test_generate_test_runner.rb +8 -8
  42. data/vendor/unity/test/tests/testunity.c +1 -1
  43. metadata +3 -3
  44. data/ceedling-0.15.5.gem +0 -0
@@ -1,31 +1,21 @@
1
- Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams
1
+ The MIT License (MIT)
2
2
 
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
3
+ Copyright (c) <year> 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
11
4
 
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
14
11
 
15
- The end-user documentation included with the redistribution, if
16
- any, must include the following acknowledgment: "This product
17
- includes software developed for the Unity Project, by Mike Karlesky,
18
- Mark VanderVoord, and Greg Williams and other contributors", in
19
- the same place and form as other third-party acknowledgments.
20
- Alternately, this acknowledgment may appear in the software
21
- itself, in the same form and location as other such third-party
22
- acknowledgments.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
26
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
28
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
29
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31
- OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -4,15 +4,26 @@
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
5
  # ==========================================
6
6
 
7
- UNITY_ROOT=../..
8
- C_COMPILER=gcc
9
- TARGET_BASE1=test1
10
- TARGET_BASE2=test2
11
- ifeq ($(OS),Windows_NT)
7
+ #We try to detect the OS we are running on, and adjust commands as needed
8
+ ifeq ($(OSTYPE),cygwin)
9
+ CLEANUP = rm -f
10
+ MKDIR = mkdir -p
11
+ TARGET_EXTENSION=.out
12
+ else ifeq ($(OS),Windows_NT)
13
+ CLEANUP = del /F /Q
14
+ MKDIR = mkdir
12
15
  TARGET_EXTENSION=.exe
13
16
  else
17
+ CLEANUP = rm -f
18
+ MKDIR = mkdir -p
14
19
  TARGET_EXTENSION=.out
15
20
  endif
21
+
22
+ UNITY_ROOT=../..
23
+ C_COMPILER=gcc
24
+ CFLAGS=-std=c99
25
+ TARGET_BASE1=test1
26
+ TARGET_BASE2=test2
16
27
  TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
17
28
  TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION)
18
29
  SRC_FILES1=$(UNITY_ROOT)/src/unity.c src/ProductionCode.c test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c
@@ -20,19 +31,13 @@ SRC_FILES2=$(UNITY_ROOT)/src/unity.c src/ProductionCode2.c test/TestProductionCo
20
31
  INC_DIRS=-Isrc -I$(UNITY_ROOT)/src
21
32
  SYMBOLS=-DTEST
22
33
 
23
- ifeq ($(OS),Windows_NT)
24
- CLEANUP = del /F /Q $(TARGET1) && del /F /Q $(TARGET2)
25
- else
26
- CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2)
27
- endif
28
-
29
34
  all: clean default
30
35
 
31
36
  default:
32
37
  # ruby auto/generate_test_runner.rb test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c
33
38
  # ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c
34
- $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
35
- $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2)
39
+ $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
40
+ $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2)
36
41
  ./$(TARGET1)
37
42
  ./$(TARGET2)
38
43
 
@@ -24,7 +24,8 @@ static void runTest(UnityTestFunction test)
24
24
  tearDown();
25
25
  }
26
26
  }
27
- void resetTest()
27
+ void resetTest(void);
28
+ void resetTest(void)
28
29
  {
29
30
  tearDown();
30
31
  setUp();
@@ -33,8 +34,7 @@ void resetTest()
33
34
 
34
35
  int main(void)
35
36
  {
36
- Unity.TestFile = "test/TestProductionCode2.c";
37
- UnityBegin();
37
+ UnityBegin("test/TestProductionCode2.c");
38
38
 
39
39
  // RUN_TEST calls runTest
40
40
  RUN_TEST(test_IgnoredTest, 13);
@@ -26,7 +26,8 @@ static void runTest(UnityTestFunction test)
26
26
  tearDown();
27
27
  }
28
28
  }
29
- void resetTest()
29
+ void resetTest(void);
30
+ void resetTest(void)
30
31
  {
31
32
  tearDown();
32
33
  setUp();
@@ -35,8 +36,7 @@ void resetTest()
35
36
 
36
37
  int main(void)
37
38
  {
38
- Unity.TestFile = "test/TestProductionCode.c";
39
- UnityBegin();
39
+ UnityBegin("test/TestProductionCode.c");
40
40
 
41
41
  // RUN_TEST calls runTest
42
42
  RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20);
@@ -4,14 +4,24 @@
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
5
  # ==========================================
6
6
 
7
- UNITY_ROOT=../..
8
- C_COMPILER=gcc
9
- TARGET_BASE1=all_tests
10
- ifeq ($(OS),Windows_NT)
7
+ #We try to detect the OS we are running on, and adjust commands as needed
8
+ ifeq ($(OSTYPE),cygwin)
9
+ CLEANUP = rm -f
10
+ MKDIR = mkdir -p
11
+ TARGET_EXTENSION=.out
12
+ else ifeq ($(OS),Windows_NT)
13
+ CLEANUP = del /F /Q
14
+ MKDIR = mkdir
11
15
  TARGET_EXTENSION=.exe
12
16
  else
17
+ CLEANUP = rm -f
18
+ MKDIR = mkdir -p
13
19
  TARGET_EXTENSION=.out
14
20
  endif
21
+
22
+ UNITY_ROOT=../..
23
+ C_COMPILER=gcc
24
+ TARGET_BASE1=all_tests
15
25
  TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
16
26
  SRC_FILES1=\
17
27
  $(UNITY_ROOT)/src/unity.c \
@@ -26,12 +36,6 @@ SRC_FILES1=\
26
36
  INC_DIRS=-Isrc -I$(UNITY_ROOT)/src -I$(UNITY_ROOT)/extras/fixture/src
27
37
  SYMBOLS=
28
38
 
29
- ifeq ($(OS),Windows_NT)
30
- CLEANUP = del /F /Q $(TARGET1)
31
- else
32
- CLEANUP = rm -f build/*.o ; rm -f $(TARGET1)
33
- endif
34
-
35
39
  all: clean default
36
40
 
37
41
  default:
@@ -4,15 +4,26 @@
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
5
  # ==========================================
6
6
 
7
- UNITY_ROOT=../..
8
- C_COMPILER=gcc
9
- TARGET_BASE1=test1
10
- TARGET_BASE2=test2
11
- ifeq ($(OS),Windows_NT)
7
+ #We try to detect the OS we are running on, and adjust commands as needed
8
+ ifeq ($(OSTYPE),cygwin)
9
+ CLEANUP = rm -f
10
+ MKDIR = mkdir -p
11
+ TARGET_EXTENSION=.out
12
+ else ifeq ($(OS),Windows_NT)
13
+ CLEANUP = del /F /Q
14
+ MKDIR = mkdir
12
15
  TARGET_EXTENSION=.exe
13
16
  else
17
+ CLEANUP = rm -f
18
+ MKDIR = mkdir -p
14
19
  TARGET_EXTENSION=.out
15
20
  endif
21
+
22
+ UNITY_ROOT=../..
23
+ C_COMPILER=gcc
24
+ CFLAGS=-std=c99
25
+ TARGET_BASE1=test1
26
+ TARGET_BASE2=test2
16
27
  TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
17
28
  TARGET2 = $(TARGET_BASE2)$(TARGET_EXTENSION)
18
29
  SRC_FILES1=$(UNITY_ROOT)/src/unity.c src/ProductionCode.c test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c
@@ -20,19 +31,13 @@ SRC_FILES2=$(UNITY_ROOT)/src/unity.c src/ProductionCode2.c test/TestProductionCo
20
31
  INC_DIRS=-Isrc -I$(UNITY_ROOT)/src
21
32
  SYMBOLS=-DTEST
22
33
 
23
- ifeq ($(OS),Windows_NT)
24
- CLEANUP = del /F /Q $(TARGET1) && del /F /Q $(TARGET2)
25
- else
26
- CLEANUP = rm -f build/*.o ; rm -f $(TARGET1) ; rm -f $(TARGET2)
27
- endif
28
-
29
34
  all: clean default
30
35
 
31
36
  default:
32
37
  # ruby auto/generate_test_runner.rb test/TestProductionCode.c test/no_ruby/TestProductionCode_Runner.c
33
38
  # ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/no_ruby/TestProductionCode2_Runner.c
34
- $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
35
- $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2)
39
+ $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
40
+ $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES2) -o $(TARGET2)
36
41
  ./$(TARGET1)
37
42
  ./$(TARGET2)
38
43
 
@@ -24,7 +24,8 @@ static void runTest(UnityTestFunction test)
24
24
  tearDown();
25
25
  }
26
26
  }
27
- void resetTest()
27
+ void resetTest(void);
28
+ void resetTest(void)
28
29
  {
29
30
  tearDown();
30
31
  setUp();
@@ -33,8 +34,7 @@ void resetTest()
33
34
 
34
35
  int main(void)
35
36
  {
36
- Unity.TestFile = "test/TestProductionCode2.c";
37
- UnityBegin();
37
+ UnityBegin("test/TestProductionCode2.c");
38
38
 
39
39
  // RUN_TEST calls runTest
40
40
  RUN_TEST(test_IgnoredTest, 13);
@@ -26,7 +26,8 @@ static void runTest(UnityTestFunction test)
26
26
  tearDown();
27
27
  }
28
28
  }
29
- void resetTest()
29
+ void resetTest(void);
30
+ void resetTest(void)
30
31
  {
31
32
  tearDown();
32
33
  setUp();
@@ -35,8 +36,7 @@ void resetTest()
35
36
 
36
37
  int main(void)
37
38
  {
38
- Unity.TestFile = "test/TestProductionCode.c";
39
- UnityBegin();
39
+ UnityBegin("test/TestProductionCode.c");
40
40
 
41
41
  // RUN_TEST calls runTest
42
42
  RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20);
@@ -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
  require 'yaml'
8
8
  require 'fileutils'
@@ -13,27 +13,27 @@ require HERE+'../../auto/colour_reporter'
13
13
  module RakefileHelpers
14
14
 
15
15
  C_EXTENSION = '.c'
16
-
16
+
17
17
  def load_configuration(config_file)
18
18
  unless ($configured)
19
- $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/)
19
+ $cfg_file = HERE+"../../test/targets/#{config_file}" unless (config_file =~ /[\\|\/]/)
20
20
  $cfg = YAML.load(File.read($cfg_file))
21
21
  $colour_output = false unless $cfg['colour']
22
22
  $configured = true if (config_file != DEFAULT_CONFIG_FILE)
23
23
  end
24
24
  end
25
-
25
+
26
26
  def configure_clean
27
27
  CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil?
28
28
  end
29
-
29
+
30
30
  def configure_toolchain(config_file=DEFAULT_CONFIG_FILE)
31
31
  config_file += '.yml' unless config_file =~ /\.yml$/
32
32
  config_file = config_file unless config_file =~ /[\\|\/]/
33
33
  load_configuration(config_file)
34
34
  configure_clean
35
35
  end
36
-
36
+
37
37
  def tackit(strings)
38
38
  if strings.is_a?(Array)
39
39
  result = "\"#{strings.join}\""
@@ -42,7 +42,7 @@ module RakefileHelpers
42
42
  end
43
43
  return result
44
44
  end
45
-
45
+
46
46
  def squash(prefix, items)
47
47
  result = ''
48
48
  items.each { |item| result += " #{prefix}#{tackit(item)}" }
@@ -70,7 +70,7 @@ module RakefileHelpers
70
70
  "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
71
71
  execute(cmd_str)
72
72
  end
73
-
73
+
74
74
  def build_linker_fields
75
75
  command = tackit($cfg['linker']['path'])
76
76
  if $cfg['linker']['options'].nil?
@@ -86,7 +86,7 @@ module RakefileHelpers
86
86
  includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
87
87
  return {:command => command, :options => options, :includes => includes}
88
88
  end
89
-
89
+
90
90
  def link_it(exe_name, obj_list)
91
91
  linker = build_linker_fields
92
92
  cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
@@ -96,7 +96,7 @@ module RakefileHelpers
96
96
  exe_name + $cfg['linker']['bin_files']['extension']
97
97
  execute(cmd_str)
98
98
  end
99
-
99
+
100
100
  def build_simulator_fields
101
101
  return nil if $cfg['simulator'].nil?
102
102
  if $cfg['simulator']['path'].nil?
@@ -116,7 +116,7 @@ module RakefileHelpers
116
116
  end
117
117
  return {:command => command, :pre_support => pre_support, :post_support => post_support}
118
118
  end
119
-
119
+
120
120
  def execute(command_string, verbose=true)
121
121
  report command_string
122
122
  output = `#{command_string}`.chomp
@@ -126,7 +126,7 @@ module RakefileHelpers
126
126
  end
127
127
  return output
128
128
  end
129
-
129
+
130
130
  def report_summary
131
131
  summary = UnityTestSummary.new
132
132
  summary.set_root_path(HERE)
@@ -136,29 +136,29 @@ module RakefileHelpers
136
136
  summary.set_targets(results)
137
137
  summary.run
138
138
  end
139
-
139
+
140
140
  def run_tests
141
141
  report 'Running Unity system tests...'
142
-
142
+
143
143
  # Tack on TEST define for compiling unit tests
144
144
  load_configuration($cfg_file)
145
145
  test_defines = ['TEST']
146
146
  $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
147
-
147
+
148
148
  # Get a list of all source files needed
149
149
  src_files = Dir[HERE+'src/*.c']
150
150
  src_files += Dir[HERE+'test/*.c']
151
151
  src_files += Dir[HERE+'test/main/*.c']
152
152
  src_files << '../../src/unity.c'
153
-
153
+
154
154
  # Build object files
155
155
  src_files.each { |f| compile(f, test_defines) }
156
156
  obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) }
157
-
157
+
158
158
  # Link the test executable
159
159
  test_base = "framework_test"
160
160
  link_it(test_base, obj_list)
161
-
161
+
162
162
  # Execute unit test and generate results file
163
163
  simulator = build_simulator_fields
164
164
  executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension']
@@ -6,6 +6,7 @@
6
6
  ========================================== */
7
7
 
8
8
  #include <string.h>
9
+ #include <stdio.h>
9
10
  #include "unity_fixture.h"
10
11
  #include "unity_internals.h"
11
12
 
@@ -38,7 +39,7 @@ int UnityMain(int argc, char* argv[], void (*runAllTests)(void))
38
39
  for (r = 0; r < UnityFixture.RepeatCount; r++)
39
40
  {
40
41
  announceTestRun(r);
41
- UnityBegin();
42
+ UnityBegin(argv[0]);
42
43
  runAllTests();
43
44
  UNITY_OUTPUT_CHAR('\n');
44
45
  UnityEnd();
@@ -122,7 +122,7 @@ TEST(UnityFixture, PointerSet)
122
122
  p1 = &c1;
123
123
  p2 = &c2;
124
124
 
125
- UnityPointer_Init(10);
125
+ UnityPointer_Init();
126
126
  UT_PTR_SET(p1, &newC1);
127
127
  UT_PTR_SET(p2, &newC2);
128
128
  TEST_ASSERT_POINTERS_EQUAL(&newC1, p1);
@@ -14,26 +14,34 @@
14
14
 
15
15
  struct _Unity Unity;
16
16
 
17
- const char* UnityStrNull = "NULL";
18
- const char* UnityStrSpacer = ". ";
19
- const char* UnityStrExpected = " Expected ";
20
- const char* UnityStrWas = " Was ";
21
- const char* UnityStrTo = " To ";
22
- const char* UnityStrElement = " Element ";
23
- const char* UnityStrByte = " Byte ";
24
- const char* UnityStrMemory = " Memory Mismatch.";
25
- const char* UnityStrDelta = " Values Not Within Delta ";
26
- const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless.";
27
- const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL";
28
- const char* UnityStrNullPointerForActual = " Actual pointer was NULL";
29
- const char* UnityStrNot = "Not ";
30
- const char* UnityStrInf = "Infinity";
31
- const char* UnityStrNegInf = "Negative Infinity";
32
- const char* UnityStrNaN = "NaN";
33
- const char* UnityStrDet = "Determinate";
34
- const char* UnityStrErrFloat = "Unity Floating Point Disabled";
35
- const char* UnityStrErrDouble= "Unity Double Precision Disabled";
36
- const char* UnityStrErr64 = "Unity 64-bit Support Disabled";
17
+ const char UnityStrOk[] = "OK";
18
+ const char UnityStrPass[] = "PASS";
19
+ const char UnityStrFail[] = "FAIL";
20
+ const char UnityStrIgnore[] = "IGNORE";
21
+ const char UnityStrNull[] = "NULL";
22
+ const char UnityStrSpacer[] = ". ";
23
+ const char UnityStrExpected[] = " Expected ";
24
+ const char UnityStrWas[] = " Was ";
25
+ const char UnityStrTo[] = " To ";
26
+ const char UnityStrElement[] = " Element ";
27
+ const char UnityStrByte[] = " Byte ";
28
+ const char UnityStrMemory[] = " Memory Mismatch.";
29
+ const char UnityStrDelta[] = " Values Not Within Delta ";
30
+ const char UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
31
+ const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
32
+ const char UnityStrNullPointerForActual[] = " Actual pointer was NULL";
33
+ const char UnityStrNot[] = "Not ";
34
+ const char UnityStrInf[] = "Infinity";
35
+ const char UnityStrNegInf[] = "Negative Infinity";
36
+ const char UnityStrNaN[] = "NaN";
37
+ const char UnityStrDet[] = "Determinate";
38
+ const char UnityStrErrFloat[] = "Unity Floating Point Disabled";
39
+ const char UnityStrErrDouble[] = "Unity Double Precision Disabled";
40
+ const char UnityStrErr64[] = "Unity 64-bit Support Disabled";
41
+ const char UnityStrBreaker[] = "-----------------------";
42
+ const char UnityStrResultsTests[] = " Tests ";
43
+ const char UnityStrResultsFailures[] = " Failures ";
44
+ const char UnityStrResultsIgnored[] = " Ignored ";
37
45
 
38
46
  #ifndef UNITY_EXCLUDE_FLOAT
39
47
  // Dividing by these constants produces +/- infinity.
@@ -125,12 +133,24 @@ void UnityPrintNumber(const _U_SINT number_to_print)
125
133
  {
126
134
  _U_SINT divisor = 1;
127
135
  _U_SINT next_divisor;
128
- _U_SINT number = number_to_print;
136
+ _U_UINT number;
129
137
 
130
- if (number < 0)
138
+ if (number_to_print == (1l << (UNITY_LONG_WIDTH-1)))
131
139
  {
140
+ //The largest representable negative number
132
141
  UNITY_OUTPUT_CHAR('-');
133
- number = -number;
142
+ number = (1ul << (UNITY_LONG_WIDTH-1));
143
+ }
144
+ else if (number_to_print < 0)
145
+ {
146
+ //Some other negative number
147
+ UNITY_OUTPUT_CHAR('-');
148
+ number = (_U_UINT)(-number_to_print);
149
+ }
150
+ else
151
+ {
152
+ //Positive number
153
+ number = (_U_UINT)number_to_print;
134
154
  }
135
155
 
136
156
  // figure out initial divisor
@@ -242,18 +262,17 @@ void UnityPrintFloat(_UF number)
242
262
 
243
263
  void UnityPrintFail(void)
244
264
  {
245
- UnityPrint("FAIL");
265
+ UnityPrint(UnityStrFail);
246
266
  }
247
267
 
248
268
  void UnityPrintOk(void)
249
269
  {
250
- UnityPrint("OK");
270
+ UnityPrint(UnityStrOk);
251
271
  }
252
272
 
253
273
  //-----------------------------------------------
254
274
  void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
255
275
  {
256
- UNITY_PRINT_EOL;
257
276
  UnityPrint(file);
258
277
  UNITY_OUTPUT_CHAR(':');
259
278
  UnityPrintNumber((_U_SINT)line);
@@ -266,7 +285,8 @@ void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
266
285
  void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
267
286
  {
268
287
  UnityTestResultsBegin(Unity.TestFile, line);
269
- UnityPrint("FAIL:");
288
+ UnityPrint(UnityStrFail);
289
+ UNITY_OUTPUT_CHAR(':');
270
290
  }
271
291
 
272
292
  //-----------------------------------------------
@@ -279,7 +299,7 @@ void UnityConcludeTest(void)
279
299
  else if (!Unity.CurrentTestFailed)
280
300
  {
281
301
  UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
282
- UnityPrint("PASS");
302
+ UnityPrint(UnityStrPass);
283
303
  }
284
304
  else
285
305
  {
@@ -288,6 +308,7 @@ void UnityConcludeTest(void)
288
308
 
289
309
  Unity.CurrentTestFailed = 0;
290
310
  Unity.CurrentTestIgnored = 0;
311
+ UNITY_PRINT_EOL;
291
312
  }
292
313
 
293
314
  //-----------------------------------------------
@@ -413,8 +434,8 @@ void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,
413
434
  const UNITY_DISPLAY_STYLE_T style)
414
435
  {
415
436
  _UU32 elements = num_elements;
416
- UNITY_PTR_ATTRIBUTE const _US8* ptr_exp = (UNITY_PTR_ATTRIBUTE _US8*)expected;
417
- UNITY_PTR_ATTRIBUTE const _US8* ptr_act = (UNITY_PTR_ATTRIBUTE _US8*)actual;
437
+ UNITY_PTR_ATTRIBUTE const _US8* ptr_exp = (UNITY_PTR_ATTRIBUTE const _US8*)expected;
438
+ UNITY_PTR_ATTRIBUTE const _US8* ptr_act = (UNITY_PTR_ATTRIBUTE const _US8*)actual;
418
439
 
419
440
  UNITY_SKIP_EXECUTION;
420
441
 
@@ -426,7 +447,7 @@ void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,
426
447
  UNITY_FAIL_AND_BAIL;
427
448
  }
428
449
 
429
- if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)
450
+ if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)
430
451
  return;
431
452
 
432
453
  // If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case
@@ -460,15 +481,15 @@ void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,
460
481
  case UNITY_DISPLAY_STYLE_UINT16:
461
482
  while (elements--)
462
483
  {
463
- if (*(UNITY_PTR_ATTRIBUTE _US16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE _US16*)ptr_act)
484
+ if (*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act)
464
485
  {
465
486
  UnityTestResultsFailBegin(lineNumber);
466
487
  UnityPrint(UnityStrElement);
467
488
  UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
468
489
  UnityPrint(UnityStrExpected);
469
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE _US16*)ptr_exp, style);
490
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);
470
491
  UnityPrint(UnityStrWas);
471
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE _US16*)ptr_act, style);
492
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act, style);
472
493
  UnityAddMsgIfSpecified(msg);
473
494
  UNITY_FAIL_AND_BAIL;
474
495
  }
@@ -482,15 +503,15 @@ void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,
482
503
  case UNITY_DISPLAY_STYLE_UINT64:
483
504
  while (elements--)
484
505
  {
485
- if (*(UNITY_PTR_ATTRIBUTE _US64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE _US64*)ptr_act)
506
+ if (*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act)
486
507
  {
487
508
  UnityTestResultsFailBegin(lineNumber);
488
509
  UnityPrint(UnityStrElement);
489
510
  UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
490
511
  UnityPrint(UnityStrExpected);
491
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE _US64*)ptr_exp, style);
512
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);
492
513
  UnityPrint(UnityStrWas);
493
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE _US64*)ptr_act, style);
514
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act, style);
494
515
  UnityAddMsgIfSpecified(msg);
495
516
  UNITY_FAIL_AND_BAIL;
496
517
  }
@@ -502,15 +523,15 @@ void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,
502
523
  default:
503
524
  while (elements--)
504
525
  {
505
- if (*(UNITY_PTR_ATTRIBUTE _US32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE _US32*)ptr_act)
526
+ if (*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act)
506
527
  {
507
528
  UnityTestResultsFailBegin(lineNumber);
508
529
  UnityPrint(UnityStrElement);
509
530
  UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
510
531
  UnityPrint(UnityStrExpected);
511
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE _US32*)ptr_exp, style);
532
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);
512
533
  UnityPrint(UnityStrWas);
513
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE _US32*)ptr_act, style);
534
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act, style);
514
535
  UnityAddMsgIfSpecified(msg);
515
536
  UNITY_FAIL_AND_BAIL;
516
537
  }
@@ -544,7 +565,7 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
544
565
  UNITY_FAIL_AND_BAIL;
545
566
  }
546
567
 
547
- if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)
568
+ if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)
548
569
  return;
549
570
 
550
571
  while (elements--)
@@ -622,13 +643,13 @@ void UnityAssertFloatSpecial(const _UF actual,
622
643
  const UNITY_LINE_TYPE lineNumber,
623
644
  const UNITY_FLOAT_TRAIT_T style)
624
645
  {
625
- UNITY_SKIP_EXECUTION;
626
-
627
646
  const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
628
647
  _U_SINT should_be_trait = ((_U_SINT)style & 1);
629
648
  _U_SINT is_trait = !should_be_trait;
630
649
  _U_SINT trait_index = style >> 1;
631
650
 
651
+ UNITY_SKIP_EXECUTION;
652
+
632
653
  switch(style)
633
654
  {
634
655
  //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
@@ -656,6 +677,8 @@ void UnityAssertFloatSpecial(const _UF actual,
656
677
  else
657
678
  is_trait = 1;
658
679
  break;
680
+ default:
681
+ ;
659
682
  }
660
683
 
661
684
  if (is_trait != should_be_trait)
@@ -782,13 +805,13 @@ void UnityAssertDoubleSpecial(const _UD actual,
782
805
  const UNITY_LINE_TYPE lineNumber,
783
806
  const UNITY_FLOAT_TRAIT_T style)
784
807
  {
785
- UNITY_SKIP_EXECUTION;
786
-
787
808
  const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
788
809
  _U_SINT should_be_trait = ((_U_SINT)style & 1);
789
810
  _U_SINT is_trait = !should_be_trait;
790
811
  _U_SINT trait_index = style >> 1;
791
812
 
813
+ UNITY_SKIP_EXECUTION;
814
+
792
815
  switch(style)
793
816
  {
794
817
  //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
@@ -816,6 +839,8 @@ void UnityAssertDoubleSpecial(const _UD actual,
816
839
  else
817
840
  is_trait = 1;
818
841
  break;
842
+ default:
843
+ ;
819
844
  }
820
845
 
821
846
  if (is_trait != should_be_trait)
@@ -987,8 +1012,8 @@ void UnityAssertEqualMemory( UNITY_PTR_ATTRIBUTE const void* expected,
987
1012
  const char* msg,
988
1013
  const UNITY_LINE_TYPE lineNumber)
989
1014
  {
990
- UNITY_PTR_ATTRIBUTE unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE unsigned char*)expected;
991
- UNITY_PTR_ATTRIBUTE unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE unsigned char*)actual;
1015
+ UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1016
+ UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
992
1017
  _UU32 elements = num_elements;
993
1018
  _UU32 bytes;
994
1019
 
@@ -1002,7 +1027,7 @@ void UnityAssertEqualMemory( UNITY_PTR_ATTRIBUTE const void* expected,
1002
1027
  UNITY_FAIL_AND_BAIL;
1003
1028
  }
1004
1029
 
1005
- if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)
1030
+ if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)
1006
1031
  return;
1007
1032
 
1008
1033
  while (elements--)
@@ -1065,7 +1090,7 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1065
1090
  UNITY_SKIP_EXECUTION;
1066
1091
 
1067
1092
  UnityTestResultsBegin(Unity.TestFile, line);
1068
- UnityPrint("IGNORE");
1093
+ UnityPrint(UnityStrIgnore);
1069
1094
  if (msg != NULL)
1070
1095
  {
1071
1096
  UNITY_OUTPUT_CHAR(':');
@@ -1120,14 +1145,14 @@ void UnityBegin(const char* filename)
1120
1145
  int UnityEnd(void)
1121
1146
  {
1122
1147
  UNITY_PRINT_EOL;
1123
- UnityPrint("-----------------------");
1148
+ UnityPrint(UnityStrBreaker);
1124
1149
  UNITY_PRINT_EOL;
1125
1150
  UnityPrintNumber((_U_SINT)(Unity.NumberOfTests));
1126
- UnityPrint(" Tests ");
1151
+ UnityPrint(UnityStrResultsTests);
1127
1152
  UnityPrintNumber((_U_SINT)(Unity.TestFailures));
1128
- UnityPrint(" Failures ");
1153
+ UnityPrint(UnityStrResultsFailures);
1129
1154
  UnityPrintNumber((_U_SINT)(Unity.TestIgnores));
1130
- UnityPrint(" Ignored");
1155
+ UnityPrint(UnityStrResultsIgnored);
1131
1156
  UNITY_PRINT_EOL;
1132
1157
  if (Unity.TestFailures == 0U)
1133
1158
  {
@@ -1143,5 +1168,3 @@ int UnityEnd(void)
1143
1168
  }
1144
1169
 
1145
1170
  //-----------------------------------------------
1146
-
1147
-