update ssz test format and fix uint sizes

This commit is contained in:
protolambda 2019-04-12 23:02:36 +10:00
parent 88d076b615
commit b6c45b9dc1
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
3 changed files with 10 additions and 13 deletions

View File

@ -5,22 +5,19 @@ SSZ supports encoding of uints up to 32 bytes. These are considered to be basic
## Test case format
```yaml
TODO: old format
# type: "uintN" -- string, where N is one of [8, 16, 32, 64, 128, 256]
# valid: bool -- expected validity of the input data
# ssz: bytes -- string, input data, hex encoded, with prefix 0x
# tags: List[string] -- description of test case, in the form of a list of labels
type: "uintN" -- string, where N is one of [8, 16, 32, 64, 128, 256]
valid: bool -- expected validity of the input data
value: string -- string, decimal encoding, to support up to 256 bit integers
ssz: bytes -- string, input data, hex encoded, with prefix 0x
tags: List[string] -- description of test case, in the form of a list of labels
```
## Condition
- Encoding: After encoding the given input number, the
- Decoding: After decoding the given `output` bytes, it should match the `input` number
Two-way testing can be implemented in the test-runner:
- Encoding: After encoding the given input number `value`, the output should match `ssz`
- Decoding: After decoding the given `ssz` bytes, it should match the input number `value`
## Forks
Forks-interpretation: `collective`
```
```

View File

@ -39,4 +39,4 @@ def ssz_uint_bounds_suite(configs_path: str) -> gen_typing.TestSuiteOutput:
if __name__ == "__main__":
gen_runner.run_generator("ssz", [ssz_random_uint_suite, ssz_wrong_uint_suite, ssz_uint_bounds_suite])
gen_runner.run_generator("ssz", [ssz_random_uint_suite, ssz_wrong_uint_suite, ssz_uint_bounds_suite])

View File

@ -15,7 +15,7 @@ from renderers import (
random.seed(0)
BIT_SIZES = [i for i in range(8, 512 + 1, 8)]
BIT_SIZES = [8, 16, 32, 64, 128, 256]
RANDOM_TEST_CASES_PER_BIT_SIZE = 10
RANDOM_TEST_CASES_PER_LENGTH = 3