def test_create_ops_arg_constant(self): a = Constant(name='*a') res = create_ops_arg(a, {}, {}, {}) assert type(res) == namespace['ops_arg_gbl'] assert str(res.args[0]) == str(Byref(Constant(name='a'))) assert res.args[1] == 1 assert res.args[2] == Literal('"%s"' % dtype_to_cstr(a.dtype)) assert res.args[3] == namespace['ops_read']
def test_create_ops_arg_constant(self): a = Constant(name='*a') res = create_ops_arg(a, {}, {}) assert res.name == namespace['ops_arg_gbl'].name assert res.args == [ Byref(Constant(name='a')), 1, Literal('"%s"' % dtype_to_cstr(a.dtype)), namespace['ops_read'] ]
def test_create_ops_arg_constant(self): a = Constant(name='*a') ops_arg = create_ops_arg(a, {}, {}, {}) assert ops_arg.ops_type == namespace['ops_arg_gbl'] assert str(ops_arg.ops_name) == str(Byref(Constant(name='a'))) assert ops_arg.elements_per_point == 1 assert ops_arg.dtype == Literal('"%s"' % dtype_to_cstr(a.dtype)) assert ops_arg.rw_flag == namespace['ops_read']
def test_create_ops_arg_function(self, read): u = OpsAccessible('u', np.float32, read) dat = OpsDat('u_dat') stencil = OpsStencil('stencil') info = AccessibleInfo(u, None, None) res = create_ops_arg(u, {'u': info}, {'u': dat}, {u: stencil}) assert type(res) == namespace['ops_arg_dat'] assert res.args == (dat, 1, stencil, Literal('"%s"' % dtype_to_cstr(u.dtype)), namespace['ops_read'] if read else namespace['ops_write'])
def test_create_ops_arg_function(self, read): u = OpsAccessible('u', dtype=np.float32, read_only=read) dat = OpsDat('u_dat') stencil = OpsStencil('stencil') info = AccessibleInfo(u, None, None) ops_arg = create_ops_arg(u, {'u': info}, {'u': dat}, {u: stencil}) assert ops_arg.ops_type == namespace['ops_arg_dat'] assert ops_arg.ops_name == OpsDat('u_dat') assert ops_arg.elements_per_point == 1 assert ops_arg.dtype == Literal('"%s"' % dtype_to_cstr(u.dtype)) assert ops_arg.rw_flag == \ namespace['ops_read'] if read else namespace['ops_write']