def test_vector_unary_not() -> None: result = NpirCodegen().visit( npir.VectorUnaryOp( expr=FieldSliceFactory(name="a"), op=common.UnaryOperator.NOT, )) assert result == "(np.bitwise_not(a_[i:I, j:J, k_:(k_ + 1)]))"
def test_vector_unary_not() -> None: result = NpirCodegen().visit( npir.VectorUnaryOp( op=common.UnaryOperator.NOT, expr=FieldSliceFactory(name="mask", dtype=common.DataType.BOOL), ) ) assert result == "(np.bitwise_not(mask[i:I, j:J, k:K]))"
def test_vector_unary_op() -> None: result = NpirCodegen().visit( npir.VectorUnaryOp( expr=FieldSliceFactory(name="a"), op=common.UnaryOperator.NEG, ), is_serial=False, ) assert result == "(-(a[i:I, j:J, k:K]))"