acpc_dealer 2.4.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Brickfile +6 -0
- data/README.md +7 -6
- data/Rakefile +30 -14
- data/acpc_dealer.gemspec +2 -1
- data/bin/acpc_dealer +4 -0
- data/ext/hand_evaluator/extconf.rb +10 -0
- data/lib/acpc_dealer/version.rb +1 -1
- data/lib/hand_evaluator.bundle +0 -0
- data/spec/dealer_runner_spec.rb +76 -72
- metadata +19 -82
- data/vendor/project_acpc_server/LICENCE +0 -23
- data/vendor/project_acpc_server/Makefile +0 -35
- data/vendor/project_acpc_server/README +0 -113
- data/vendor/project_acpc_server/README.submission +0 -42
- data/vendor/project_acpc_server/acpc_play_match.pl +0 -101
- data/vendor/project_acpc_server/bm_run_matches.c +0 -238
- data/vendor/project_acpc_server/bm_server.c +0 -1604
- data/vendor/project_acpc_server/bm_server.config +0 -78
- data/vendor/project_acpc_server/bm_widget.c +0 -230
- data/vendor/project_acpc_server/dealer.c +0 -1293
- data/vendor/project_acpc_server/evalHandTables +0 -4269
- data/vendor/project_acpc_server/example_player.c +0 -204
- data/vendor/project_acpc_server/example_player.limit.2p.sh +0 -3
- data/vendor/project_acpc_server/example_player.limit.3p.sh +0 -3
- data/vendor/project_acpc_server/example_player.nolimit.2p.sh +0 -3
- data/vendor/project_acpc_server/example_player.nolimit.3p.sh +0 -3
- data/vendor/project_acpc_server/game.c +0 -1792
- data/vendor/project_acpc_server/game.h +0 -253
- data/vendor/project_acpc_server/holdem.limit.2p.reverse_blinds.game +0 -13
- data/vendor/project_acpc_server/holdem.limit.3p.game +0 -13
- data/vendor/project_acpc_server/holdem.nolimit.2p.reverse_blinds.game +0 -12
- data/vendor/project_acpc_server/holdem.nolimit.3p.game +0 -12
- data/vendor/project_acpc_server/kuhn.limit.3p.game +0 -14
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf1.sh +0 -3
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf2.sh +0 -3
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf3.sh +0 -3
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/LICENCE +0 -23
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +0 -127
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +0 -35
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/CExceptionConfig.h +0 -12
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.c +0 -49
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.h +0 -22
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.c +0 -483
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.h +0 -108
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/main.c +0 -84
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.c +0 -253
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.h +0 -21
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.c +0 -45
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.h +0 -27
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player.c +0 -698
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_1.c +0 -324
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_2.c +0 -262
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_3.c +0 -177
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/license.txt +0 -30
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/readme.txt +0 -242
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.c +0 -43
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.h +0 -86
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/build.info +0 -2
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/version.info +0 -2
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/History.md +0 -27
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Makefile +0 -8
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Readme.md +0 -103
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/package.json +0 -9
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.c +0 -250
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.h +0 -88
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/test.c +0 -34
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_prompt.rb +0 -94
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_reporter.rb +0 -39
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_config.yml +0 -36
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_module.rb +0 -202
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb +0 -316
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb +0 -23
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb +0 -139
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.txt +0 -216
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/license.txt +0 -31
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/build.info +0 -2
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/version.info +0 -2
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.c +0 -1146
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.h +0 -245
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity_internals.h +0 -546
- data/vendor/project_acpc_server/net.c +0 -218
- data/vendor/project_acpc_server/net.h +0 -62
- data/vendor/project_acpc_server/play_match.pl +0 -99
- data/vendor/project_acpc_server/protocol.md +0 -239
- data/vendor/project_acpc_server/protocol.odt +0 -0
- data/vendor/project_acpc_server/protocol.pdf +0 -0
- data/vendor/project_acpc_server/rng.c +0 -139
- data/vendor/project_acpc_server/rng.h +0 -63
- data/vendor/project_acpc_server/validate_submission.pl +0 -546
data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb
DELETED
@@ -1,316 +0,0 @@
|
|
1
|
-
# ==========================================
|
2
|
-
# Unity Project - A Test Framework 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
|
-
File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))
|
8
|
-
|
9
|
-
class UnityTestRunnerGenerator
|
10
|
-
|
11
|
-
def initialize(options = nil)
|
12
|
-
@options = { :includes => [], :plugins => [], :framework => :unity }
|
13
|
-
case(options)
|
14
|
-
when NilClass then @options
|
15
|
-
when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options))
|
16
|
-
when Hash then @options.merge!(options)
|
17
|
-
else raise "If you specify arguments, it should be a filename or a hash of options"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.grab_config(config_file)
|
22
|
-
options = { :includes => [], :plugins => [], :framework => :unity }
|
23
|
-
unless (config_file.nil? or config_file.empty?)
|
24
|
-
require 'yaml'
|
25
|
-
yaml_guts = YAML.load_file(config_file)
|
26
|
-
options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock])
|
27
|
-
raise "No :unity or :cmock section found in #{config_file}" unless options
|
28
|
-
end
|
29
|
-
return(options)
|
30
|
-
end
|
31
|
-
|
32
|
-
def run(input_file, output_file, options=nil)
|
33
|
-
tests = []
|
34
|
-
testfile_includes = []
|
35
|
-
used_mocks = []
|
36
|
-
|
37
|
-
@options.merge!(options) unless options.nil?
|
38
|
-
module_name = File.basename(input_file)
|
39
|
-
|
40
|
-
#pull required data from source file
|
41
|
-
File.open(input_file, 'r') do |input|
|
42
|
-
tests = find_tests(input)
|
43
|
-
testfile_includes = find_includes(input)
|
44
|
-
used_mocks = find_mocks(testfile_includes)
|
45
|
-
end
|
46
|
-
|
47
|
-
#build runner file
|
48
|
-
generate(input_file, output_file, tests, used_mocks)
|
49
|
-
|
50
|
-
#determine which files were used to return them
|
51
|
-
all_files_used = [input_file, output_file]
|
52
|
-
all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?
|
53
|
-
all_files_used += @options[:includes] unless @options[:includes].empty?
|
54
|
-
return all_files_used.uniq
|
55
|
-
end
|
56
|
-
|
57
|
-
def generate(input_file, output_file, tests, used_mocks)
|
58
|
-
File.open(output_file, 'w') do |output|
|
59
|
-
create_header(output, used_mocks)
|
60
|
-
create_externs(output, tests, used_mocks)
|
61
|
-
create_mock_management(output, used_mocks)
|
62
|
-
create_suite_setup_and_teardown(output)
|
63
|
-
create_reset(output, used_mocks)
|
64
|
-
create_main(output, input_file, tests)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def find_tests(input_file)
|
69
|
-
tests_raw = []
|
70
|
-
tests_args = []
|
71
|
-
tests_and_line_numbers = []
|
72
|
-
|
73
|
-
input_file.rewind
|
74
|
-
source_raw = input_file.read
|
75
|
-
source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments
|
76
|
-
source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
|
77
|
-
lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
|
78
|
-
| (;|\{|\}) /x) # Match ;, {, and } as end of lines
|
79
|
-
|
80
|
-
lines.each_with_index do |line, index|
|
81
|
-
#find tests
|
82
|
-
if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/
|
83
|
-
arguments = $1
|
84
|
-
name = $2
|
85
|
-
call = $3
|
86
|
-
args = nil
|
87
|
-
if (@options[:use_param_tests] and !arguments.empty?)
|
88
|
-
args = []
|
89
|
-
arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]}
|
90
|
-
end
|
91
|
-
tests_and_line_numbers << { :test => name, :args => args, :call => call, :line_number => 0 }
|
92
|
-
tests_args = []
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
#determine line numbers and create tests to run
|
97
|
-
source_lines = source_raw.split("\n")
|
98
|
-
source_index = 0;
|
99
|
-
tests_and_line_numbers.size.times do |i|
|
100
|
-
source_lines[source_index..-1].each_with_index do |line, index|
|
101
|
-
if (line =~ /#{tests_and_line_numbers[i][:test]}/)
|
102
|
-
source_index += index
|
103
|
-
tests_and_line_numbers[i][:line_number] = source_index + 1
|
104
|
-
break
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
return tests_and_line_numbers
|
110
|
-
end
|
111
|
-
|
112
|
-
def find_includes(input_file)
|
113
|
-
input_file.rewind
|
114
|
-
|
115
|
-
#read in file
|
116
|
-
source = input_file.read
|
117
|
-
|
118
|
-
#remove comments (block and line, in three steps to ensure correct precedence)
|
119
|
-
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
120
|
-
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
121
|
-
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
122
|
-
|
123
|
-
#parse out includes
|
124
|
-
return source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten
|
125
|
-
end
|
126
|
-
|
127
|
-
def find_mocks(includes)
|
128
|
-
mock_headers = []
|
129
|
-
includes.each do |include_file|
|
130
|
-
mock_headers << File.basename(include_file) if (include_file =~ /^mock/i)
|
131
|
-
end
|
132
|
-
return mock_headers
|
133
|
-
end
|
134
|
-
|
135
|
-
def create_header(output, mocks)
|
136
|
-
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
137
|
-
create_runtest(output, mocks)
|
138
|
-
output.puts("\n//=======Automagically Detected Files To Include=====")
|
139
|
-
output.puts("#include \"#{@options[:framework].to_s}.h\"")
|
140
|
-
output.puts('#include "cmock.h"') unless (mocks.empty?)
|
141
|
-
@options[:includes].flatten.uniq.compact.each do |inc|
|
142
|
-
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
143
|
-
end
|
144
|
-
output.puts('#include <setjmp.h>')
|
145
|
-
output.puts('#include <stdio.h>')
|
146
|
-
output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception)
|
147
|
-
mocks.each do |mock|
|
148
|
-
output.puts("#include \"#{mock.gsub('.h','')}.h\"")
|
149
|
-
end
|
150
|
-
if @options[:enforce_strict_ordering]
|
151
|
-
output.puts('')
|
152
|
-
output.puts('int GlobalExpectCount;')
|
153
|
-
output.puts('int GlobalVerifyOrder;')
|
154
|
-
output.puts('char* GlobalOrderError;')
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
def create_externs(output, tests, mocks)
|
159
|
-
output.puts("\n//=======External Functions This Runner Calls=====")
|
160
|
-
output.puts("extern void setUp(void);")
|
161
|
-
output.puts("extern void tearDown(void);")
|
162
|
-
tests.each do |test|
|
163
|
-
output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
|
164
|
-
end
|
165
|
-
output.puts('')
|
166
|
-
end
|
167
|
-
|
168
|
-
def create_mock_management(output, mocks)
|
169
|
-
unless (mocks.empty?)
|
170
|
-
output.puts("\n//=======Mock Management=====")
|
171
|
-
output.puts("static void CMock_Init(void)")
|
172
|
-
output.puts("{")
|
173
|
-
if @options[:enforce_strict_ordering]
|
174
|
-
output.puts(" GlobalExpectCount = 0;")
|
175
|
-
output.puts(" GlobalVerifyOrder = 0;")
|
176
|
-
output.puts(" GlobalOrderError = NULL;")
|
177
|
-
end
|
178
|
-
mocks.each do |mock|
|
179
|
-
mock_clean = mock.gsub(/(?:-|\s+)/, "_")
|
180
|
-
output.puts(" #{mock_clean}_Init();")
|
181
|
-
end
|
182
|
-
output.puts("}\n")
|
183
|
-
|
184
|
-
output.puts("static void CMock_Verify(void)")
|
185
|
-
output.puts("{")
|
186
|
-
mocks.each do |mock|
|
187
|
-
mock_clean = mock.gsub(/(?:-|\s+)/, "_")
|
188
|
-
output.puts(" #{mock_clean}_Verify();")
|
189
|
-
end
|
190
|
-
output.puts("}\n")
|
191
|
-
|
192
|
-
output.puts("static void CMock_Destroy(void)")
|
193
|
-
output.puts("{")
|
194
|
-
mocks.each do |mock|
|
195
|
-
mock_clean = mock.gsub(/(?:-|\s+)/, "_")
|
196
|
-
output.puts(" #{mock_clean}_Destroy();")
|
197
|
-
end
|
198
|
-
output.puts("}\n")
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
def create_suite_setup_and_teardown(output)
|
203
|
-
unless (@options[:suite_setup].nil?)
|
204
|
-
output.puts("\n//=======Suite Setup=====")
|
205
|
-
output.puts("static int suite_setup(void)")
|
206
|
-
output.puts("{")
|
207
|
-
output.puts(@options[:suite_setup])
|
208
|
-
output.puts("}")
|
209
|
-
end
|
210
|
-
unless (@options[:suite_teardown].nil?)
|
211
|
-
output.puts("\n//=======Suite Teardown=====")
|
212
|
-
output.puts("static int suite_teardown(int num_failures)")
|
213
|
-
output.puts("{")
|
214
|
-
output.puts(@options[:suite_teardown])
|
215
|
-
output.puts("}")
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
def create_runtest(output, used_mocks)
|
220
|
-
cexception = @options[:plugins].include? :cexception
|
221
|
-
va_args1 = @options[:use_param_tests] ? ', ...' : ''
|
222
|
-
va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : ''
|
223
|
-
output.puts("\n//=======Test Runner Used To Run Each Test Below=====")
|
224
|
-
output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests]
|
225
|
-
output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\")
|
226
|
-
output.puts("{ \\")
|
227
|
-
output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
|
228
|
-
output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\")
|
229
|
-
output.puts(" Unity.NumberOfTests++; \\")
|
230
|
-
output.puts(" if (TEST_PROTECT()) \\")
|
231
|
-
output.puts(" { \\")
|
232
|
-
output.puts(" CEXCEPTION_T e; \\") if cexception
|
233
|
-
output.puts(" Try { \\") if cexception
|
234
|
-
output.puts(" CMock_Init(); \\") unless (used_mocks.empty?)
|
235
|
-
output.puts(" setUp(); \\")
|
236
|
-
output.puts(" TestFunc(#{va_args2}); \\")
|
237
|
-
output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?)
|
238
|
-
output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception
|
239
|
-
output.puts(" } \\")
|
240
|
-
output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?)
|
241
|
-
output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\")
|
242
|
-
output.puts(" { \\")
|
243
|
-
output.puts(" tearDown(); \\")
|
244
|
-
output.puts(" } \\")
|
245
|
-
output.puts(" UnityConcludeTest(); \\")
|
246
|
-
output.puts("}\n")
|
247
|
-
end
|
248
|
-
|
249
|
-
def create_reset(output, used_mocks)
|
250
|
-
output.puts("\n//=======Test Reset Option=====")
|
251
|
-
output.puts("void resetTest()")
|
252
|
-
output.puts("{")
|
253
|
-
output.puts(" CMock_Verify();") unless (used_mocks.empty?)
|
254
|
-
output.puts(" CMock_Destroy();") unless (used_mocks.empty?)
|
255
|
-
output.puts(" tearDown();")
|
256
|
-
output.puts(" CMock_Init();") unless (used_mocks.empty?)
|
257
|
-
output.puts(" setUp();")
|
258
|
-
output.puts("}")
|
259
|
-
end
|
260
|
-
|
261
|
-
def create_main(output, filename, tests)
|
262
|
-
output.puts("\n\n//=======MAIN=====")
|
263
|
-
output.puts("int main(void)")
|
264
|
-
output.puts("{")
|
265
|
-
output.puts(" suite_setup();") unless @options[:suite_setup].nil?
|
266
|
-
output.puts(" Unity.TestFile = \"#{filename}\";")
|
267
|
-
output.puts(" UnityBegin();")
|
268
|
-
if (@options[:use_param_tests])
|
269
|
-
tests.each do |test|
|
270
|
-
if ((test[:args].nil?) or (test[:args].empty?))
|
271
|
-
output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);")
|
272
|
-
else
|
273
|
-
test[:args].each {|args| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});")}
|
274
|
-
end
|
275
|
-
end
|
276
|
-
else
|
277
|
-
tests.each { |test| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]});") }
|
278
|
-
end
|
279
|
-
output.puts()
|
280
|
-
output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());")
|
281
|
-
output.puts("}")
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
285
|
-
|
286
|
-
if ($0 == __FILE__)
|
287
|
-
options = { :includes => [] }
|
288
|
-
yaml_file = nil
|
289
|
-
|
290
|
-
#parse out all the options first
|
291
|
-
ARGV.reject! do |arg|
|
292
|
-
case(arg)
|
293
|
-
when '-cexception'
|
294
|
-
options[:plugins] = [:cexception]; true
|
295
|
-
when /\.*\.yml/
|
296
|
-
options = UnityTestRunnerGenerator.grab_config(arg); true
|
297
|
-
else false
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
#make sure there is at least one parameter left (the input file)
|
302
|
-
if !ARGV[0]
|
303
|
-
puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)",
|
304
|
-
" blah.yml - will use config options in the yml file (see docs)",
|
305
|
-
" -cexception - include cexception support"].join("\n")
|
306
|
-
exit 1
|
307
|
-
end
|
308
|
-
|
309
|
-
#create the default test runner name if not specified
|
310
|
-
ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1])
|
311
|
-
|
312
|
-
#everything else is an include file
|
313
|
-
options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2)
|
314
|
-
|
315
|
-
UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
|
316
|
-
end
|
data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# ==========================================
|
2
|
-
# Unity Project - A Test Framework 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
|
-
require'yaml'
|
8
|
-
|
9
|
-
module RakefileHelpers
|
10
|
-
class TestFileFilter
|
11
|
-
def initialize(all_files = false)
|
12
|
-
@all_files = all_files
|
13
|
-
if not @all_files == true
|
14
|
-
if File.exist?('test_file_filter.yml')
|
15
|
-
filters = YAML.load_file( 'test_file_filter.yml' )
|
16
|
-
@all_files, @only_files, @exclude_files =
|
17
|
-
filters[:all_files], filters[:only_files], filters[:exclude_files]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
attr_accessor :all_files, :only_files, :exclude_files
|
22
|
-
end
|
23
|
-
end
|
data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
# ==========================================
|
2
|
-
# Unity Project - A Test Framework 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
|
-
#!/usr/bin/ruby
|
8
|
-
#
|
9
|
-
# unity_test_summary.rb
|
10
|
-
#
|
11
|
-
require 'fileutils'
|
12
|
-
require 'set'
|
13
|
-
|
14
|
-
class UnityTestSummary
|
15
|
-
include FileUtils::Verbose
|
16
|
-
|
17
|
-
attr_reader :report, :total_tests, :failures, :ignored
|
18
|
-
|
19
|
-
def initialize
|
20
|
-
@report = ''
|
21
|
-
@total_tests = 0
|
22
|
-
@failures = 0
|
23
|
-
@ignored = 0
|
24
|
-
end
|
25
|
-
|
26
|
-
def run
|
27
|
-
# Clean up result file names
|
28
|
-
results = @targets.map {|target| target.gsub(/\\/,'/')}
|
29
|
-
|
30
|
-
# Dig through each result file, looking for details on pass/fail:
|
31
|
-
failure_output = []
|
32
|
-
ignore_output = []
|
33
|
-
|
34
|
-
results.each do |result_file|
|
35
|
-
lines = File.readlines(result_file).map { |line| line.chomp }
|
36
|
-
if lines.length == 0
|
37
|
-
raise "Empty test result file: #{result_file}"
|
38
|
-
else
|
39
|
-
output = get_details(result_file, lines)
|
40
|
-
failure_output << output[:failures] unless output[:failures].empty?
|
41
|
-
ignore_output << output[:ignores] unless output[:ignores].empty?
|
42
|
-
tests,failures,ignored = parse_test_summary(lines)
|
43
|
-
@total_tests += tests
|
44
|
-
@failures += failures
|
45
|
-
@ignored += ignored
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
if @ignored > 0
|
50
|
-
@report += "\n"
|
51
|
-
@report += "--------------------------\n"
|
52
|
-
@report += "UNITY IGNORED TEST SUMMARY\n"
|
53
|
-
@report += "--------------------------\n"
|
54
|
-
@report += ignore_output.flatten.join("\n")
|
55
|
-
end
|
56
|
-
|
57
|
-
if @failures > 0
|
58
|
-
@report += "\n"
|
59
|
-
@report += "--------------------------\n"
|
60
|
-
@report += "UNITY FAILED TEST SUMMARY\n"
|
61
|
-
@report += "--------------------------\n"
|
62
|
-
@report += failure_output.flatten.join("\n")
|
63
|
-
end
|
64
|
-
|
65
|
-
@report += "\n"
|
66
|
-
@report += "--------------------------\n"
|
67
|
-
@report += "OVERALL UNITY TEST SUMMARY\n"
|
68
|
-
@report += "--------------------------\n"
|
69
|
-
@report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n"
|
70
|
-
@report += "\n"
|
71
|
-
end
|
72
|
-
|
73
|
-
def set_targets(target_array)
|
74
|
-
@targets = target_array
|
75
|
-
end
|
76
|
-
|
77
|
-
def set_root_path(path)
|
78
|
-
@root = path
|
79
|
-
end
|
80
|
-
|
81
|
-
def usage(err_msg=nil)
|
82
|
-
puts "\nERROR: "
|
83
|
-
puts err_msg if err_msg
|
84
|
-
puts "\nUsage: unity_test_summary.rb result_file_directory/ root_path/"
|
85
|
-
puts " result_file_directory - The location of your results files."
|
86
|
-
puts " Defaults to current directory if not specified."
|
87
|
-
puts " Should end in / if specified."
|
88
|
-
puts " root_path - Helpful for producing more verbose output if using relative paths."
|
89
|
-
exit 1
|
90
|
-
end
|
91
|
-
|
92
|
-
protected
|
93
|
-
|
94
|
-
def get_details(result_file, lines)
|
95
|
-
results = { :failures => [], :ignores => [], :successes => [] }
|
96
|
-
lines.each do |line|
|
97
|
-
src_file,src_line,test_name,status,msg = line.split(/:/)
|
98
|
-
line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\")
|
99
|
-
case(status)
|
100
|
-
when 'IGNORE' then results[:ignores] << line_out
|
101
|
-
when 'FAIL' then results[:failures] << line_out
|
102
|
-
when 'PASS' then results[:successes] << line_out
|
103
|
-
end
|
104
|
-
end
|
105
|
-
return results
|
106
|
-
end
|
107
|
-
|
108
|
-
def parse_test_summary(summary)
|
109
|
-
if summary.find { |v| v =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ }
|
110
|
-
[$1.to_i,$2.to_i,$3.to_i]
|
111
|
-
else
|
112
|
-
raise "Couldn't parse test results: #{summary}"
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def here; File.expand_path(File.dirname(__FILE__)); end
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
if $0 == __FILE__
|
121
|
-
uts = UnityTestSummary.new
|
122
|
-
begin
|
123
|
-
#look in the specified or current directory for result files
|
124
|
-
ARGV[0] ||= './'
|
125
|
-
targets = "#{ARGV[0].gsub(/\\/, '/')}*.test*"
|
126
|
-
results = Dir[targets]
|
127
|
-
raise "No *.testpass or *.testfail files found in '#{targets}'" if results.empty?
|
128
|
-
uts.set_targets(results)
|
129
|
-
|
130
|
-
#set the root path
|
131
|
-
ARGV[1] ||= File.expand_path(File.dirname(__FILE__)) + '/'
|
132
|
-
uts.set_root_path(ARGV[1])
|
133
|
-
|
134
|
-
#run the summarizer
|
135
|
-
puts uts.run
|
136
|
-
rescue Exception => e
|
137
|
-
uts.usage e.message
|
138
|
-
end
|
139
|
-
end
|