Skip to content
Snippets Groups Projects
Commit 4203fa7f authored by Martin Bauer's avatar Martin Bauer
Browse files

Removed hash equivalence test

parent f6a9b096
No related merge requests found
from hashlib import sha256 from hashlib import sha256
from lbmpy.creationfunctions import create_lb_ast from lbmpy.creationfunctions import create_lb_ast
from pystencils.backends.cbackend import generate_c
from pystencils.llvm.llvmjit import generate_llvm from pystencils.llvm.llvmjit import generate_llvm
def test_hash_equivalence():
"""
This test should ensure that if the Python interpreter is called multiple times to generated the same method
exactly the same code (not only functionally equivalent code) should be produced.
Due to undefined order in sets and dicts this may no be the case.
"""
ref_value = "902be811a587c52e24ce03ec78d3defbb87d58eaaafbb9b47f823b960319e4be"
ast = create_lb_ast(stencil='D3Q19', method='srt', optimization={'openmp': False})
code = generate_c(ast)
hash_value = sha256(code.encode()).hexdigest()
assert hash_value == ref_value
def test_hash_equivalence_llvm(): def test_hash_equivalence_llvm():
ref_value = "6db6ed9e2cbd05edae8fcaeb8168e3178dd578c2681133f3ae9228b23d2be432" ref_value = "6db6ed9e2cbd05edae8fcaeb8168e3178dd578c2681133f3ae9228b23d2be432"
ast = create_lb_ast(stencil='D3Q19', method='srt', optimization={'target': 'llvm'}) ast = create_lb_ast(stencil='D3Q19', method='srt', optimization={'target': 'llvm'})
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment