Bignum tests: make n an attribute
Having int_ variants as an attribute has the advantage of the input being validated when the object is instantiated. In theory otherwise if a particular int_ attribute is not accessed, then the invalid argument is passed to the tests as it is. (This would in all likelihood detected by the actual test cases, still, it is more robust like this.) There are no semantic changes to the generated test cases. (The order of appearance of 64 and 32 bit mpi_core_add_and_add_if test cases has changed.) Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
4c59d35e00
commit
abfca8f938
1 changed files with 5 additions and 4 deletions
|
@ -97,6 +97,8 @@ class OperationCommon(test_data_generation.BaseTest):
|
|||
def __init__(self, val_a: str, val_b: str, bits_in_limb: int = 64) -> None:
|
||||
self.val_a = val_a
|
||||
self.val_b = val_b
|
||||
# Setting the int versions here as opposed to making them @properties
|
||||
# provides earlier/more robust input validation.
|
||||
self.int_a = hex_to_int(val_a)
|
||||
self.int_b = hex_to_int(val_b)
|
||||
if bits_in_limb not in self.limb_sizes:
|
||||
|
@ -207,10 +209,9 @@ class ModOperationCommon(OperationCommon):
|
|||
bits_in_limb: int = 64) -> None:
|
||||
super().__init__(val_a=val_a, val_b=val_b, bits_in_limb=bits_in_limb)
|
||||
self.val_n = val_n
|
||||
|
||||
@property
|
||||
def int_n(self) -> int:
|
||||
return hex_to_int(self.val_n)
|
||||
# Setting the int versions here as opposed to making them @properties
|
||||
# provides earlier/more robust input validation.
|
||||
self.int_n = hex_to_int(val_n)
|
||||
|
||||
@property
|
||||
def boundary(self) -> int:
|
||||
|
|
Loading…
Reference in a new issue