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
@@ -10,33 +10,33 @@ $QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i
|
|
10
10
|
require File.expand_path(File.dirname(__FILE__)) + "/../test_helper"
|
11
11
|
require 'cmock_header_parser'
|
12
12
|
|
13
|
-
|
13
|
+
describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
14
14
|
|
15
|
-
|
15
|
+
before do
|
16
16
|
create_mocks :config
|
17
17
|
@test_name = 'test_file.h'
|
18
|
-
@config.expect
|
19
|
-
@config.expect
|
20
|
-
@config.expect
|
21
|
-
@config.expect
|
22
|
-
@config.expect
|
23
|
-
@config.expect
|
24
|
-
@config.expect
|
25
|
-
@config.expect
|
18
|
+
@config.expect :strippables, ["STRIPPABLE"]
|
19
|
+
@config.expect :attributes, ['__ramfunc', 'funky_attrib', 'SQLITE_API']
|
20
|
+
@config.expect :c_calling_conventions, ['__stdcall']
|
21
|
+
@config.expect :treat_as_void, ['MY_FUNKY_VOID']
|
22
|
+
@config.expect :treat_as, { "BANJOS" => "INT", "TUBAS" => "HEX16"}
|
23
|
+
@config.expect :when_no_prototypes, :error
|
24
|
+
@config.expect :verbosity, 1
|
25
|
+
@config.expect :treat_externs, :exclude
|
26
26
|
|
27
27
|
@parser = CMockHeaderParser.new(@config)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
after do
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
it "create and initialize variables to defaults appropriately" do
|
34
34
|
assert_equal([], @parser.funcs)
|
35
35
|
assert_equal(['const', '__ramfunc', 'funky_attrib', 'SQLITE_API'], @parser.c_attributes)
|
36
36
|
assert_equal(['void','MY_FUNKY_VOID'], @parser.treat_as_void)
|
37
37
|
end
|
38
38
|
|
39
|
-
|
39
|
+
it "strip out line comments" do
|
40
40
|
source =
|
41
41
|
" abcd;\n" +
|
42
42
|
"// hello;\n" +
|
@@ -51,7 +51,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
51
51
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
it "remove block comments" do
|
55
55
|
source =
|
56
56
|
" no_comments;\n" +
|
57
57
|
"// basic_line_comment;\n" +
|
@@ -84,7 +84,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
84
84
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
it "remove strippables from the beginning or end of function declarations" do
|
88
88
|
source =
|
89
89
|
"void* my_calloc(size_t, size_t) STRIPPABLE;\n" +
|
90
90
|
"void\n" +
|
@@ -104,7 +104,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
104
104
|
assert_equal(expected, @parser.import_source(source))
|
105
105
|
end
|
106
106
|
|
107
|
-
|
107
|
+
it "remove gcc's function __attribute__'s" do
|
108
108
|
source =
|
109
109
|
"void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2)));\n" +
|
110
110
|
"void\n" +
|
@@ -124,7 +124,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
124
124
|
assert_equal(expected, @parser.import_source(source))
|
125
125
|
end
|
126
126
|
|
127
|
-
|
127
|
+
it "remove preprocessor directives" do
|
128
128
|
source =
|
129
129
|
"#when stuff_happens\n" +
|
130
130
|
"#ifdef _TEST\n" +
|
@@ -136,7 +136,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
136
136
|
end
|
137
137
|
|
138
138
|
|
139
|
-
|
139
|
+
it "remove assembler pragma sections" do
|
140
140
|
source =
|
141
141
|
" #pragma\tasm\n" +
|
142
142
|
" .foo\n" +
|
@@ -151,7 +151,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
151
151
|
end
|
152
152
|
|
153
153
|
|
154
|
-
|
154
|
+
it "smush lines together that contain continuation characters" do
|
155
155
|
source =
|
156
156
|
"hoo hah \\\n" +
|
157
157
|
"when \\ \n"
|
@@ -165,7 +165,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
165
165
|
end
|
166
166
|
|
167
167
|
|
168
|
-
|
168
|
+
it "remove C macro definitions" do
|
169
169
|
source =
|
170
170
|
"#define this is the first line\\\n" +
|
171
171
|
"and the second\\\n" +
|
@@ -178,7 +178,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
178
178
|
end
|
179
179
|
|
180
180
|
|
181
|
-
|
181
|
+
it "remove typedef statements" do
|
182
182
|
source =
|
183
183
|
"typedef uint32 (unsigned int);\n" +
|
184
184
|
"const typedef int INT;\n" +
|
@@ -212,7 +212,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
212
212
|
end
|
213
213
|
|
214
214
|
|
215
|
-
|
215
|
+
it "remove enum statements" do
|
216
216
|
source =
|
217
217
|
"enum _NamedEnum {\n" +
|
218
218
|
" THING1 = (0x0001),\n" +
|
@@ -230,7 +230,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
230
230
|
end
|
231
231
|
|
232
232
|
|
233
|
-
|
233
|
+
it "remove union statements" do
|
234
234
|
source =
|
235
235
|
"union _NamedDoohicky {\n" +
|
236
236
|
" unsigned int a;\n" +
|
@@ -248,7 +248,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
248
248
|
end
|
249
249
|
|
250
250
|
|
251
|
-
|
251
|
+
it "remove struct statements" do
|
252
252
|
source =
|
253
253
|
"struct _NamedStruct1 {\n" +
|
254
254
|
" unsigned int a;\n" +
|
@@ -270,7 +270,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
270
270
|
@parser.import_source(source).map!{|s|s.strip})
|
271
271
|
end
|
272
272
|
|
273
|
-
|
273
|
+
it "remove externed and inline functions" do
|
274
274
|
source =
|
275
275
|
" extern uint32 foobar(unsigned int);\n" +
|
276
276
|
"uint32 extern_name_func(unsigned int);\n" +
|
@@ -289,26 +289,29 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
289
289
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
290
290
|
end
|
291
291
|
|
292
|
-
|
292
|
+
it "remove function definitions but keep function declarations" do
|
293
293
|
source =
|
294
294
|
"uint32 func_with_decl_a(unsigned int);\n" +
|
295
295
|
"uint32 func_with_decl_a(unsigned int a) { return a; }\n" +
|
296
296
|
"uint32 func_with_decl_b(unsigned int);\n" +
|
297
|
-
"uint32 func_with_decl_b(unsigned int)\n" +
|
297
|
+
"uint32 func_with_decl_b(unsigned int a)\n" +
|
298
298
|
"{\n" +
|
299
|
-
" bar(unsigned int);\n" +
|
299
|
+
" bar((unsigned int) a);\n" +
|
300
|
+
" stripme(a);\n" +
|
300
301
|
"}\n"
|
301
302
|
|
302
303
|
expected =
|
303
304
|
[
|
304
305
|
"uint32 func_with_decl_a(unsigned int)",
|
305
|
-
"uint32
|
306
|
+
"uint32 func_with_decl_a", #okay. it's not going to be interpretted as another function
|
307
|
+
"uint32 func_with_decl_b(unsigned int)",
|
308
|
+
"uint32 func_with_decl_b", #okay. it's not going to be interpretted as another function
|
306
309
|
]
|
307
310
|
|
308
311
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
309
312
|
end
|
310
313
|
|
311
|
-
|
314
|
+
it "remove a fully defined inline function" do
|
312
315
|
source =
|
313
316
|
"inline void foo(unsigned int a) { oranges = a; }\n" +
|
314
317
|
"inline void bar(unsigned int a) { apples = a; };\n" +
|
@@ -318,7 +321,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
318
321
|
"}"
|
319
322
|
|
320
323
|
# ensure it's expected type of exception
|
321
|
-
|
324
|
+
assert_raises RuntimeError do
|
322
325
|
@parser.parse("module", source)
|
323
326
|
end
|
324
327
|
|
@@ -332,7 +335,31 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
332
335
|
end
|
333
336
|
end
|
334
337
|
|
335
|
-
|
338
|
+
it "remove a fully defined inline function that is multiple lines" do
|
339
|
+
source =
|
340
|
+
"inline void bar(unsigned int a)\n" +
|
341
|
+
"{" +
|
342
|
+
" bananas = a;\n" +
|
343
|
+
" grapes = a;\n" +
|
344
|
+
" apples(bananas, grapes);\n" +
|
345
|
+
"}"
|
346
|
+
|
347
|
+
# ensure it's expected type of exception
|
348
|
+
assert_raises RuntimeError do
|
349
|
+
@parser.parse("module", source)
|
350
|
+
end
|
351
|
+
|
352
|
+
assert_equal([], @parser.funcs)
|
353
|
+
|
354
|
+
# verify exception message
|
355
|
+
begin
|
356
|
+
@parser.parse("module", source)
|
357
|
+
rescue RuntimeError => e
|
358
|
+
assert_equal("ERROR: No function prototypes found!", e.message)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
it "remove just inline functions if externs to be included" do
|
336
363
|
source =
|
337
364
|
" extern uint32 foobar(unsigned int);\n" +
|
338
365
|
"uint32 extern_name_func(unsigned int);\n" +
|
@@ -355,7 +382,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
355
382
|
end
|
356
383
|
|
357
384
|
|
358
|
-
|
385
|
+
it "remove defines" do
|
359
386
|
source =
|
360
387
|
"#define whatever you feel like defining\n" +
|
361
388
|
"void hello(void);\n" +
|
@@ -372,7 +399,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
372
399
|
end
|
373
400
|
|
374
401
|
|
375
|
-
|
402
|
+
it "remove keywords that would keep things from going smoothly in the future" do
|
376
403
|
source =
|
377
404
|
"const int TheMatrix(register int Trinity, unsigned int *restrict Neo)"
|
378
405
|
|
@@ -387,7 +414,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
387
414
|
|
388
415
|
# some code actually typedef's void even though it's not ANSI C and is, frankly, weird
|
389
416
|
# since cmock treats void specially, we can't let void be obfuscated
|
390
|
-
|
417
|
+
it "handle odd case of typedef'd void returned" do
|
391
418
|
source = "MY_FUNKY_VOID FunkyVoidReturned(int a)"
|
392
419
|
expected = { :var_arg=>nil,
|
393
420
|
:name=>"FunkyVoidReturned",
|
@@ -406,7 +433,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
406
433
|
assert_equal(expected, @parser.parse_declaration(source))
|
407
434
|
end
|
408
435
|
|
409
|
-
|
436
|
+
it "handle odd case of typedef'd void as arg" do
|
410
437
|
source = "int FunkyVoidAsArg(MY_FUNKY_VOID)"
|
411
438
|
expected = { :var_arg=>nil,
|
412
439
|
:name=>"FunkyVoidAsArg",
|
@@ -425,7 +452,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
425
452
|
assert_equal(expected, @parser.parse_declaration(source))
|
426
453
|
end
|
427
454
|
|
428
|
-
|
455
|
+
it "handle odd case of typedef'd void as arg pointer" do
|
429
456
|
source = "char FunkyVoidPointer(MY_FUNKY_VOID* bluh)"
|
430
457
|
expected = { :var_arg=>nil,
|
431
458
|
:name=>"FunkyVoidPointer",
|
@@ -445,7 +472,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
445
472
|
end
|
446
473
|
|
447
474
|
|
448
|
-
|
475
|
+
it "strip default values from function parameter lists" do
|
449
476
|
source =
|
450
477
|
"void Foo(int a = 57, float b=37.52, char c= 'd', char* e=\"junk\");\n"
|
451
478
|
|
@@ -458,11 +485,11 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
458
485
|
end
|
459
486
|
|
460
487
|
|
461
|
-
|
488
|
+
it "raise upon empty file" do
|
462
489
|
source = ''
|
463
490
|
|
464
491
|
# ensure it's expected type of exception
|
465
|
-
|
492
|
+
assert_raises RuntimeError do
|
466
493
|
@parser.parse("module", source)
|
467
494
|
end
|
468
495
|
|
@@ -476,14 +503,14 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
476
503
|
end
|
477
504
|
end
|
478
505
|
|
479
|
-
|
506
|
+
it "clean up module names that contain spaces, dashes, and such" do
|
480
507
|
source = 'void meh(int (*func)(int));'
|
481
508
|
|
482
509
|
retval = @parser.parse("C:\Ugly Module-Name", source)
|
483
510
|
assert (retval[:typedefs][0] =~ /CUglyModuleName/)
|
484
511
|
end
|
485
512
|
|
486
|
-
|
513
|
+
it "raise upon no function prototypes found in file" do
|
487
514
|
source =
|
488
515
|
"typedef void SILLY_VOID_TYPE1;\n" +
|
489
516
|
"typedef (void) SILLY_VOID_TYPE2 ;\n" +
|
@@ -491,7 +518,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
491
518
|
"#define get_foo() \\\n ((Thing)foo.bar)"
|
492
519
|
|
493
520
|
# ensure it's expected type of exception
|
494
|
-
|
521
|
+
assert_raises(RuntimeError) do
|
495
522
|
@parser.parse("module", source)
|
496
523
|
end
|
497
524
|
|
@@ -506,11 +533,11 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
506
533
|
end
|
507
534
|
|
508
535
|
|
509
|
-
|
536
|
+
it "raise upon prototype parsing failure" do
|
510
537
|
source = "void (int, )"
|
511
538
|
|
512
539
|
# ensure it's expected type of exception
|
513
|
-
|
540
|
+
assert_raises(RuntimeError) do
|
514
541
|
@parser.parse("module", source)
|
515
542
|
end
|
516
543
|
|
@@ -522,7 +549,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
522
549
|
end
|
523
550
|
end
|
524
551
|
|
525
|
-
|
552
|
+
it "extract and return function declarations with retval and args" do
|
526
553
|
|
527
554
|
source = "int Foo(int a, unsigned int b)"
|
528
555
|
expected = { :var_arg=>nil,
|
@@ -544,7 +571,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
544
571
|
assert_equal(expected, @parser.parse_declaration(source))
|
545
572
|
end
|
546
573
|
|
547
|
-
|
574
|
+
it "extract and return function declarations with no retval" do
|
548
575
|
|
549
576
|
source = "void FunkyChicken( uint la, int de, bool da)"
|
550
577
|
expected = { :var_arg=>nil,
|
@@ -567,7 +594,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
567
594
|
assert_equal(expected, @parser.parse_declaration(source))
|
568
595
|
end
|
569
596
|
|
570
|
-
|
597
|
+
it "extract and return function declarations with implied voids" do
|
571
598
|
|
572
599
|
source = "void tat()"
|
573
600
|
expected = { :var_arg=>nil,
|
@@ -587,7 +614,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
587
614
|
assert_equal(expected, @parser.parse_declaration(source))
|
588
615
|
end
|
589
616
|
|
590
|
-
|
617
|
+
it "extract modifiers properly" do
|
591
618
|
|
592
619
|
source = "const int TheMatrix(int Trinity, unsigned int * Neo)"
|
593
620
|
expected = { :var_arg=>nil,
|
@@ -609,7 +636,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
609
636
|
assert_equal(expected, @parser.parse_declaration(source))
|
610
637
|
end
|
611
638
|
|
612
|
-
|
639
|
+
it "extract c calling conventions properly" do
|
613
640
|
|
614
641
|
source = "const int __stdcall TheMatrix(int Trinity, unsigned int * Neo)"
|
615
642
|
expected = { :var_arg=>nil,
|
@@ -632,7 +659,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
632
659
|
assert_equal(expected, @parser.parse_declaration(source))
|
633
660
|
end
|
634
661
|
|
635
|
-
|
662
|
+
it "fully parse multiple prototypes" do
|
636
663
|
|
637
664
|
source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" +
|
638
665
|
"int Morpheus(int, unsigned int*);\n"
|
@@ -673,7 +700,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
673
700
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
674
701
|
end
|
675
702
|
|
676
|
-
|
703
|
+
it "not extract for mocking multiply defined prototypes" do
|
677
704
|
|
678
705
|
source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" +
|
679
706
|
"const int TheMatrix(int, unsigned int*);\n"
|
@@ -698,7 +725,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
698
725
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
699
726
|
end
|
700
727
|
|
701
|
-
|
728
|
+
it "properly detect typedef'd variants of void and use those" do
|
702
729
|
|
703
730
|
source = "typedef (void) FUNKY_VOID_T;\n" +
|
704
731
|
"typedef void CHUNKY_VOID_T;\n" +
|
@@ -738,7 +765,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
738
765
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
739
766
|
end
|
740
767
|
|
741
|
-
|
768
|
+
it "be ok with structs inside of function declarations" do
|
742
769
|
|
743
770
|
source = "int DrHorrible(struct SingAlong Blog);\n" +
|
744
771
|
"void Penny(struct const _KeepYourHeadUp_ * const BillyBuddy);\n" +
|
@@ -792,7 +819,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
792
819
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
793
820
|
end
|
794
821
|
|
795
|
-
|
822
|
+
it "extract functions containing unions with union specifier" do
|
796
823
|
source = "void OrangePeel(union STARS_AND_STRIPES * a, union AFL_CIO b)"
|
797
824
|
expected = [{ :var_arg=>nil,
|
798
825
|
:return=>{ :type => "void",
|
@@ -814,7 +841,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
814
841
|
assert_equal(expected, result[:functions])
|
815
842
|
end
|
816
843
|
|
817
|
-
|
844
|
+
it "not be thwarted by variables named with primitive types as part of the name" do
|
818
845
|
source = "void ApplePeel(const unsigned int const_param, int int_param, int integer, char character, int* const constant)"
|
819
846
|
expected = [{ :var_arg=>nil,
|
820
847
|
:return=>{ :type => "void",
|
@@ -839,7 +866,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
839
866
|
assert_equal(expected, result[:functions])
|
840
867
|
end
|
841
868
|
|
842
|
-
|
869
|
+
it "not be thwarted by custom types named similarly to primitive types" do
|
843
870
|
source = "void LemonPeel(integer param, character thing, longint * junk, constant value, int32_t const number)"
|
844
871
|
expected = [{:var_arg=>nil,
|
845
872
|
:return=>{ :type => "void",
|
@@ -864,7 +891,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
864
891
|
assert_equal(expected, result[:functions])
|
865
892
|
end
|
866
893
|
|
867
|
-
|
894
|
+
it "handle some of those chains of C name specifiers naturally" do
|
868
895
|
source = "void CoinOperated(signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law)"
|
869
896
|
expected = [{:var_arg=>nil,
|
870
897
|
:return=>{ :type => "void",
|
@@ -888,7 +915,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
888
915
|
assert_equal(expected, result[:functions])
|
889
916
|
end
|
890
917
|
|
891
|
-
|
918
|
+
it "handle custom types of various formats" do
|
892
919
|
source = "void CardOperated(CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const * const abc123)"
|
893
920
|
expected = [{:var_arg=>nil,
|
894
921
|
:return=>{ :type => "void",
|
@@ -912,7 +939,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
912
939
|
assert_equal(expected, result[:functions])
|
913
940
|
end
|
914
941
|
|
915
|
-
|
942
|
+
it "handle arrays and treat them as pointers" do
|
916
943
|
source = "void KeyOperated(CUSTOM_TYPE thing1[], int thing2 [ ], char thing3 [][2 ][ 3], int* thing4[4])"
|
917
944
|
expected = [{:var_arg=>nil,
|
918
945
|
:return=>{ :type => "void",
|
@@ -936,7 +963,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
936
963
|
assert_equal(expected, result[:functions])
|
937
964
|
end
|
938
965
|
|
939
|
-
|
966
|
+
it "give a reasonable guess when dealing with weird combinations of custom types and modifiers" do
|
940
967
|
source = "void Cheese(unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq)"
|
941
968
|
expected = [{:var_arg=>nil,
|
942
969
|
:return=>{ :type => "void",
|
@@ -959,7 +986,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
959
986
|
assert_equal(expected, result[:functions])
|
960
987
|
end
|
961
988
|
|
962
|
-
|
989
|
+
it "extract functions containing a function pointer" do
|
963
990
|
source = "void FunkyTurkey(unsigned int (*func_ptr)(int, char))"
|
964
991
|
expected = [{ :var_arg=>nil,
|
965
992
|
:return=>{ :type => "void",
|
@@ -982,7 +1009,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
982
1009
|
assert_equal(typedefs, result[:typedefs])
|
983
1010
|
end
|
984
1011
|
|
985
|
-
|
1012
|
+
it "extract functions containing a function pointer with an implied void" do
|
986
1013
|
source = "void FunkyTurkey(unsigned int (*func_ptr)())"
|
987
1014
|
expected = [{ :var_arg=>nil,
|
988
1015
|
:return=>{ :type => "void",
|
@@ -1005,7 +1032,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1005
1032
|
assert_equal(typedefs, result[:typedefs])
|
1006
1033
|
end
|
1007
1034
|
|
1008
|
-
|
1035
|
+
it "extract functions containing a constant function pointer and a pointer in the nested arg list" do
|
1009
1036
|
source = "void FunkyChicken(unsigned int (* const func_ptr)(unsigned long int * , char))"
|
1010
1037
|
expected = [{ :var_arg=>nil,
|
1011
1038
|
:return=>{ :type => "void",
|
@@ -1028,7 +1055,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1028
1055
|
assert_equal(typedefs, result[:typedefs])
|
1029
1056
|
end
|
1030
1057
|
|
1031
|
-
#
|
1058
|
+
# it "extract functions containing a function pointer taking a vararg" do
|
1032
1059
|
# source = "void FunkyParrot(unsigned int (*func_ptr)(int, char, ...))"
|
1033
1060
|
# expected = [{ :var_arg=>nil,
|
1034
1061
|
# :return=>{ :type => "void",
|
@@ -1051,7 +1078,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1051
1078
|
# assert_equal(typedefs, result[:typedefs])
|
1052
1079
|
# end
|
1053
1080
|
|
1054
|
-
|
1081
|
+
it "extract functions containing a function pointer with extra parenthesis and two sets" do
|
1055
1082
|
source = "void FunkyBudgie(int (((* func_ptr1)(int, char))), void (*func_ptr2)(void))"
|
1056
1083
|
expected = [{ :var_arg=>nil,
|
1057
1084
|
:return=>{ :type => "void",
|
@@ -1075,7 +1102,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1075
1102
|
assert_equal(typedefs, result[:typedefs])
|
1076
1103
|
end
|
1077
1104
|
|
1078
|
-
|
1105
|
+
it "extract functions containing a function pointers, structs and other things" do
|
1079
1106
|
source = "struct mytype *FunkyRobin(uint16_t num1, uint16_t num2, void (*func_ptr1)(uint16_t num3, struct mytype2 *s));"
|
1080
1107
|
expected = [{ :var_arg=>nil,
|
1081
1108
|
:return=>{ :type => "struct mytype*",
|
@@ -1100,7 +1127,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1100
1127
|
assert_equal(typedefs, result[:typedefs])
|
1101
1128
|
end
|
1102
1129
|
|
1103
|
-
|
1130
|
+
it "extract functions containing an anonymous function pointer" do
|
1104
1131
|
source = "void FunkyFowl(unsigned int (* const)(int, char))"
|
1105
1132
|
expected = [{ :var_arg=>nil,
|
1106
1133
|
:return=>{ :type => "void",
|
@@ -1123,7 +1150,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1123
1150
|
assert_equal(typedefs, result[:typedefs])
|
1124
1151
|
end
|
1125
1152
|
|
1126
|
-
|
1153
|
+
it "extract functions returning a function pointer" do
|
1127
1154
|
source = "unsigned short (*FunkyPidgeon( const char op_code ))( int, long int )"
|
1128
1155
|
expected = [{ :var_arg=>nil,
|
1129
1156
|
:return=>{ :type => "cmock_module_func_ptr1",
|
@@ -1146,7 +1173,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1146
1173
|
assert_equal(typedefs, result[:typedefs])
|
1147
1174
|
end
|
1148
1175
|
|
1149
|
-
|
1176
|
+
it "extract functions returning a function pointer with implied void" do
|
1150
1177
|
source = "unsigned short (*FunkyTweetie())()"
|
1151
1178
|
expected = [{ :var_arg=>nil,
|
1152
1179
|
:return=>{ :type => "cmock_module_func_ptr1",
|
@@ -1168,7 +1195,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1168
1195
|
assert_equal(typedefs, result[:typedefs])
|
1169
1196
|
end
|
1170
1197
|
|
1171
|
-
|
1198
|
+
it "extract functions returning a function pointer where everything is a void" do
|
1172
1199
|
source = "void (* FunkySeaGull(void))(void)"
|
1173
1200
|
expected = [{ :var_arg=>nil,
|
1174
1201
|
:return=>{ :type => "cmock_module_func_ptr1",
|
@@ -1190,7 +1217,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1190
1217
|
assert_equal(typedefs, result[:typedefs])
|
1191
1218
|
end
|
1192
1219
|
|
1193
|
-
|
1220
|
+
it "extract functions returning a function pointer with some pointer nonsense" do
|
1194
1221
|
source = "unsigned int * (* FunkyMacaw(double* foo, THING *bar))(unsigned int)"
|
1195
1222
|
expected = [{ :var_arg=>nil,
|
1196
1223
|
:return=>{ :type => "cmock_module_func_ptr1",
|
@@ -1214,7 +1241,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1214
1241
|
assert_equal(typedefs, result[:typedefs])
|
1215
1242
|
end
|
1216
1243
|
|
1217
|
-
|
1244
|
+
it "extract this SQLite3 function with an anonymous function pointer arg (regression test)" do
|
1218
1245
|
source = "SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*))"
|
1219
1246
|
expected = [{ :var_arg=>nil,
|
1220
1247
|
:return=>{ :type => "int",
|
@@ -1241,7 +1268,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1241
1268
|
assert_equal(typedefs, result[:typedefs])
|
1242
1269
|
end
|
1243
1270
|
|
1244
|
-
|
1271
|
+
it "extract functions with varargs" do
|
1245
1272
|
source = "int XFiles(int Scully, int Mulder, ...);\n"
|
1246
1273
|
expected = [{ :var_arg=>"...",
|
1247
1274
|
:return=> { :type => "int",
|
@@ -1263,7 +1290,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1263
1290
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1264
1291
|
end
|
1265
1292
|
|
1266
|
-
|
1293
|
+
it "extract functions with strippable confusing junk like gcc attributes" do
|
1267
1294
|
source = "int LaverneAndShirley(int Lenny, int Squiggy) __attribute__((weak)) __attribute__ ((deprecated));\n"
|
1268
1295
|
expected = [{ :var_arg=>nil,
|
1269
1296
|
:return=> { :type => "int",
|
@@ -1285,7 +1312,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
1285
1312
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1286
1313
|
end
|
1287
1314
|
|
1288
|
-
|
1315
|
+
it "extract functions with strippable confusing junk like gcc attributes with parenthesis" do
|
1289
1316
|
source = "int TheCosbyShow(int Cliff, int Claire) __attribute__((weak, alias (\"__f\"));\n"
|
1290
1317
|
expected = [{ :var_arg=>nil,
|
1291
1318
|
:return=> { :type => "int",
|