MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / choose_random_tests

Function choose_random_tests

test/runner.py:259–276  ·  view source on GitHub ↗
(base, num_tests, relevant_modes)

Source from the content-addressed store, hash-verified

257
258
259def choose_random_tests(base, num_tests, relevant_modes):
260 tests = [t for t in dir(base) if t.startswith('test_')]
261 print()
262 chosen = set()
263 while len(chosen) < num_tests:
264 test = random.choice(tests)
265 mode = random.choice(relevant_modes)
266 new_test = mode + '.' + test
267 before = len(chosen)
268 chosen.add(new_test)
269 if len(chosen) > before:
270 print('* ' + new_test)
271 else:
272 # we may have hit the limit
273 if len(chosen) == len(tests) * len(relevant_modes):
274 print('(all possible tests chosen! %d = %d*%d)' % (len(chosen), len(tests), len(relevant_modes)))
275 break
276 return list(chosen)
277
278
279def print_random_test_statistics(num_tests):

Callers 1

args_for_random_testsFunction · 0.85

Calls 3

setFunction · 0.70
printFunction · 0.50
addMethod · 0.45

Tested by

no test coverage detected