Skip to content

Commit 6c74dc3

Browse files
committed
noodle number 4
1 parent a15e504 commit 6c74dc3

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

tests/test_dimension.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,8 +1492,22 @@ def test_stepping_dim_in_condition_lowering(self):
14921492
op.apply(time_M=threshold+3)
14931493
assert np.all(g.data[0, :, :] == threshold)
14941494
assert np.all(g.data[1, :, :] == threshold + 1)
1495-
assert 'if (g[t0][x + 1][y + 1] <= 10)\n {' + \
1496-
'\n g[t1][x + 1][y + 1] = g[t0][x + 1][y + 1] + 1' in str(op.ccode)
1495+
1496+
# We want to assert that the following snippet:
1497+
# ```
1498+
# if (g[t0][x + 1][y + 1] <= 10)
1499+
# {
1500+
# g[t1][x + 1][y + 1] = g[t0][x + 1][y + 1] + 1
1501+
# ```
1502+
# is in the generated code, but indentation etc. seems to vary.
1503+
part1 = 'if (g[t0][x + 1][y + 1] <= 10)\n'
1504+
part2 = 'g[t1][x + 1][y + 1] = g[t0][x + 1][y + 1] + 1'
1505+
whole_code = str(op.ccode)
1506+
1507+
loc = whole_code.find(part1)
1508+
assert loc != -1
1509+
loc = whole_code.find(part2, loc + len(part1))
1510+
assert loc != -1
14971511

14981512
def test_expr_like_lowering(self):
14991513
"""

0 commit comments

Comments
 (0)