2019-04-10 14:20:59 +00:00
|
|
|
from uint_test_cases import (
|
|
|
|
generate_random_uint_test_cases,
|
|
|
|
generate_uint_wrong_length_test_cases,
|
|
|
|
generate_uint_bounds_test_cases,
|
|
|
|
generate_uint_out_of_bounds_test_cases
|
2019-03-27 16:32:13 +00:00
|
|
|
)
|
|
|
|
|
2019-04-10 14:20:59 +00:00
|
|
|
from gen_base import gen_runner, gen_suite, gen_typing
|
|
|
|
|
|
|
|
def ssz_random_uint_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
|
2019-04-12 12:48:59 +00:00
|
|
|
return ("uint_random", "uint", gen_suite.render_suite(
|
2019-04-10 14:20:59 +00:00
|
|
|
title="UInt Random",
|
|
|
|
summary="Random integers chosen uniformly over the allowed value range",
|
|
|
|
forks_timeline= "mainnet",
|
|
|
|
forks=["phase0"],
|
|
|
|
config="mainnet",
|
2019-04-14 10:17:22 +00:00
|
|
|
runner="ssz",
|
|
|
|
handler="uint",
|
2019-04-10 14:20:59 +00:00
|
|
|
test_cases=generate_random_uint_test_cases()))
|
|
|
|
|
2019-04-15 13:31:10 +00:00
|
|
|
|
2019-04-10 14:20:59 +00:00
|
|
|
def ssz_wrong_uint_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
|
2019-04-12 12:48:59 +00:00
|
|
|
return ("uint_wrong_length", "uint", gen_suite.render_suite(
|
2019-04-10 14:20:59 +00:00
|
|
|
title="UInt Wrong Length",
|
|
|
|
summary="Serialized integers that are too short or too long",
|
|
|
|
forks_timeline= "mainnet",
|
|
|
|
forks=["phase0"],
|
|
|
|
config="mainnet",
|
2019-04-14 10:17:22 +00:00
|
|
|
runner="ssz",
|
|
|
|
handler="uint",
|
2019-04-10 14:20:59 +00:00
|
|
|
test_cases=generate_uint_wrong_length_test_cases()))
|
|
|
|
|
2019-04-15 13:33:05 +00:00
|
|
|
|
2019-04-10 14:20:59 +00:00
|
|
|
def ssz_uint_bounds_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
|
2019-04-12 12:48:59 +00:00
|
|
|
return ("uint_bounds", "uint", gen_suite.render_suite(
|
2019-04-10 14:20:59 +00:00
|
|
|
title="UInt Bounds",
|
|
|
|
summary="Integers right at or beyond the bounds of the allowed value range",
|
|
|
|
forks_timeline= "mainnet",
|
|
|
|
forks=["phase0"],
|
|
|
|
config="mainnet",
|
2019-04-14 10:17:22 +00:00
|
|
|
runner="ssz",
|
|
|
|
handler="uint",
|
2019-04-10 14:20:59 +00:00
|
|
|
test_cases=generate_uint_bounds_test_cases() + generate_uint_out_of_bounds_test_cases()))
|
2019-03-27 16:32:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2019-04-12 13:02:36 +00:00
|
|
|
gen_runner.run_generator("ssz", [ssz_random_uint_suite, ssz_wrong_uint_suite, ssz_uint_bounds_suite])
|