An error occurred while loading the file. Please try again.
-
Stephan Seitz authored
- `get_code` will keep the previous behavior of `show_code` - `get_code_str` will be equivalent to previous `str(show_code(...))`
1e7a179a
test_source_code_comment.py 733 B
# -*- coding: utf-8 -*-
#
# Copyright © 2019 Stephan Seitz <stephan.seitz@fau.de>
#
# Distributed under terms of the GPLv3 license.
"""
"""
import pystencils
import pystencils.astnodes
def test_source_code_comment():
a, b = pystencils.fields('a,b: float[2D]')
assignments = pystencils.AssignmentCollection(
{a.center(): b[0, 2] + b[0, 0]}, {}
)
ast = pystencils.create_kernel(assignments, target='cpu')
ast.body.append(pystencils.astnodes.SourceCodeComment("Hallo"))
ast.body.append(pystencils.astnodes.EmptyLine())
ast.body.append(pystencils.astnodes.SourceCodeComment("World!"))
print(ast)
compiled = ast.compile()
assert compiled is not None
pystencils.show_code(ast)