Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
RudolfWeeber
lbmpy
Commits
4203fa7f
Commit
4203fa7f
authored
Oct 21, 2019
by
Martin Bauer
Browse files
Removed hash equivalence test
parent
f6a9b096
Changes
1
Hide whitespace changes
Inline
Side-by-side
lbmpy_tests/test_code_hashequivalence.py
View file @
4203fa7f
from
hashlib
import
sha256
from
lbmpy.creationfunctions
import
create_lb_ast
from
pystencils.backends.cbackend
import
generate_c
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
():
ref_value
=
"6db6ed9e2cbd05edae8fcaeb8168e3178dd578c2681133f3ae9228b23d2be432"
ast
=
create_lb_ast
(
stencil
=
'D3Q19'
,
method
=
'srt'
,
optimization
=
{
'target'
:
'llvm'
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment