MCPcopy Create free account
hub / github.com/ElementsProject/elements / gen_valid_vectors

Function gen_valid_vectors

contrib/testgen/gen_key_io_test_vectors.py:155–165  ·  view source on GitHub ↗

Generate valid test vectors

()

Source from the content-addressed store, hash-verified

153 return rv, dst_prefix + witprog
154
155def gen_valid_vectors():
156 '''Generate valid test vectors'''
157 glist = [gen_valid_base58_vector, gen_valid_bech32_vector]
158 tlist = [templates, bech32_templates]
159 while True:
160 for template, valid_vector_generator in [(t, g) for g, l in zip(glist, tlist) for t in l]:
161 rv, payload = valid_vector_generator(template)
162 assert is_valid(rv)
163 metadata = {x: y for x, y in zip(metadata_keys,template[3]) if y is not None}
164 hexrepr = payload.hex()
165 yield (rv, hexrepr, metadata)
166
167def gen_invalid_base58_vector(template):
168 '''Generate possibly invalid vector'''

Callers

nothing calls this directly

Calls 2

is_validFunction · 0.85
hexMethod · 0.80

Tested by

no test coverage detected