ceedling 0.0.8 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. data/Rakefile +15 -3
  2. data/examples/temp_sensor/project.yml +0 -1
  3. data/lib/ceedling/version.rb +5 -5
  4. data/lib/ceedling/version.rb.erb +1 -1
  5. data/new_project_template/vendor/ceedling/docs/CMock Summary.pdf +0 -0
  6. data/new_project_template/vendor/ceedling/lib/build_invoker_helper.rb +16 -0
  7. data/new_project_template/vendor/ceedling/lib/configurator.rb +8 -7
  8. data/new_project_template/vendor/ceedling/lib/configurator_plugins.rb +1 -11
  9. data/new_project_template/vendor/ceedling/lib/configurator_setup.rb +14 -1
  10. data/new_project_template/vendor/ceedling/lib/generator_test_runner.rb +0 -1
  11. data/new_project_template/vendor/ceedling/lib/objects.yml +10 -2
  12. data/new_project_template/vendor/ceedling/lib/preprocessinator_extractor.rb +11 -2
  13. data/new_project_template/vendor/ceedling/lib/release_invoker.rb +14 -6
  14. data/new_project_template/vendor/ceedling/lib/test_invoker.rb +4 -7
  15. data/new_project_template/vendor/ceedling/lib/test_invoker_helper.rb +1 -11
  16. data/new_project_template/vendor/ceedling/plugins/xml_tests_report/xml_tests_report.rb +1 -1
  17. data/new_project_template/vendor/ceedling/release/build.info +1 -2
  18. data/new_project_template/vendor/ceedling/vendor/c_exception/release/build.info +1 -2
  19. data/new_project_template/vendor/ceedling/vendor/cmock/lib/cmock_config.rb +3 -2
  20. data/new_project_template/vendor/ceedling/vendor/cmock/release/build.info +1 -2
  21. data/new_project_template/vendor/ceedling/vendor/unity/auto/generate_test_runner.rb +8 -8
  22. data/new_project_template/vendor/ceedling/vendor/unity/release/build.info +1 -2
  23. data/new_project_template/vendor/ceedling/vendor/unity/src/unity.c +95 -0
  24. data/new_project_template/vendor/ceedling/vendor/unity/src/unity.h +17 -0
  25. data/new_project_template/vendor/ceedling/vendor/unity/src/unity_internals.h +55 -0
  26. metadata +5 -4
data/Rakefile CHANGED
@@ -10,10 +10,22 @@ task :update_tools do
10
10
  puts "\nRetrieving ceedling content from SourceForge..."
11
11
  rm_rf "temp"
12
12
  mkdir "temp"
13
+
14
+ libs = [
15
+ {:path => './vendor/unity'},
16
+ {:path => './vendor/cmock'},
17
+ {:path => './vendor/c_exception'},
18
+ {:path => '.'}
19
+ ]
13
20
  cd "temp" do
14
- svn_checkout_command = 'svn co http://ceedling.svn.sourceforge.net/svnroot/ceedling/trunk .'
15
- puts svn_checkout_command
16
- `#{svn_checkout_command}`
21
+ sh 'svn co http://ceedling.svn.sourceforge.net/svnroot/ceedling/trunk .'
22
+ libs.each do |lib|
23
+ svn_info = `svn info #{lib[:path]}/`
24
+ lib[:revision] = svn_info.split("\n")[4].match(/ (\d+)/)[1]
25
+ revision_file = "#{lib[:path]}/release/build.info"
26
+ puts "Recorded lib revision #{lib[:revision]} in #{revision_file}"
27
+ File.open(revision_file, 'w'){|f| f.write lib[:revision]}
28
+ end
17
29
  rm_rf Dir["./**/.svn/"], :verbose => false # remove svn artifacts
18
30
  end
19
31
 
@@ -66,6 +66,5 @@
66
66
  - vendor/ceedling/plugins
67
67
  :enabled:
68
68
  - stdout_pretty_tests_report
69
- - module_generator
70
69
 
71
70
  ...
@@ -2,15 +2,15 @@
2
2
  module Ceedling
3
3
  module Version
4
4
  # @private
5
- GEM = "0.0.8"
5
+ GEM = "0.0.12"
6
6
 
7
7
  # @private
8
- CEEDLING = "0.9.186"
8
+ CEEDLING = "0.9.193"
9
9
  # @private
10
- CEXCEPTION = "1.2.16"
10
+ CEXCEPTION = "1.2.17"
11
11
  # @private
12
- CMOCK = "2.0.212"
12
+ CMOCK = "2.0.213"
13
13
  # @private
14
- UNITY = "2.0.118"
14
+ UNITY = "2.0.134"
15
15
  end
16
16
  end
@@ -2,7 +2,7 @@
2
2
  module Ceedling
3
3
  module Version
4
4
  # @private
5
- GEM = "0.0.8"
5
+ GEM = "0.0.12"
6
6
 
7
7
  # @private
8
8
  CEEDLING = "<%= versions["CEEDLING"] %>"
@@ -0,0 +1,16 @@
1
+
2
+ class BuildInvokerHelper
3
+
4
+ constructor :configurator, :streaminator
5
+
6
+ def process_exception(exception)
7
+ if (exception.message =~ /Don't know how to build task '(.+)'/i)
8
+ @streaminator.stderr_puts("ERROR: Rake could not find file referenced in source or test: '#{$1}'.")
9
+ @streaminator.stderr_puts("Possible stale dependency due to a file name change, etc. Maybe 'clean' task and try again.") if (@configurator.project_use_auxiliary_dependencies)
10
+ raise ''
11
+ else
12
+ raise exception
13
+ end
14
+ end
15
+
16
+ end
@@ -83,7 +83,7 @@ class Configurator
83
83
  # cmock has its own internal defaults handling, but we need to set these specific values
84
84
  # so they're present for the build environment to access;
85
85
  # note: these need to end up in the hash given to initialize cmock for this to be successful
86
- cmock = config[:cmock]
86
+ cmock = config[:cmock] || {}
87
87
 
88
88
  # yes, we're duplicating the default mock_prefix in cmock, but it's because we need CMOCK_MOCK_PREFIX always available in Ceedling's environment
89
89
  cmock[:mock_prefix] = 'Mock' if (cmock[:mock_prefix].nil?)
@@ -106,7 +106,7 @@ class Configurator
106
106
  cmock[:includes].uniq!
107
107
  end
108
108
 
109
- @runner_config = cmock
109
+ @runner_config = cmock.merge(config[:test_runner] || {})
110
110
  @cmock_builder.manufacture(cmock)
111
111
  end
112
112
 
@@ -234,15 +234,16 @@ class Configurator
234
234
 
235
235
  def validate(config)
236
236
  # collect felonies and go straight to jail
237
- raise if (not @configurator_setup.validate_required_sections(config))
237
+ raise if (not @configurator_setup.validate_required_sections( config ))
238
238
 
239
239
  # collect all misdemeanors, everybody on probation
240
240
  blotter = []
241
- blotter << @configurator_setup.validate_required_section_values(config)
242
- blotter << @configurator_setup.validate_paths(config)
243
- blotter << @configurator_setup.validate_tools(config)
241
+ blotter << @configurator_setup.validate_required_section_values( config )
242
+ blotter << @configurator_setup.validate_paths( config )
243
+ blotter << @configurator_setup.validate_tools( config )
244
+ blotter << @configurator_setup.validate_plugins( config )
244
245
 
245
- raise if (blotter.include?(false))
246
+ raise if (blotter.include?( false ))
246
247
  end
247
248
 
248
249
 
@@ -3,6 +3,7 @@ require 'constants'
3
3
  class ConfiguratorPlugins
4
4
 
5
5
  constructor :stream_wrapper, :file_wrapper, :system_wrapper
6
+ attr_reader :rake_plugins, :script_plugins
6
7
 
7
8
  def setup
8
9
  @rake_plugins = []
@@ -89,15 +90,4 @@ class ConfiguratorPlugins
89
90
  return defaults_with_path
90
91
  end
91
92
 
92
-
93
- def validate_plugins(enabled_plugins)
94
- missing_plugins = Set.new(enabled_plugins) - Set.new(@rake_plugins) - Set.new(@script_plugins)
95
-
96
- missing_plugins.each do |plugin|
97
- @stream_wrapper.stdout_puts.stderr_puts("ERROR: Ceedling plugin '#{plugin}' contains no rake or ruby class entry point. (Misspelled or missing files?)")
98
- end
99
-
100
- raise if (missing_plugins.size > 0)
101
- end
102
-
103
93
  end
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  class ConfiguratorSetup
13
13
 
14
- constructor :configurator_builder, :configurator_validator
14
+ constructor :configurator_builder, :configurator_validator, :configurator_plugins, :stream_wrapper
15
15
 
16
16
 
17
17
  def build_project_config(config, flattened_config)
@@ -107,4 +107,17 @@ class ConfiguratorSetup
107
107
  return true
108
108
  end
109
109
 
110
+ def validate_plugins(config)
111
+ missing_plugins =
112
+ Set.new( config[:plugins][:enabled] ) -
113
+ Set.new( @configurator_plugins.rake_plugins ) -
114
+ Set.new( @configurator_plugins.script_plugins )
115
+
116
+ missing_plugins.each do |plugin|
117
+ @stream_wrapper.stderr_puts("ERROR: Ceedling plugin '#{plugin}' contains no rake or ruby class entry point. (Misspelled or missing files?)")
118
+ end
119
+
120
+ return ( (missing_plugins.size > 0) ? false : true )
121
+ end
122
+
110
123
  end
@@ -58,7 +58,6 @@ class GeneratorTestRunner
58
58
  @test_runner_generator.generate( module_name,
59
59
  runner_filepath,
60
60
  test_cases,
61
- @configurator.test_runner_includes,
62
61
  mock_list)
63
62
  end
64
63
  end
@@ -79,6 +79,8 @@ configurator_setup:
79
79
  compose:
80
80
  - configurator_builder
81
81
  - configurator_validator
82
+ - configurator_plugins
83
+ - stream_wrapper
82
84
 
83
85
  configurator_plugins:
84
86
  compose:
@@ -255,6 +257,7 @@ test_invoker:
255
257
  compose:
256
258
  - configurator
257
259
  - test_invoker_helper
260
+ - build_invoker_helper
258
261
  - streaminator
259
262
  - preprocessinator
260
263
  - task_invoker
@@ -270,13 +273,13 @@ test_invoker_helper:
270
273
  - test_includes_extractor
271
274
  - file_finder
272
275
  - file_path_utils
273
- - streaminator
274
276
  - file_wrapper
275
277
 
276
278
  release_invoker:
277
279
  compose:
278
- - release_invoker_helper
279
280
  - configurator
281
+ - release_invoker_helper
282
+ - build_invoker_helper
280
283
  - dependinator
281
284
  - task_invoker
282
285
  - file_path_utils
@@ -286,3 +289,8 @@ release_invoker_helper:
286
289
  - configurator
287
290
  - dependinator
288
291
  - task_invoker
292
+
293
+ build_invoker_helper:
294
+ compose:
295
+ - configurator
296
+ - streaminator
@@ -9,15 +9,24 @@ class PreprocessinatorExtractor
9
9
  contents = []
10
10
  extract = false
11
11
 
12
+ # preprocessing by way of toolchain preprocessor expands macros, eliminates comments, strips out #ifdef code, etc.
13
+ # however, it also expands in place each #include'd file.
14
+ # so, we must extract only the lines of the file that belong to the file originally preprocessed
15
+
16
+ # iterate through all lines and alternate between extract and ignore modes
17
+ # all lines between a '#'line containing file name of our filepath and the next '#'line should be extracted
18
+
12
19
  @file_wrapper.readlines(filepath).each do |line|
13
20
  if (extract)
14
- if (line =~ /^#/)
21
+ # flip to ignore mode if line begins with '#' except if it's a #pragma line
22
+ if ((line =~ /^#/) and not (line =~ /#\s*pragma/))
15
23
  extract = false
24
+ # otherwise, extract the line
16
25
  else
17
26
  contents << line
18
27
  end
19
28
  end
20
- # extract = true if (line =~ /^#.*#{Regexp.escape(File.basename(filepath))}/)
29
+ # enable extract mode if line matches preprocessor expression for our original file name
21
30
  extract = true if (line =~ /^#.*(\s|\/|\\|\")#{Regexp.escape(File.basename(filepath))}/)
22
31
  end
23
32
 
@@ -2,16 +2,20 @@
2
2
 
3
3
  class ReleaseInvoker
4
4
 
5
- constructor :configurator, :release_invoker_helper, :dependinator, :task_invoker, :file_path_utils
5
+ constructor :configurator, :release_invoker_helper, :build_invoker_helper, :dependinator, :task_invoker, :file_path_utils
6
6
 
7
7
 
8
8
  def setup_and_invoke_c_objects(c_files)
9
9
  objects = ( @file_path_utils.form_release_build_c_objects_filelist( c_files ) )
10
10
 
11
- @release_invoker_helper.process_auxiliary_dependencies( @file_path_utils.form_release_dependencies_filelist( c_files ) )
11
+ begin
12
+ @release_invoker_helper.process_auxiliary_dependencies( @file_path_utils.form_release_dependencies_filelist( c_files ) )
12
13
 
13
- @dependinator.enhance_release_file_dependencies( objects )
14
- @task_invoker.invoke_release_objects( objects )
14
+ @dependinator.enhance_release_file_dependencies( objects )
15
+ @task_invoker.invoke_release_objects( objects )
16
+ rescue => e
17
+ @build_invoker_helper.process_exception(e)
18
+ end
15
19
 
16
20
  return objects
17
21
  end
@@ -20,8 +24,12 @@ class ReleaseInvoker
20
24
  def setup_and_invoke_asm_objects(asm_files)
21
25
  objects = @file_path_utils.form_release_build_asm_objects_filelist( asm_files )
22
26
 
23
- @dependinator.enhance_release_file_dependencies( objects )
24
- @task_invoker.invoke_release_objects( objects )
27
+ begin
28
+ @dependinator.enhance_release_file_dependencies( objects )
29
+ @task_invoker.invoke_release_objects( objects )
30
+ rescue => e
31
+ @build_invoker_helper.process_exception(e)
32
+ end
25
33
 
26
34
  return objects
27
35
  end
@@ -1,12 +1,9 @@
1
- require 'rubygems'
2
- require 'rake' # for ext()
3
-
4
1
 
5
2
  class TestInvoker
6
3
 
7
4
  attr_reader :sources, :tests, :mocks
8
5
 
9
- constructor :configurator, :test_invoker_helper, :streaminator, :preprocessinator, :task_invoker, :dependinator, :project_config_manager, :file_path_utils
6
+ constructor :configurator, :test_invoker_helper, :build_invoker_helper, :streaminator, :preprocessinator, :task_invoker, :dependinator, :project_config_manager, :file_path_utils
10
7
 
11
8
  def setup
12
9
  @sources = []
@@ -54,7 +51,7 @@ class TestInvoker
54
51
  # 3, 2, 1... launch
55
52
  @task_invoker.invoke_test_results( results_pass )
56
53
  rescue => e
57
- @test_invoker_helper.process_exception(e)
54
+ @build_invoker_helper.process_exception(e)
58
55
  end
59
56
 
60
57
  # store away what's been processed
@@ -63,10 +60,10 @@ class TestInvoker
63
60
  end
64
61
 
65
62
  # post-process collected mock list
66
- @mocks.uniq!.freeze
63
+ @mocks.uniq!
67
64
 
68
65
  # post-process collected sources list
69
- @sources.uniq!.freeze
66
+ @sources.uniq!
70
67
  end
71
68
 
72
69
  end
@@ -4,7 +4,7 @@ require 'rake' # for ext()
4
4
 
5
5
  class TestInvokerHelper
6
6
 
7
- constructor :configurator, :task_invoker, :dependinator, :test_includes_extractor, :file_finder, :file_path_utils, :streaminator, :file_wrapper
7
+ constructor :configurator, :task_invoker, :dependinator, :test_includes_extractor, :file_finder, :file_path_utils, :file_wrapper
8
8
 
9
9
  def clean_results(results, options)
10
10
  @file_wrapper.rm_f( results[:fail] )
@@ -28,14 +28,4 @@ class TestInvokerHelper
28
28
  return sources.compact
29
29
  end
30
30
 
31
- def process_exception(exception)
32
- if (exception.message =~ /Don't know how to build task '(.+)'/i)
33
- @streaminator.stderr_puts("ERROR: Rake could not find file referenced in source or test: '#{$1}'.")
34
- @streaminator.stderr_puts("Possible stale dependency due to a file name change, etc. Maybe 'clean' task and try again.") if (@configurator.project_use_auxiliary_dependencies)
35
- raise ''
36
- else
37
- raise exception
38
- end
39
- end
40
-
41
31
  end
@@ -53,7 +53,7 @@ class XmlTestsReport < Plugin
53
53
  result[:collection].each do |item|
54
54
  filename = File.join( result[:source][:path], result[:source][:file] )
55
55
 
56
- stream.puts "\t\t<Test id=\"#{@test_counter}\">"
56
+ stream.puts "\t\t<FailedTest id=\"#{@test_counter}\">"
57
57
  stream.puts "\t\t\t<Name>#{filename}::#{item[:test]}</Name>"
58
58
  stream.puts "\t\t\t<FailureType>Assertion</FailureType>"
59
59
  stream.puts "\t\t\t<Location>"
@@ -1,2 +1 @@
1
- 186
2
-
1
+ 193
@@ -15,7 +15,7 @@ class CMockConfig
15
15
  :strippables => ['(?:__attribute__\s*\(+.*?\)+)'],
16
16
  :attributes => ['__ramfunc', '__irq', '__fiq', 'register', 'extern'],
17
17
  :enforce_strict_ordering => false,
18
- :unity_helper => false,
18
+ :unity_helper_path => false,
19
19
  :treat_as => {},
20
20
  :treat_as_void => [],
21
21
  :memcmp_if_unknown => true,
@@ -54,6 +54,7 @@ class CMockConfig
54
54
  puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1)
55
55
  end
56
56
  end
57
+ options[:unity_helper_path] ||= options[:unity_helper]
57
58
  options[:plugins].compact!
58
59
  options[:plugins].map! {|p| p.to_sym}
59
60
  @options = options
@@ -76,7 +77,7 @@ class CMockConfig
76
77
  end
77
78
 
78
79
  def load_unity_helper
79
- return File.new(@options[:unity_helper]).read if (@options[:unity_helper])
80
+ return File.new(@options[:unity_helper_path]).read if (@options[:unity_helper_path])
80
81
  return nil
81
82
  end
82
83
 
@@ -31,7 +31,7 @@ class UnityTestRunnerGenerator
31
31
 
32
32
  def run(input_file, output_file, options=nil)
33
33
  tests = []
34
- includes = []
34
+ testfile_includes = []
35
35
  used_mocks = []
36
36
 
37
37
  @options.merge!(options) unless options.nil?
@@ -39,22 +39,22 @@ class UnityTestRunnerGenerator
39
39
 
40
40
  #pull required data from source file
41
41
  File.open(input_file, 'r') do |input|
42
- tests = find_tests(input)
43
- includes = find_includes(input)
44
- used_mocks = find_mocks(includes)
42
+ tests = find_tests(input)
43
+ testfile_includes = find_includes(input)
44
+ used_mocks = find_mocks(testfile_includes)
45
45
  end
46
46
 
47
47
  #build runner file
48
- generate(input_file, output_file, tests, includes, used_mocks)
48
+ generate(input_file, output_file, tests, used_mocks)
49
49
 
50
50
  #determine which files were used to return them
51
51
  all_files_used = [input_file, output_file]
52
- all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty?
52
+ all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?
53
53
  all_files_used += @options[:includes] unless @options[:includes].empty?
54
54
  return all_files_used.uniq
55
55
  end
56
56
 
57
- def generate(input_file, output_file, tests, includes, used_mocks)
57
+ def generate(input_file, output_file, tests, used_mocks)
58
58
  File.open(output_file, 'w') do |output|
59
59
  create_header(output, used_mocks)
60
60
  create_externs(output, tests, used_mocks)
@@ -155,7 +155,7 @@ class UnityTestRunnerGenerator
155
155
  output.puts("extern void setUp(void);")
156
156
  output.puts("extern void tearDown(void);")
157
157
  tests.each do |test|
158
- output.puts("extern void #{test[:test]}(#{test[:call]});")
158
+ output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
159
159
  end
160
160
  output.puts('')
161
161
  end
@@ -578,7 +578,102 @@ void UnityAssertFloatsWithin(const _UF delta,
578
578
  UNITY_FAIL_AND_BAIL;
579
579
  }
580
580
  }
581
+
582
+ #endif //not UNITY_EXCLUDE_FLOAT
583
+
584
+ //-----------------------------------------------
585
+ #ifndef UNITY_EXCLUDE_DOUBLE
586
+ void UnityAssertEqualDoubleArray(const _UD* expected,
587
+ const _UD* actual,
588
+ const _UU32 num_elements,
589
+ const char* msg,
590
+ const UNITY_LINE_TYPE lineNumber)
591
+ {
592
+ _UU32 elements = num_elements;
593
+ const _UD* ptr_expected = expected;
594
+ const _UD* ptr_actual = actual;
595
+ _UD diff, tol;
596
+
597
+ UNITY_SKIP_EXECUTION;
598
+
599
+ if (elements == 0)
600
+ {
601
+ UnityTestResultsFailBegin(lineNumber);
602
+ UnityPrint(UnityStrPointless);
603
+ UnityAddMsgIfSpecified(msg);
604
+ UNITY_FAIL_AND_BAIL;
605
+ }
606
+
607
+ if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
608
+ return;
609
+
610
+ while (elements--)
611
+ {
612
+ diff = *ptr_expected - *ptr_actual;
613
+ if (diff < 0.0)
614
+ diff = 0.0 - diff;
615
+ tol = UNITY_DOUBLE_PRECISION * *ptr_expected;
616
+ if (tol < 0.0)
617
+ tol = 0.0 - tol;
618
+ if (diff > tol)
619
+ {
620
+ UnityTestResultsFailBegin(lineNumber);
621
+ UnityPrint(UnityStrElement);
622
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
623
+ #ifdef UNITY_DOUBLE_VERBOSE
624
+ UnityPrint(UnityStrExpected);
625
+ UnityPrintFloat((float)(*ptr_expected));
626
+ UnityPrint(UnityStrWas);
627
+ UnityPrintFloat((float)(*ptr_actual));
628
+ #else
629
+ UnityPrint(UnityStrDelta);
581
630
  #endif
631
+ UnityAddMsgIfSpecified(msg);
632
+ UNITY_FAIL_AND_BAIL;
633
+ }
634
+ ptr_expected++;
635
+ ptr_actual++;
636
+ }
637
+ }
638
+
639
+ //-----------------------------------------------
640
+ void UnityAssertDoublesWithin(const _UD delta,
641
+ const _UD expected,
642
+ const _UD actual,
643
+ const char* msg,
644
+ const UNITY_LINE_TYPE lineNumber)
645
+ {
646
+ _UD diff = actual - expected;
647
+ _UD pos_delta = delta;
648
+
649
+ UNITY_SKIP_EXECUTION;
650
+
651
+ if (diff < 0)
652
+ {
653
+ diff = 0.0f - diff;
654
+ }
655
+ if (pos_delta < 0)
656
+ {
657
+ pos_delta = 0.0f - pos_delta;
658
+ }
659
+
660
+ if (pos_delta < diff)
661
+ {
662
+ UnityTestResultsFailBegin(lineNumber);
663
+ #ifdef UNITY_DOUBLE_VERBOSE
664
+ UnityPrint(UnityStrExpected);
665
+ UnityPrintFloat((float)expected);
666
+ UnityPrint(UnityStrWas);
667
+ UnityPrintFloat((float)actual);
668
+ #else
669
+ UnityPrint(UnityStrDelta);
670
+ #endif
671
+ UnityAddMsgIfSpecified(msg);
672
+ UNITY_FAIL_AND_BAIL;
673
+ }
674
+ }
675
+
676
+ #endif // not UNITY_EXCLUDE_DOUBLE
582
677
 
583
678
  //-----------------------------------------------
584
679
  void UnityAssertNumbersWithin( const _U_SINT delta,
@@ -24,6 +24,11 @@
24
24
  // - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT
25
25
  // - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats
26
26
  // - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf)
27
+ // - define UNITY_INCLUDE_DOUBLE to allow double floating point comparisons
28
+ // - define UNITY_EXCLUDE_DOUBLE to disallow double floating point comparisons (default)
29
+ // - define UNITY_DOUBLE_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_DOUBLE
30
+ // - define UNITY_DOUBLE_TYPE to specify something other than double
31
+ // - define UNITY_DOUBLE_VERBOSE to print floating point values in errors (uses sprintf)
27
32
 
28
33
  // Output
29
34
  // - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired
@@ -137,6 +142,12 @@
137
142
  #define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL)
138
143
  #define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL)
139
144
 
145
+ //Double (If Enabled)
146
+ #define TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, __LINE__, NULL)
147
+ #define TEST_ASSERT_EQUAL_DOUBLE(expected, actual) UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, __LINE__, NULL)
148
+ #define TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, __LINE__, NULL)
149
+
150
+
140
151
  //-------------------------------------------------------
141
152
  // Test Asserts (with additional messages)
142
153
  //-------------------------------------------------------
@@ -210,4 +221,10 @@
210
221
  #define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message)
211
222
  #define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message)
212
223
  #define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message)
224
+
225
+ //Double (If Enabled)
226
+ #define TEST_ASSERT_DOUBLE_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, __LINE__, message)
227
+ #define TEST_ASSERT_EQUAL_DOUBLE_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, __LINE__, message)
228
+ #define TEST_ASSERT_EQUAL_DOUBLE_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, __LINE__, message)
229
+
213
230
  #endif
@@ -112,6 +112,37 @@ typedef UNITY_FLOAT_TYPE _UF;
112
112
 
113
113
  #endif
114
114
 
115
+ //-------------------------------------------------------
116
+ // Double Float Support
117
+ //-------------------------------------------------------
118
+
119
+ //unlike FLOAT, we DON'T include by default
120
+ #ifndef UNITY_EXCLUDE_DOUBLE
121
+ #ifndef UNITY_INCLUDE_DOUBLE
122
+ #define UNITY_EXCLUDE_DOUBLE
123
+ #endif
124
+ #endif
125
+
126
+ #ifdef UNITY_EXCLUDE_DOUBLE
127
+
128
+ //No Floating Point Support
129
+ #undef UNITY_DOUBLE_PRECISION
130
+ #undef UNITY_DOUBLE_TYPE
131
+ #undef UNITY_DOUBLE_VERBOSE
132
+
133
+ #else
134
+
135
+ //Floating Point Support
136
+ #ifndef UNITY_DOUBLE_PRECISION
137
+ #define UNITY_DOUBLE_PRECISION (1e-12f)
138
+ #endif
139
+ #ifndef UNITY_DOUBLE_TYPE
140
+ #define UNITY_DOUBLE_TYPE double
141
+ #endif
142
+ typedef UNITY_DOUBLE_TYPE _UD;
143
+
144
+ #endif
145
+
115
146
  //-------------------------------------------------------
116
147
  // Output Method
117
148
  //-------------------------------------------------------
@@ -280,6 +311,20 @@ void UnityAssertEqualFloatArray(const _UF* expected,
280
311
  const UNITY_LINE_TYPE lineNumber);
281
312
  #endif
282
313
 
314
+ #ifndef UNITY_EXCLUDE_DOUBLE
315
+ void UnityAssertDoublesWithin(const _UD delta,
316
+ const _UD expected,
317
+ const _UD actual,
318
+ const char* msg,
319
+ const UNITY_LINE_TYPE lineNumber);
320
+
321
+ void UnityAssertEqualDoubleArray(const _UD* expected,
322
+ const _UD* actual,
323
+ const _UU32 num_elements,
324
+ const char* msg,
325
+ const UNITY_LINE_TYPE lineNumber);
326
+ #endif
327
+
283
328
  //-------------------------------------------------------
284
329
  // Basic Fail and Ignore
285
330
  //-------------------------------------------------------
@@ -352,4 +397,14 @@ void UnityAssertEqualFloatArray(const _UF* expected,
352
397
  #define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)
353
398
  #endif
354
399
 
400
+ #ifdef UNITY_EXCLUDE_DOUBLE
401
+ #define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
402
+ #define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
403
+ #define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, "Unity Double Precision Disabled")
404
+ #else
405
+ #define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((_UD)(delta), (_UD)(expected), (_UD)(actual), (message), (UNITY_LINE_TYPE)line)
406
+ #define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((_UF)(expected) * (_UD)UNITY_DOUBLE_PRECISION, (_UD)expected, (_UD)actual, (UNITY_LINE_TYPE)line, message)
407
+ #define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((_UD*)(expected), (_UD*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)
408
+ #endif
409
+
355
410
  #endif
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ceedling
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mike Karlesky, Mark VanderVoord
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-04-22 00:00:00 -04:00
20
+ date: 2011-05-07 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -169,6 +169,7 @@ files:
169
169
  - new_project_template/vendor/ceedling/docs/CMock Summary.pdf
170
170
  - new_project_template/vendor/ceedling/docs/Ceedling Packet.pdf
171
171
  - new_project_template/vendor/ceedling/docs/Unity Summary.pdf
172
+ - new_project_template/vendor/ceedling/lib/build_invoker_helper.rb
172
173
  - new_project_template/vendor/ceedling/lib/cacheinator.rb
173
174
  - new_project_template/vendor/ceedling/lib/cacheinator_helper.rb
174
175
  - new_project_template/vendor/ceedling/lib/cmock_builder.rb