mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 12:15:09 -05:00
21 lines
620 B
Python
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)
|