Skip to content
Snippets Groups Projects

WIP: Revamp the type system

Closed Markus Holzer requested to merge holzer/pystencils:TypeSystem into master
Viewing commit 626dcad8
Show latest version
1 file
+ 3
2
Preferences
Compare changes
@@ -172,6 +172,7 @@ def test_sqrt_of_integer(dtype):
@@ -172,6 +172,7 @@ def test_sqrt_of_integer(dtype):
assert constant not in code
assert constant not in code
 
# TODO this
@pytest.mark.parametrize('dtype', ('float64', 'float32'))
@pytest.mark.parametrize('dtype', ('float64', 'float32'))
def test_integer_comparision(dtype):
def test_integer_comparision(dtype):
f = ps.fields(f"f: {dtype}[2D]")
f = ps.fields(f"f: {dtype}[2D]")
@@ -184,9 +185,9 @@ def test_integer_comparision(dtype):
@@ -184,9 +185,9 @@ def test_integer_comparision(dtype):
# There should be an explicit cast for the integer zero to the type of the field on the rhs
# There should be an explicit cast for the integer zero to the type of the field on the rhs
if dtype == 'float64':
if dtype == 'float64':
t = "_data_f_00[_stride_f_1*ctr_1] = ((((dir) == (1))) ? (0.0)): (_data_f_00[_stride_f_1*ctr_1]));"
t = "_data_f_00[_stride_f_1*ctr_1] = ((((dir) == (1))) ? (((double)(0))): (_data_f_00[_stride_f_1*ctr_1]));"
else:
else:
t = "_data_f_00[_stride_f_1*ctr_1] = ((((dir) == (1))) ? (0.f): (_data_f_00[_stride_f_1*ctr_1]));"
t = "_data_f_00[_stride_f_1*ctr_1] = ((((dir) == (1))) ? (((float)(0))): (_data_f_00[_stride_f_1*ctr_1]));"
assert t in code
assert t in code