Johan B.W. de Vries 521171540b Properly implemented test_crc32
Also extended the hack around u8 to u32 cast used
in crc32 - its type was lost, so it would just cast
to whatever the environment was expecting.

Had to do_format_check=False since the file has
some comments and such.
2025-04-05 16:41:46 +02:00

20 lines
546 B
Python

import pytest
from ..helpers import Suite
@pytest.mark.slow_integration_test
def test_crc32():
with open('examples/crc32.py', 'r', encoding='ASCII') as fil:
code_py = "\n" + fil.read()
# https://reveng.sourceforge.io/crc-catalogue/legend.htm#crc.legend.params
in_put = b'123456789'
# https://reveng.sourceforge.io/crc-catalogue/17plus.htm#crc.cat.crc-32-iso-hdlc
check = 0xcbf43926
result = Suite(code_py).run_code(in_put, func_name='crc32', do_format_check=False)
assert check == result.returned_value