acpc_dealer 2.0.6 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -2
  3. data/lib/acpc_dealer.rb +6 -2
  4. data/lib/acpc_dealer/version.rb +1 -1
  5. data/vendor/project_acpc_server/Makefile +12 -2
  6. data/vendor/project_acpc_server/README +1 -0
  7. data/vendor/project_acpc_server/example_player.limit.2p.sh +2 -1
  8. data/vendor/project_acpc_server/example_player.limit.3p.sh +2 -1
  9. data/vendor/project_acpc_server/example_player.nolimit.2p.sh +2 -1
  10. data/vendor/project_acpc_server/example_player.nolimit.3p.sh +2 -1
  11. data/vendor/project_acpc_server/kuhn.limit.3p.game +14 -0
  12. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf1.sh +3 -0
  13. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf2.sh +3 -0
  14. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf3.sh +3 -0
  15. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/LICENCE +23 -0
  16. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +128 -0
  17. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +35 -0
  18. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/CExceptionConfig.h +12 -0
  19. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.c +49 -0
  20. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.h +22 -0
  21. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.c +483 -0
  22. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.h +107 -0
  23. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/main.c +84 -0
  24. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.c +252 -0
  25. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.h +21 -0
  26. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.c +45 -0
  27. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.h +27 -0
  28. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player.c +698 -0
  29. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_1.c +324 -0
  30. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_2.c +262 -0
  31. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_3.c +177 -0
  32. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.odt +0 -0
  33. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.pdf +0 -0
  34. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/license.txt +30 -0
  35. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/readme.txt +242 -0
  36. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.c +43 -0
  37. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.h +86 -0
  38. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/build.info +2 -0
  39. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/version.info +2 -0
  40. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/production_environment.rb +14 -0
  41. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/test_environment.rb +16 -0
  42. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.odt +0 -0
  43. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.pdf +0 -0
  44. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock_Summary.md +356 -0
  45. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/license.txt +31 -0
  46. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
  47. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
  48. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
  49. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
  50. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
  51. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
  52. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -0
  53. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewd +1696 -0
  54. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -0
  55. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.eww +10 -0
  56. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -0
  57. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
  58. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
  59. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
  60. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -0
  61. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -0
  62. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
  63. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
  64. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
  65. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +42 -0
  66. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
  67. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
  68. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -0
  69. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
  70. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
  71. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
  72. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
  73. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
  74. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -0
  75. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewd +1906 -0
  76. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -0
  77. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.eww +26 -0
  78. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -0
  79. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -0
  80. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
  81. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -0
  82. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
  83. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
  84. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
  85. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
  86. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
  87. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
  88. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
  89. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +44 -0
  90. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
  91. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
  92. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
  93. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
  94. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -0
  95. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -0
  96. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock.rb +65 -0
  97. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_config.rb +129 -0
  98. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_file_writer.rb +33 -0
  99. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator.rb +195 -0
  100. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_array.rb +57 -0
  101. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_callback.rb +78 -0
  102. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +51 -0
  103. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_expect.rb +86 -0
  104. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +95 -0
  105. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +44 -0
  106. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +74 -0
  107. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_utils.rb +202 -0
  108. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_header_parser.rb +277 -0
  109. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_plugin_manager.rb +40 -0
  110. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_unityhelper_parser.rb +75 -0
  111. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/build.info +2 -0
  112. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/version.info +2 -0
  113. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.c +176 -0
  114. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.h +31 -0
  115. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock_internals.h +43 -0
  116. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/gcc.yml +53 -0
  117. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v4.yml +108 -0
  118. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v5.yml +93 -0
  119. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/History.md +27 -0
  120. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Makefile +8 -0
  121. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Readme.md +103 -0
  122. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/package.json +9 -0
  123. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.c +250 -0
  124. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.h +88 -0
  125. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/test.c +34 -0
  126. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_prompt.rb +94 -0
  127. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_reporter.rb +39 -0
  128. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_config.yml +36 -0
  129. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_module.rb +202 -0
  130. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb +316 -0
  131. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb +23 -0
  132. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb +139 -0
  133. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.odt +0 -0
  134. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.pdf +0 -0
  135. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.txt +216 -0
  136. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/license.txt +31 -0
  137. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/build.info +2 -0
  138. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/version.info +2 -0
  139. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.c +1146 -0
  140. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.h +245 -0
  141. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity_internals.h +546 -0
  142. data/vendor/project_acpc_server/net.c +0 -0
  143. data/vendor/project_acpc_server/net.h +1 -0
  144. data/vendor/project_acpc_server/tags +298 -0
  145. metadata +158 -26
@@ -0,0 +1,129 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ class CMockConfig
8
+
9
+ CMockDefaultOptions =
10
+ {
11
+ :framework => :unity,
12
+ :mock_path => 'mocks',
13
+ :mock_prefix => 'Mock',
14
+ :plugins => [],
15
+ :strippables => ['(?:__attribute__\s*\(+.*?\)+)'],
16
+ :attributes => ['__ramfunc', '__irq', '__fiq', 'register', 'extern'],
17
+ :c_calling_conventions => ['__stdcall', '__cdecl', '__fastcall'],
18
+ :enforce_strict_ordering => false,
19
+ :unity_helper_path => false,
20
+ :treat_as => {},
21
+ :treat_as_void => [],
22
+ :memcmp_if_unknown => true,
23
+ :when_no_prototypes => :warn, #the options being :ignore, :warn, or :error
24
+ :when_ptr => :compare_data, #the options being :compare_ptr, :compare_data, or :smart
25
+ :verbosity => 2, #the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose
26
+ :treat_externs => :exclude, #the options being :include or :exclude
27
+ :ignore => :args_and_calls, #the options being :args_and_calls or :args_only
28
+ :callback_include_count => true,
29
+ :callback_after_arg_check => false,
30
+ :includes => nil,
31
+ :includes_h_pre_orig_header => nil,
32
+ :includes_h_post_orig_header => nil,
33
+ :includes_c_pre_header => nil,
34
+ :includes_c_post_header => nil
35
+ }
36
+
37
+ def initialize(options=nil)
38
+ case(options)
39
+ when NilClass then options = CMockDefaultOptions.clone
40
+ when String then options = CMockDefaultOptions.clone.merge(load_config_file_from_yaml(options))
41
+ when Hash then options = CMockDefaultOptions.clone.merge(options)
42
+ else raise "If you specify arguments, it should be a filename or a hash of options"
43
+ end
44
+
45
+ #do some quick type verification
46
+ [:plugins, :attributes, :treat_as_void].each do |opt|
47
+ unless (options[opt].class == Array)
48
+ options[opt] = []
49
+ puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1)
50
+ end
51
+ end
52
+ [:includes, :includes_h_pre_orig_header, :includes_h_post_orig_header, :includes_c_pre_header, :includes_c_post_header].each do |opt|
53
+ unless (options[opt].nil? or (options[opt].class == Array))
54
+ options[opt] = []
55
+ puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1)
56
+ end
57
+ end
58
+ options[:unity_helper_path] ||= options[:unity_helper]
59
+ options[:plugins].compact!
60
+ options[:plugins].map! {|p| p.to_sym}
61
+ @options = options
62
+
63
+ treat_as_map = standard_treat_as_map()#.clone
64
+ treat_as_map.merge!(@options[:treat_as])
65
+ @options[:treat_as] = treat_as_map
66
+
67
+ @options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") }
68
+ end
69
+
70
+ def load_config_file_from_yaml yaml_filename
71
+ require 'yaml'
72
+ require 'fileutils'
73
+ YAML.load_file(yaml_filename)[:cmock]
74
+ end
75
+
76
+ def set_path(path)
77
+ @src_path = path
78
+ end
79
+
80
+ def load_unity_helper
81
+ return File.new(@options[:unity_helper_path]).read if (@options[:unity_helper_path])
82
+ return nil
83
+ end
84
+
85
+ def standard_treat_as_map
86
+ {
87
+ 'int' => 'INT',
88
+ 'char' => 'INT8',
89
+ 'short' => 'INT16',
90
+ 'long' => 'INT',
91
+ 'int8' => 'INT8',
92
+ 'int16' => 'INT16',
93
+ 'int32' => 'INT',
94
+ 'int8_t' => 'INT8',
95
+ 'int16_t' => 'INT16',
96
+ 'int32_t' => 'INT',
97
+ 'INT8_T' => 'INT8',
98
+ 'INT16_T' => 'INT16',
99
+ 'INT32_T' => 'INT',
100
+ 'bool' => 'INT',
101
+ 'bool_t' => 'INT',
102
+ 'BOOL' => 'INT',
103
+ 'BOOL_T' => 'INT',
104
+ 'unsigned int' => 'HEX32',
105
+ 'unsigned long' => 'HEX32',
106
+ 'uint32' => 'HEX32',
107
+ 'uint32_t' => 'HEX32',
108
+ 'UINT32' => 'HEX32',
109
+ 'UINT32_T' => 'HEX32',
110
+ 'void*' => 'PTR',
111
+ 'unsigned short' => 'HEX16',
112
+ 'uint16' => 'HEX16',
113
+ 'uint16_t' => 'HEX16',
114
+ 'UINT16' => 'HEX16',
115
+ 'UINT16_T' => 'HEX16',
116
+ 'unsigned char' => 'HEX8',
117
+ 'uint8' => 'HEX8',
118
+ 'uint8_t' => 'HEX8',
119
+ 'UINT8' => 'HEX8',
120
+ 'UINT8_T' => 'HEX8',
121
+ 'char*' => 'STRING',
122
+ 'pCHAR' => 'STRING',
123
+ 'cstring' => 'STRING',
124
+ 'CSTRING' => 'STRING',
125
+ 'float' => 'FLOAT',
126
+ 'double' => 'FLOAT'
127
+ }
128
+ end
129
+ end
@@ -0,0 +1,33 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ class CMockFileWriter
8
+
9
+ attr_reader :config
10
+
11
+ def initialize(config)
12
+ @config = config
13
+ end
14
+
15
+ def create_file(filename)
16
+ raise "Where's the block of data to create?" unless block_given?
17
+ full_file_name_temp = "#{@config.mock_path}/#{filename}.new"
18
+ full_file_name_done = "#{@config.mock_path}/#{filename}"
19
+ File.open(full_file_name_temp, 'w') do |file|
20
+ yield(file, filename)
21
+ end
22
+ update_file(full_file_name_done, full_file_name_temp)
23
+ end
24
+
25
+ private ###################################
26
+
27
+ def update_file(dest, src)
28
+ require 'fileutils'
29
+ FileUtils.rm(dest) if (File.exist?(dest))
30
+ FileUtils.cp(src, dest)
31
+ FileUtils.rm(src)
32
+ end
33
+ end
@@ -0,0 +1,195 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ $here = File.dirname __FILE__
8
+
9
+ class CMockGenerator
10
+
11
+ attr_accessor :config, :file_writer, :module_name, :clean_mock_name, :mock_name, :utils, :plugins, :ordered
12
+
13
+ def initialize(config, file_writer, utils, plugins)
14
+ @file_writer = file_writer
15
+ @utils = utils
16
+ @plugins = plugins
17
+ @config = config
18
+ @prefix = @config.mock_prefix
19
+ @ordered = @config.enforce_strict_ordering
20
+ @framework = @config.framework.to_s
21
+
22
+ @includes_h_pre_orig_header = (@config.includes || @config.includes_h_pre_orig_header || []).map{|h| h =~ /</ ? h : "\"#{h}\""}
23
+ @includes_h_post_orig_header = (@config.includes_h_post_orig_header || []).map{|h| h =~ /</ ? h : "\"#{h}\""}
24
+ @includes_c_pre_header = (@config.includes_c_pre_header || []).map{|h| h =~ /</ ? h : "\"#{h}\""}
25
+ @includes_c_post_header = (@config.includes_c_post_header || []).map{|h| h =~ /</ ? h : "\"#{h}\""}
26
+ end
27
+
28
+ def create_mock(module_name, parsed_stuff)
29
+ @module_name = module_name
30
+ @mock_name = @prefix + @module_name
31
+ @clean_mock_name = @mock_name.gsub(/(?:-|\s+)/, "_")
32
+ create_mock_header_file(parsed_stuff)
33
+ create_mock_source_file(parsed_stuff)
34
+ end
35
+
36
+ private if $ThisIsOnlyATest.nil? ##############################
37
+
38
+ def create_mock_header_file(parsed_stuff)
39
+ @file_writer.create_file(@mock_name + ".h") do |file, filename|
40
+ create_mock_header_header(file, filename)
41
+ create_mock_header_service_call_declarations(file)
42
+ create_typedefs(file, parsed_stuff[:typedefs])
43
+ parsed_stuff[:functions].each do |function|
44
+ file << @plugins.run(:mock_function_declarations, function)
45
+ end
46
+ create_mock_header_footer(file)
47
+ end
48
+ end
49
+
50
+ def create_mock_source_file(parsed_stuff)
51
+ @file_writer.create_file(@mock_name + ".c") do |file, filename|
52
+ create_source_header_section(file, filename)
53
+ create_instance_structure(file, parsed_stuff[:functions])
54
+ create_extern_declarations(file)
55
+ create_mock_verify_function(file, parsed_stuff[:functions])
56
+ create_mock_init_function(file)
57
+ create_mock_destroy_function(file, parsed_stuff[:functions])
58
+ parsed_stuff[:functions].each do |function|
59
+ create_mock_implementation(file, function)
60
+ create_mock_interfaces(file, function)
61
+ end
62
+ end
63
+ end
64
+
65
+ def create_mock_header_header(file, filename)
66
+ define_name = @clean_mock_name.gsub(/\.h/, "_h").upcase
67
+ orig_filename = filename.gsub(@config.mock_prefix, "")
68
+ file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
69
+ file << "#ifndef _#{define_name}_H\n"
70
+ file << "#define _#{define_name}_H\n\n"
71
+ @includes_h_pre_orig_header.each {|inc| file << "#include #{inc}\n"}
72
+ file << "#include \"#{orig_filename}\"\n"
73
+ @includes_h_post_orig_header.each {|inc| file << "#include #{inc}\n"}
74
+ plugin_includes = @plugins.run(:include_files)
75
+ file << plugin_includes if (!plugin_includes.empty?)
76
+ file << "\n"
77
+ end
78
+
79
+ def create_typedefs(file, typedefs)
80
+ file << "\n"
81
+ typedefs.each {|typedef| file << "#{typedef}\n" }
82
+ file << "\n\n"
83
+ end
84
+
85
+ def create_mock_header_service_call_declarations(file)
86
+ file << "void #{@clean_mock_name}_Init(void);\n"
87
+ file << "void #{@clean_mock_name}_Destroy(void);\n"
88
+ file << "void #{@clean_mock_name}_Verify(void);\n\n"
89
+ end
90
+
91
+ def create_mock_header_footer(header)
92
+ header << "\n#endif\n"
93
+ end
94
+
95
+ def create_source_header_section(file, filename)
96
+ header_file = filename.gsub(".c",".h")
97
+ file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
98
+ file << "#include <string.h>\n"
99
+ file << "#include <stdlib.h>\n"
100
+ file << "#include <setjmp.h>\n"
101
+ file << "#include \"#{@framework}.h\"\n"
102
+ file << "#include \"cmock.h\"\n"
103
+ @includes_c_pre_header.each {|inc| file << "#include #{inc}\n"}
104
+ file << "#include \"#{header_file}\"\n"
105
+ @includes_c_post_header.each {|inc| file << "#include #{inc}\n"}
106
+ file << "\n"
107
+ end
108
+
109
+ def create_instance_structure(file, functions)
110
+ functions.each do |function|
111
+ file << "typedef struct _CMOCK_#{function[:name]}_CALL_INSTANCE\n{\n"
112
+ file << " UNITY_LINE_TYPE LineNumber;\n"
113
+ file << @plugins.run(:instance_typedefs, function)
114
+ file << "\n} CMOCK_#{function[:name]}_CALL_INSTANCE;\n\n"
115
+ end
116
+ file << "static struct #{@clean_mock_name}Instance\n{\n"
117
+ if (functions.size == 0)
118
+ file << " unsigned char placeHolder;\n"
119
+ end
120
+ functions.each do |function|
121
+ file << @plugins.run(:instance_structure, function)
122
+ file << " CMOCK_MEM_INDEX_TYPE #{function[:name]}_CallInstance;\n"
123
+ end
124
+ file << "} Mock;\n\n"
125
+ end
126
+
127
+ def create_extern_declarations(file)
128
+ file << "extern jmp_buf AbortFrame;\n"
129
+ if (@ordered)
130
+ file << "extern int GlobalExpectCount;\n"
131
+ file << "extern int GlobalVerifyOrder;\n"
132
+ end
133
+ file << "\n"
134
+ end
135
+
136
+ def create_mock_verify_function(file, functions)
137
+ file << "void #{@clean_mock_name}_Verify(void)\n{\n"
138
+ verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join
139
+ file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" unless verifications.empty?
140
+ file << verifications
141
+ file << "}\n\n"
142
+ end
143
+
144
+ def create_mock_init_function(file)
145
+ file << "void #{@clean_mock_name}_Init(void)\n{\n"
146
+ file << " #{@clean_mock_name}_Destroy();\n"
147
+ file << "}\n\n"
148
+ end
149
+
150
+ def create_mock_destroy_function(file, functions)
151
+ file << "void #{@clean_mock_name}_Destroy(void)\n{\n"
152
+ file << " CMock_Guts_MemFreeAll();\n"
153
+ file << " memset(&Mock, 0, sizeof(Mock));\n"
154
+ file << functions.collect {|function| @plugins.run(:mock_destroy, function)}.join
155
+ if (@ordered)
156
+ file << " GlobalExpectCount = 0;\n"
157
+ file << " GlobalVerifyOrder = 0;\n"
158
+ end
159
+ file << "}\n\n"
160
+ end
161
+
162
+ def create_mock_implementation(file, function)
163
+ # prepare return value and arguments
164
+ function_mod_and_rettype = (function[:modifier].empty? ? '' : "#{function[:modifier]} ") +
165
+ (function[:return][:type]) +
166
+ (function[:c_calling_convention] ? " #{function[:c_calling_convention]}" : '')
167
+ args_string = function[:args_string]
168
+ args_string += (", " + function[:var_arg]) unless (function[:var_arg].nil?)
169
+
170
+ # Create mock function
171
+ file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n"
172
+ file << "{\n"
173
+ file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n"
174
+ file << " CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{function[:name]}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.#{function[:name]}_CallInstance);\n"
175
+ file << " Mock.#{function[:name]}_CallInstance = CMock_Guts_MemNext(Mock.#{function[:name]}_CallInstance);\n"
176
+ file << @plugins.run(:mock_implementation_precheck, function)
177
+ file << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function '#{function[:name]}' called more times than expected.\");\n"
178
+ file << " cmock_line = cmock_call_instance->LineNumber;\n"
179
+ if (@ordered)
180
+ file << " if (cmock_call_instance->CallOrder > ++GlobalVerifyOrder)\n"
181
+ file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called earlier than expected.\");\n"
182
+ file << " if (cmock_call_instance->CallOrder < GlobalVerifyOrder)\n"
183
+ file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called later than expected.\");\n"
184
+ # file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n"
185
+ end
186
+ file << @plugins.run(:mock_implementation, function)
187
+ file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
188
+ file << "}\n\n"
189
+ end
190
+
191
+ def create_mock_interfaces(file, function)
192
+ file << @utils.code_add_argument_loader(function)
193
+ file << @plugins.run(:mock_interfaces, function)
194
+ end
195
+ end
@@ -0,0 +1,57 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ class CMockGeneratorPluginArray
8
+
9
+ attr_reader :priority
10
+ attr_accessor :config, :utils, :unity_helper, :ordered
11
+ def initialize(config, utils)
12
+ @config = config
13
+ @ptr_handling = @config.when_ptr
14
+ @ordered = @config.enforce_strict_ordering
15
+ @utils = utils
16
+ @unity_helper = @utils.helpers[:unity_helper]
17
+ @priority = 8
18
+ end
19
+
20
+ def instance_typedefs(function)
21
+ function[:args].inject("") do |all, arg|
22
+ (arg[:ptr?]) ? all + " int Expected_#{arg[:name]}_Depth;\n" : all
23
+ end
24
+ end
25
+
26
+ def mock_function_declarations(function)
27
+ return nil unless function[:contains_ptr?]
28
+ args_call = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : "#{m[:name]}"}.join(', ')
29
+ args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ')
30
+ if (function[:return][:void?])
31
+ return "#define #{function[:name]}_ExpectWithArray(#{args_call}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call})\n" +
32
+ "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string});\n"
33
+ else
34
+ return "#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call}, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, #{args_call}, cmock_retval)\n" +
35
+ "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]});\n"
36
+ end
37
+ end
38
+
39
+ def mock_interfaces(function)
40
+ return nil unless function[:contains_ptr?]
41
+ lines = []
42
+ func_name = function[:name]
43
+ args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ')
44
+ call_string = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : m[:name]}.join(', ')
45
+ if (function[:return][:void?])
46
+ lines << "void #{func_name}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string})\n"
47
+ else
48
+ lines << "void #{func_name}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]})\n"
49
+ end
50
+ lines << "{\n"
51
+ lines << @utils.code_add_base_expectation(func_name)
52
+ lines << " CMockExpectParameters_#{func_name}(cmock_call_instance, #{call_string});\n"
53
+ lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" unless (function[:return][:void?])
54
+ lines << "}\n\n"
55
+ end
56
+
57
+ end
@@ -0,0 +1,78 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ class CMockGeneratorPluginCallback
8
+
9
+ attr_accessor :include_count
10
+ attr_reader :priority
11
+ attr_reader :config, :utils
12
+
13
+ def initialize(config, utils)
14
+ @config = config
15
+ @utils = utils
16
+ @priority = 6
17
+
18
+ @include_count = @config.callback_include_count
19
+ if (@config.callback_after_arg_check)
20
+ alias :mock_implementation :mock_implementation_for_callbacks
21
+ alias :mock_implementation_precheck :nothing
22
+ else
23
+ alias :mock_implementation_precheck :mock_implementation_for_callbacks
24
+ alias :mock_implementation :nothing
25
+ end
26
+ end
27
+
28
+ def instance_structure(function)
29
+ func_name = function[:name]
30
+ " CMOCK_#{func_name}_CALLBACK #{func_name}_CallbackFunctionPointer;\n" +
31
+ " int #{func_name}_CallbackCalls;\n"
32
+ end
33
+
34
+ def mock_function_declarations(function)
35
+ func_name = function[:name]
36
+ return_type = function[:return][:const?] ? "const #{function[:return][:type]}" : function[:return][:type]
37
+ style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2)
38
+ styles = [ "void", "int cmock_num_calls", function[:args_string], "#{function[:args_string]}, int cmock_num_calls" ]
39
+ "typedef #{return_type} (* CMOCK_#{func_name}_CALLBACK)(#{styles[style]});\nvoid #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback);\n"
40
+ end
41
+
42
+ def mock_implementation_for_callbacks(function)
43
+ func_name = function[:name]
44
+ style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4)
45
+ " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" +
46
+ case(style)
47
+ when 0 then " Mock.#{func_name}_CallbackFunctionPointer();\n return;\n }\n"
48
+ when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n return;\n }\n"
49
+ when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n return;\n }\n"
50
+ when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n return;\n }\n"
51
+ when 4 then " return Mock.#{func_name}_CallbackFunctionPointer();\n }\n"
52
+ when 5 then " return Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n"
53
+ when 6 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n"
54
+ when 7 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n"
55
+ end
56
+ end
57
+
58
+ def nothing(function)
59
+ return ""
60
+ end
61
+
62
+ def mock_interfaces(function)
63
+ func_name = function[:name]
64
+ "void #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback)\n{\n" +
65
+ " Mock.#{func_name}_CallbackFunctionPointer = Callback;\n}\n\n"
66
+ end
67
+
68
+ def mock_destroy(function)
69
+ " Mock.#{function[:name]}_CallbackFunctionPointer = NULL;\n" +
70
+ " Mock.#{function[:name]}_CallbackCalls = 0;\n"
71
+ end
72
+
73
+ def mock_verify(function)
74
+ func_name = function[:name]
75
+ " if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n"
76
+ end
77
+
78
+ end