Merge pull request #8018 from AgathiyanB/add-overflow-test-inputs-bignum
[Bignum] Add overflow test inputs for add and add if
This commit is contained in:
commit
2588f8d36d
2 changed files with 26 additions and 0 deletions
|
@ -21,6 +21,7 @@ from typing import Dict, Iterator, List, Tuple
|
|||
from . import test_case
|
||||
from . import test_data_generation
|
||||
from . import bignum_common
|
||||
from .bignum_data import ADD_SUB_DATA
|
||||
|
||||
class BignumCoreTarget(test_data_generation.BaseTarget):
|
||||
#pylint: disable=abstract-method, too-few-public-methods
|
||||
|
@ -176,6 +177,7 @@ class BignumCoreAddAndAddIf(BignumCoreTarget, bignum_common.OperationCommon):
|
|||
test_function = "mpi_core_add_and_add_if"
|
||||
test_name = "mpi_core_add_and_add_if"
|
||||
input_style = "arch_split"
|
||||
input_values = ADD_SUB_DATA
|
||||
unique_combinations_only = True
|
||||
|
||||
def result(self) -> List[str]:
|
||||
|
@ -196,6 +198,7 @@ class BignumCoreSub(BignumCoreTarget, bignum_common.OperationCommon):
|
|||
symbol = "-"
|
||||
test_function = "mpi_core_sub"
|
||||
test_name = "mbedtls_mpi_core_sub"
|
||||
input_values = ADD_SUB_DATA
|
||||
|
||||
def result(self) -> List[str]:
|
||||
if self.int_a >= self.int_b:
|
||||
|
|
|
@ -106,6 +106,29 @@ INPUTS_DEFAULT = [
|
|||
RANDOM_1024_BIT_SEED_4_NO2, # largest (not a prime)
|
||||
]
|
||||
|
||||
ADD_SUB_DATA = [
|
||||
"0", "1", "3", "f", "fe", "ff", "100", "ff00",
|
||||
"fffe", "ffff", "10000", # 2^16 - 1, 2^16, 2^16 + 1
|
||||
"fffffffe", "ffffffff", "100000000", # 2^32 - 1, 2^32, 2^32 + 1
|
||||
"1f7f7f7f7f7f7f",
|
||||
"8000000000000000", "fefefefefefefefe",
|
||||
"fffffffffffffffe", "ffffffffffffffff", "10000000000000000", # 2^64 - 1, 2^64, 2^64 + 1
|
||||
"1234567890abcdef0",
|
||||
"fffffffffffffffffffffffe",
|
||||
"ffffffffffffffffffffffff",
|
||||
"1000000000000000000000000",
|
||||
"fffffffffffffffffefefefefefefefe",
|
||||
"fffffffffffffffffffffffffffffffe",
|
||||
"ffffffffffffffffffffffffffffffff",
|
||||
"100000000000000000000000000000000",
|
||||
"1234567890abcdef01234567890abcdef0",
|
||||
"fffffffffffffffffffffffffffffffffffffffffffffffffefefefefefefefe",
|
||||
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe",
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"10000000000000000000000000000000000000000000000000000000000000000",
|
||||
"1234567890abcdef01234567890abcdef01234567890abcdef01234567890abcdef0",
|
||||
]
|
||||
|
||||
# Only odd moduli are present as in the new bignum code only odd moduli are
|
||||
# supported for now.
|
||||
MODULI_DEFAULT = [
|
||||
|
|
Loading…
Reference in a new issue