@@ -52,14 +52,16 @@ def definition(definition_dir: Path) -> KDefinition:
5252 from pyk .kast .outer import read_kast_definition
5353
5454 res = read_kast_definition (definition_dir / 'compiled.json' )
55+ _patch_definition (res )
56+ return res
57+
5558
59+ def _patch_definition (definition : KDefinition ) -> None :
5660 # Monkey patch __repr__ on the fixture to avoid flooding the output on test failure
57- cls = res .__class__
61+ cls = definition .__class__
5862 new_repr = lambda self : repr ('KMIR LLVM definition' )
5963 new_cls = type (f'{ cls .__name__ } WithCustomRepr' , (cls ,), {'__repr__' : new_repr })
60- object .__setattr__ (res , '__class__' , new_cls )
61-
62- return res
64+ object .__setattr__ (definition , '__class__' , new_cls )
6365
6466
6567def dedent (s : str ) -> str :
@@ -181,6 +183,7 @@ def load_test_types():
181183 'enum-option-nonzero-none' ,
182184 'enum-option-nonzero-some' ,
183185 'str' ,
186+ 'struct-simple-permuted-fields' ,
184187)
185188
186189
@@ -232,15 +235,31 @@ def test_decode_value(
232235 assert test_data .expected == actual
233236
234237
238+ @pytest .fixture (scope = 'module' )
239+ def kmir_definition_dir () -> Path :
240+ from kmir .build import LLVM_DEF_DIR
241+
242+ return LLVM_DEF_DIR
243+
244+
245+ @pytest .fixture (scope = 'module' )
246+ def kmir_definition (kmir_definition_dir : Path ) -> KDefinition :
247+ from pyk .kast .outer import read_kast_definition
248+
249+ res = read_kast_definition (kmir_definition_dir / 'compiled.json' )
250+ _patch_definition (res )
251+ return res
252+
253+
235254@pytest .mark .parametrize (
236255 'test_data' ,
237256 TEST_DATA ,
238257 ids = [test_id for test_id , * _ in TEST_DATA ],
239258)
240259def test_python_decode_value (
241260 test_data : _TestData ,
242- definition_dir : Path ,
243- definition : KDefinition ,
261+ kmir_definition_dir : Path ,
262+ kmir_definition : KDefinition ,
244263 tmp_path : Path ,
245264) -> None :
246265 from pyk .kast .inner import KSort
@@ -260,9 +279,9 @@ def test_python_decode_value(
260279 types = types ,
261280 )
262281 kast = value .to_kast ()
263- kore = kast_to_kore (definition , kast , KSort ('Value' ))
282+ kore = kast_to_kore (kmir_definition , kast , KSort ('Value' ))
264283 actual = kore_print (
265- definition_dir = definition_dir ,
284+ definition_dir = kmir_definition_dir ,
266285 pattern = kore ,
267286 output = 'pretty' ,
268287 )
0 commit comments