mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-26 01:05:15 +00:00
🐛 split variation with and without chaos
This commit is contained in:
parent
01dfc77202
commit
6231dc2e4e
@ -68,10 +68,24 @@ def valid_cases():
|
|||||||
for (name, (typ, offsets)) in PRESET_CONTAINERS.items():
|
for (name, (typ, offsets)) in PRESET_CONTAINERS.items():
|
||||||
for mode in [RandomizationMode.mode_zero, RandomizationMode.mode_max]:
|
for mode in [RandomizationMode.mode_zero, RandomizationMode.mode_max]:
|
||||||
yield f'{name}_{mode.to_name()}', valid_test_case(lambda: container_case_fn(rng, mode, typ))
|
yield f'{name}_{mode.to_name()}', valid_test_case(lambda: container_case_fn(rng, mode, typ))
|
||||||
|
|
||||||
|
modes = [RandomizationMode.mode_random, RandomizationMode.mode_zero, RandomizationMode.mode_max]
|
||||||
|
if len(offsets) != 0:
|
||||||
|
modes.extend([RandomizationMode.mode_nil_count,
|
||||||
|
RandomizationMode.mode_one_count,
|
||||||
|
RandomizationMode.mode_max_count])
|
||||||
|
for mode in modes:
|
||||||
|
for variation in range(3):
|
||||||
|
yield f'{name}_{mode.to_name()}_chaos_{variation}', \
|
||||||
|
valid_test_case(lambda: container_case_fn(rng, mode, typ, chaos=True))
|
||||||
|
# Notes: Below is the second wave of iteration, and only the random mode is selected
|
||||||
|
# for container without offset since ``RandomizationMode.mode_zero`` and ``RandomizationMode.mode_max``
|
||||||
|
# are deterministic.
|
||||||
modes = [RandomizationMode.mode_random]
|
modes = [RandomizationMode.mode_random]
|
||||||
if len(offsets) != 0:
|
if len(offsets) != 0:
|
||||||
# Notes: ``RandomizationMode.mode_zero`` and ``RandomizationMode.mode_max`` are
|
# Notes: ``RandomizationMode.mode_zero`` and ``RandomizationMode.mode_max`` are
|
||||||
# pseudo-random modes here because the length of List and Bitlist are randoms.
|
# pseudo-random modes for containers that contains List of Bitlist
|
||||||
|
# (because the length of List and Bitlist are randoms).
|
||||||
modes.extend([RandomizationMode.mode_nil_count,
|
modes.extend([RandomizationMode.mode_nil_count,
|
||||||
RandomizationMode.mode_one_count,
|
RandomizationMode.mode_one_count,
|
||||||
RandomizationMode.mode_max_count,
|
RandomizationMode.mode_max_count,
|
||||||
@ -81,9 +95,6 @@ def valid_cases():
|
|||||||
for variation in range(10):
|
for variation in range(10):
|
||||||
yield f'{name}_{mode.to_name()}_{variation}', \
|
yield f'{name}_{mode.to_name()}_{variation}', \
|
||||||
valid_test_case(lambda: container_case_fn(rng, mode, typ))
|
valid_test_case(lambda: container_case_fn(rng, mode, typ))
|
||||||
for variation in range(3):
|
|
||||||
yield f'{name}_{mode.to_name()}_chaos_{variation}', \
|
|
||||||
valid_test_case(lambda: container_case_fn(rng, mode, typ, chaos=True))
|
|
||||||
|
|
||||||
|
|
||||||
def mod_offset(b: bytes, offset_index: int, change: Callable[[int], int]):
|
def mod_offset(b: bytes, offset_index: int, change: Callable[[int], int]):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user