Skip to content

Commit

Permalink
tests: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Nov 15, 2023
1 parent afad011 commit 0761781
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions tests/test_xdsl_base.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
from devito import Grid, TimeFunction, Eq, XDSLOperator


def test_simple_xdsl_operator():
def test_xdsl_I():
# Define a simple Devito Operator
grid = Grid(shape=(3,))
u = TimeFunction(name='u', grid=grid)

eq = Eq(u.forward, u + 1)
op = XDSLOperator([eq], opt=None)
op.apply(time_M=1)
assert (u.data[1, :] == 1.).all()
assert (u.data[0, :] == 2.).all()


def test_xdsl_II():
# Define a simple Devito Operator
grid = Grid(shape=(4, 4))
u = TimeFunction(name='u', grid=grid)

eq = Eq(u.forward, u + 1)
op = XDSLOperator([eq], opt=None)
op.apply(time_M=1)
assert (u.data[1, :] == 1.).all()
assert (u.data[0, :] == 2.).all()


def test_xdsl_III():
# Define a simple Devito Operator
grid = Grid(shape=(3, 3, 3))
grid = Grid(shape=(5, 5, 5))
u = TimeFunction(name='u', grid=grid)

eq = Eq(u.forward, u + 1)

op = XDSLOperator([eq], opt=None)
op.apply(time_M=1)
assert (u.data[1, :] == 1.).all()
assert (u.data[0, :] == 2.).all()

0 comments on commit 0761781

Please sign in to comment.