Skip to content

Commit

Permalink
fix(frontend-python): correct operator precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
aPere3 committed Nov 19, 2024
1 parent bb423df commit 9055669
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions frontends/concrete-python/tests/compilation/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def test_print(helpers):
class Module:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

inputset = list(range(20))
module = Module.compile(
Expand All @@ -369,11 +369,11 @@ def test_encrypted_execution():
class Module:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

@fhe.function({"x": "encrypted"})
def dec(x):
return x - 1 % 20
return (x - 1) % 20

inputset = [np.random.randint(1, 20, size=()) for _ in range(100)]
module = Module.compile(
Expand Down Expand Up @@ -407,11 +407,11 @@ def test_key_set():
class Module:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

@fhe.function({"x": "encrypted"})
def dec(x):
return x - 1 % 20
return (x - 1) % 20

inputset = [np.random.randint(1, 20, size=()) for _ in range(100)]
module = Module.compile(
Expand Down Expand Up @@ -596,11 +596,11 @@ def test_simulate_encrypt_run_decrypt(helpers):
class Module:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

@fhe.function({"x": "encrypted"})
def dec(x):
return x - 1 % 20
return (x - 1) % 20

inputset = [np.random.randint(1, 20, size=()) for _ in range(100)]
module = Module.compile(
Expand Down Expand Up @@ -808,7 +808,7 @@ def test_lazy_simulation_execution(helpers):
class Module1:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

module = Module1.compile(
{"inc": [np.random.randint(1, 20, size=()) for _ in range(100)]},
Expand All @@ -829,7 +829,7 @@ def inc(x):
class Module2:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

module = Module2.compile(
{"inc": [np.random.randint(1, 20, size=()) for _ in range(100)]},
Expand All @@ -848,7 +848,7 @@ def inc(x):
class Module3:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

module = Module3.compile(
{"inc": [np.random.randint(1, 20, size=()) for _ in range(100)]},
Expand All @@ -867,7 +867,7 @@ def inc(x):
class Module4:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

module = Module4.compile(
{"inc": [np.random.randint(1, 20, size=()) for _ in range(100)]},
Expand Down

0 comments on commit 9055669

Please sign in to comment.