From 8507470dc0355ae802ac70dc41efa55769f1e90c Mon Sep 17 00:00:00 2001 From: Rot127 Date: Sun, 1 Sep 2024 06:06:47 -0500 Subject: [PATCH] Use XOR for number comparison. For reason I do not want to debug, comparing after AND gives different results on Windows and Unix. --- .../python/cstest_py/src/cstest_py/compare.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bindings/python/cstest_py/src/cstest_py/compare.py b/bindings/python/cstest_py/src/cstest_py/compare.py index 6200463e34..d71f8c6a2b 100644 --- a/bindings/python/cstest_py/src/cstest_py/compare.py +++ b/bindings/python/cstest_py/src/cstest_py/compare.py @@ -174,7 +174,7 @@ def compare_uint8(actual: int, expected: None | int, msg: str) -> bool: actual = actual & 0xFF expected = expected & 0xFF - if actual != expected: + if actual ^ expected != 0: log.error(f"{msg}: {actual} != {expected}") return False return True @@ -187,7 +187,7 @@ def compare_int8(actual: int, expected: None | int, msg: str) -> bool: actual = actual & 0xFF expected = expected & 0xFF - if actual != expected: + if actual ^ expected != 0: log.error(f"{msg}: {actual} != {expected}") return False return True @@ -200,7 +200,7 @@ def compare_uint16(actual: int, expected: None | int, msg: str) -> bool: actual = actual & 0xFFFF expected = expected & 0xFFFF - if actual != expected: + if actual ^ expected != 0: log.error(f"{msg}: {actual} != {expected}") return False return True @@ -213,7 +213,7 @@ def compare_int16(actual: int, expected: None | int, msg: str) -> bool: actual = actual & 0xFFFF expected = expected & 0xFFFF - if actual != expected: + if actual ^ expected != 0: log.error(f"{msg}: {actual} != {expected}") return False return True @@ -226,7 +226,7 @@ def compare_uint32(actual: int, expected: None | int, msg: str) -> bool: actual = actual & 0xFFFFFFFF expected = expected & 0xFFFFFFFF - if actual != expected: + if actual ^ expected != 0: log.error(f"{msg}: {actual} != {expected}") return False return True @@ -239,7 +239,7 @@ def compare_int32(actual: int, expected: None | int, msg: str) -> bool: actual = actual & 0xFFFFFFFF expected = expected & 0xFFFFFFFF - if actual != expected: + if actual ^ expected != 0: log.error(f"{msg}: {actual} != {expected}") return False return True @@ -252,7 +252,7 @@ def compare_uint64(actual: int, expected: None | int, msg: str) -> bool: actual = actual & 0xFFFFFFFFFFFFFFFF expected = expected & 0xFFFFFFFFFFFFFFFF - if actual != expected: + if actual ^ expected != 0: log.error(f"{msg}: {actual} != {expected}") return False return True @@ -265,7 +265,7 @@ def compare_int64(actual: int, expected: None | int, msg: str) -> bool: actual = actual & 0xFFFFFFFFFFFFFFFF expected = expected & 0xFFFFFFFFFFFFFFFF - if actual != expected: + if actual ^ expected != 0: log.error(f"{msg}: {actual} != {expected}") return False return True