Skip to content

Commit

Permalink
bring back missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Wicky-Pfund committed Dec 4, 2024
1 parent 29ff5b7 commit 3fb4094
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,3 +395,28 @@ def test_stencil(
test_stencil(field_in, field_out)

np.testing.assert_allclose(field_out.view(np.ndarray)[:, :, 1], 1)


def test_this_k_function():
field_in = gt_storage.ones(
dtype=np.float64, backend="debug", shape=(4, 4, 4), aligned_index=(0, 0, 0)
)
field_out = gt_storage.zeros(
dtype=np.float64, backend="debug", shape=(4, 4, 4), aligned_index=(0, 0, 0)
)

@gtscript.function
def this_k_function(in_field: gtscript.Field[np.float64]):
return in_field.at(K=THIS_K)

@gtscript.stencil(backend="debug")
def test_stencil(
in_field: gtscript.Field[np.float64],
out_field: gtscript.Field[np.float64],
):
with computation(PARALLEL), interval(...):
out_field[0, 0, 0] = this_k_function(in_field)

test_stencil(field_in, field_out)

np.testing.assert_allclose(field_out.view(np.ndarray)[:, :, :], 1)

0 comments on commit 3fb4094

Please sign in to comment.