Files
concrete/compiler/tests/python/test_hlfhe_dialect.py
2021-10-12 16:57:18 +02:00

21 lines
620 B
Python

import pytest
from mlir.ir import Context
from zamalang import register_dialects
from zamalang.dialects import hlfhe
@pytest.mark.parametrize("width", list(range(1, 8)))
def test_eint(width):
ctx = Context()
register_dialects(ctx)
eint = hlfhe.EncryptedIntegerType.get(ctx, width)
assert eint.__str__() == f"!HLFHE.eint<{width}>"
@pytest.mark.parametrize("width", [0, 8, 10, 12])
def test_invalid_eint(width):
ctx = Context()
register_dialects(ctx)
with pytest.raises(ValueError, match=r"can't create eint with the given width"):
eint = hlfhe.EncryptedIntegerType.get(ctx, width)