Skip to content
Snippets Groups Projects
Commit 679bf618 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

extend printing test

parent e12bef27
Branches
Tags
No related merge requests found
......@@ -29,7 +29,7 @@ class CPrinter:
def function(self, func: PsKernelFunction) -> str:
params = func.get_parameters()
params_str = ", ".join(f"{p.dtype} {p.name}" for p in params)
decl = f"FUNC_PREFIX void {func.name} ( {params_str} )"
decl = f"FUNC_PREFIX void {func.name} ({params_str})"
body = self.visit(func.body)
return f"{decl}\n{body}"
......
......@@ -34,5 +34,10 @@ def test_basic_kernel():
printer = CPrinter()
code = printer.print(func)
assert code.find("u_data[ctr] = u_data[ctr + 1] + u_data[ctr - 1]") >= 0
paramlist = func.get_parameters()
params_str = ", ".join(f"{p.dtype} {p.name}" for p in paramlist)
assert code.find("(" + params_str + ")") >= 0
assert code.find("u_data[ctr] = u_data[ctr - 1] + u_data[ctr + 1];") >= 0
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