mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-27 06:42:02 +00:00
crypto/tests: parametrize test_bn_format
This commit is contained in:
parent
f382f77c89
commit
015c294857
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import ctypes
|
import ctypes
|
||||||
|
import itertools
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
from ctypes import (
|
from ctypes import (
|
||||||
@ -1016,13 +1017,16 @@ def test_bn_divmod10(r):
|
|||||||
assert_bn_divmod10(x)
|
assert_bn_divmod10(x)
|
||||||
|
|
||||||
|
|
||||||
def test_bn_format():
|
@pytest.mark.parametrize(
|
||||||
for decimals in range(0, 5):
|
"decimals,exponent,trailing,prefix,suffix,value",
|
||||||
for exponent in range(-5, 5):
|
itertools.product(
|
||||||
for trailing in [True, False]:
|
range(0, 5),
|
||||||
for prefix in ["", "prefix"]:
|
range(-5, 5),
|
||||||
for suffix in ["", "suffix"]:
|
[True, False],
|
||||||
for value in [123, 120]:
|
["", "prefix"],
|
||||||
assert_bn_format(
|
["", "suffix"],
|
||||||
value, prefix, suffix, decimals, exponent, trailing
|
[123, 120],
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
def test_bn_format(decimals, exponent, trailing, prefix, suffix, value):
|
||||||
|
assert_bn_format(value, prefix, suffix, decimals, exponent, trailing)
|
||||||
|
Loading…
Reference in New Issue
Block a user