@@ -47,7 +47,7 @@ def test_op(kerngen_path, gen_op_data):
47
47
def test_missing_context (kerngen_path ):
48
48
"""Test kerngen raises an exception when context is not the first line of
49
49
input"""
50
- input_string = "ADD a b c\n CONTEXT BGV 16384 4\n "
50
+ input_string = "ADD a b c\n CONTEXT BGV 16384 4 3 \n "
51
51
result = execute_process (
52
52
[kerngen_path ],
53
53
data_in = input_string ,
@@ -59,7 +59,7 @@ def test_missing_context(kerngen_path):
59
59
60
60
def test_multiple_contexts (kerngen_path ):
61
61
"""Test kerngen raises an exception when more than one context is given"""
62
- input_string = "CONTEXT BGV 16384 4\n Data a 2\n CONTEXT BGV 16384 4\n "
62
+ input_string = "CONTEXT BGV 16384 4 2 \n Data a 2\n CONTEXT BGV 16384 4 2 \n "
63
63
result = execute_process (
64
64
[kerngen_path ],
65
65
data_in = input_string ,
@@ -71,22 +71,22 @@ def test_multiple_contexts(kerngen_path):
71
71
72
72
def test_context_options_without_key (kerngen_path ):
73
73
"""Test kerngen raises an exception when more than one context is given"""
74
- input_string = "CONTEXT BGV 16384 4 1\n Data a 2\n "
74
+ input_string = "CONTEXT BGV 16384 3 2 1\n Data a 2\n "
75
75
result = execute_process (
76
76
[kerngen_path ],
77
77
data_in = input_string ,
78
78
)
79
79
assert not result .stdout
80
80
assert (
81
- "ValueError: Options must be key/value pairs (e.g. krns_delta=1, num_digits=3): '1'"
81
+ "ValueError: Options must be key/value pairs (e.g. num_digits=3): '1'"
82
82
in result .stderr
83
83
)
84
84
assert result .returncode != 0
85
85
86
86
87
87
def test_context_unsupported_options_variable (kerngen_path ):
88
88
"""Test kerngen raises an exception when more than one context is given"""
89
- input_string = "CONTEXT BGV 16384 4 test=3\n Data a 2\n "
89
+ input_string = "CONTEXT BGV 16384 3 2 test=3\n Data a 2\n "
90
90
result = execute_process (
91
91
[kerngen_path ],
92
92
data_in = input_string ,
@@ -99,14 +99,14 @@ def test_context_unsupported_options_variable(kerngen_path):
99
99
@pytest .mark .parametrize ("invalid" , [- 1 , 256 , 0.1 , "str" ])
100
100
def test_context_option_invalid_values (kerngen_path , invalid ):
101
101
"""Test kerngen raises an exception if value is out of range for correct key"""
102
- input_string = f"CONTEXT BGV 16384 4 krns_delta ={ invalid } \n Data a 2\n "
102
+ input_string = f"CONTEXT BGV 16384 3 2 num_digits ={ invalid } \n Data a 2\n "
103
103
result = execute_process (
104
104
[kerngen_path ],
105
105
data_in = input_string ,
106
106
)
107
107
assert not result .stdout
108
108
assert (
109
- f"ValueError: Options must be key/value pairs (e.g. krns_delta=1, num_digits=3): 'krns_delta ={ invalid } '"
109
+ f"ValueError: Options must be key/value pairs (e.g. num_digits=3): 'num_digits ={ invalid } '"
110
110
in result .stderr
111
111
)
112
112
assert result .returncode != 0
@@ -115,7 +115,7 @@ def test_context_option_invalid_values(kerngen_path, invalid):
115
115
def test_unrecognised_opname (kerngen_path ):
116
116
"""Test kerngen raises an exception when receiving an unrecognised
117
117
opname"""
118
- input_string = "CONTEXT BGV 16384 4 \n OPERATION a b c\n "
118
+ input_string = "CONTEXT BGV 16384 3 2 \n OPERATION a b c\n "
119
119
result = execute_process (
120
120
[kerngen_path ],
121
121
data_in = input_string ,
@@ -129,7 +129,7 @@ def test_unrecognised_opname(kerngen_path):
129
129
130
130
def test_invalid_scheme (kerngen_path ):
131
131
"""Test kerngen raises an exception when receiving an invalid scheme"""
132
- input_string = "CONTEXT SCHEME 16384 4\n ADD a b c\n "
132
+ input_string = "CONTEXT SCHEME 16384 4 3 \n ADD a b c\n "
133
133
result = execute_process (
134
134
[kerngen_path ],
135
135
data_in = input_string ,
@@ -142,7 +142,7 @@ def test_invalid_scheme(kerngen_path):
142
142
@pytest .mark .parametrize ("invalid_poly" , [16000 , 2 ** 12 , 2 ** 13 , 2 ** 18 ])
143
143
def test_invalid_poly_order (kerngen_path , invalid_poly ):
144
144
"""Poly order should be powers of two >= 2^14 and <= 2^17"""
145
- input_string = "CONTEXT BGV " + str (invalid_poly ) + " 4\n ADD a b c\n "
145
+ input_string = "CONTEXT BGV " + str (invalid_poly ) + " 4 3 \n ADD a b c\n "
146
146
result = execute_process (
147
147
[kerngen_path ],
148
148
data_in = input_string ,
@@ -168,8 +168,12 @@ def test_parse_results_multiple_context():
168
168
with pytest .raises (LookupError ) as e :
169
169
parse_results = ParseResults (
170
170
[
171
- Context (scheme = "BGV" , poly_order = 16384 , max_rns = 1 ),
172
- Context (scheme = "CKKS" , poly_order = 16384 , max_rns = 1 ),
171
+ Context (
172
+ scheme = "BGV" , poly_order = 16384 , key_rns = 2 , current_rns = 1 , max_rns = 1
173
+ ),
174
+ Context (
175
+ scheme = "CKKS" , poly_order = 16384 , key_rns = 2 , current_rns = 1 , max_rns = 1
176
+ ),
173
177
],
174
178
{},
175
179
)
@@ -181,7 +185,7 @@ def test_parse_results_multiple_context():
181
185
def fixture_gen_op_data (request ):
182
186
"""Given an op name, return both the input and expected output strings"""
183
187
in_lines = (
184
- "CONTEXT BGV 16384 4" ,
188
+ "CONTEXT BGV 16384 4 3 " ,
185
189
"Data a 2" ,
186
190
"Data b 2" ,
187
191
"Data c 2" ,
0 commit comments