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
|
||||
import ctypes
|
||||
import itertools
|
||||
import os
|
||||
import random
|
||||
from ctypes import (
|
||||
@ -1016,13 +1017,16 @@ def test_bn_divmod10(r):
|
||||
assert_bn_divmod10(x)
|
||||
|
||||
|
||||
def test_bn_format():
|
||||
for decimals in range(0, 5):
|
||||
for exponent in range(-5, 5):
|
||||
for trailing in [True, False]:
|
||||
for prefix in ["", "prefix"]:
|
||||
for suffix in ["", "suffix"]:
|
||||
for value in [123, 120]:
|
||||
assert_bn_format(
|
||||
value, prefix, suffix, decimals, exponent, trailing
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"decimals,exponent,trailing,prefix,suffix,value",
|
||||
itertools.product(
|
||||
range(0, 5),
|
||||
range(-5, 5),
|
||||
[True, False],
|
||||
["", "prefix"],
|
||||
["", "suffix"],
|
||||
[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