From e94a9f493b208b83982ff2378272879e74829f4f Mon Sep 17 00:00:00 2001 From: Torin Carey Date: Sat, 4 Apr 2020 22:30:59 +0100 Subject: Replace floating point arithmetic with integer arithmetic (#5181) --- tests/utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/utils.py') diff --git a/tests/utils.py b/tests/utils.py index ca3245b0..7e79830b 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -7,7 +7,6 @@ from __future__ import absolute_import, division, print_function import binascii import collections import json -import math import os import re from contextlib import contextmanager @@ -744,15 +743,15 @@ def load_x963_vectors(vector_data): vector["key_data_length"] = key_data_len elif line.startswith("Z"): vector["Z"] = line.split("=")[1].strip() - assert math.ceil(shared_secret_len / 8) * 2 == len(vector["Z"]) + assert ((shared_secret_len + 7) // 8) * 2 == len(vector["Z"]) elif line.startswith("SharedInfo"): if shared_info_len != 0: vector["sharedinfo"] = line.split("=")[1].strip() silen = len(vector["sharedinfo"]) - assert math.ceil(shared_info_len / 8) * 2 == silen + assert ((shared_info_len + 7) // 8) * 2 == silen elif line.startswith("key_data"): vector["key_data"] = line.split("=")[1].strip() - assert math.ceil(key_data_len / 8) * 2 == len(vector["key_data"]) + assert ((key_data_len + 7) // 8) * 2 == len(vector["key_data"]) vectors.append(vector) vector = {} -- cgit v1.2.3