Repository: GridTools/gt4py
Pull request #1039 (2022-11-09 15:00:35)

Functional: Refactoring of math and unary builtins tests 
Almost all math built-ins have been integrated in the backend, hence check for fieldview_backend in tests is not longer necessary:
```python
if fieldview_backend == gtfn_cpu.run_gtfn:
    pytest.xfail("gtfn does not yet support math builtins")
```

Addition of trigonometric, log, exp, isinfinite, etc. builtins in front-end tests


Patch:
diff --git a/.gitignore b/.gitignore
index 3c86600c..b4f2b1c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -104,7 +104,7 @@ venv.bak/
 .idea/
 
 # VSCode project settings
-/.vscode/
+/.vscode
 
 # SublimeText project settings
 *.sublime-project
diff --git a/setup.cfg b/setup.cfg
index 44fa0810..0d7d76a4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -50,6 +50,7 @@ install_requires =
     devtools>=0.5
     deepdiff>=5.8
     frozendict>=2.3
+    gridtools-cpp>=2.2.2,==2.*
     jinja2>=2.10
     lark>=1.1.2
     mako>=1.1
diff --git a/src/functional/ffront/foast_passes/type_deduction.py b/src/functional/ffront/foast_passes/type_deduction.py
index 31362c8f..93baf189 100644
--- a/src/functional/ffront/foast_passes/type_deduction.py
+++ b/src/functional/ffront/foast_passes/type_deduction.py
@@ -461,6 +461,12 @@ class FieldOperatorTypeDeduction(traits.VisitorWithSymbolTableTrait, NodeTransla
         if node.op == ct.BinaryOperator.POW:
             return left_type
 
+        if node.op == ct.BinaryOperator.MOD and not type_info.is_integral(right_type):
+            raise FieldOperatorTypeDeductionError.from_foast_node(
+                arg,
+                msg=f"Type {right_type} can not be used in operator `{node.op}`, it can only accept ints",
+            )
+
         try:
             return type_info.promote(left_type, right_type)
         except GTTypeError as ex:
diff --git a/src/functional/ffront/past_passes/type_deduction.py b/src/functional/ffront/past_passes/type_deduction.py
index 0868d0a6..0552e5a2 100644
--- a/src/functional/ffront/past_passes/type_deduction.py
+++ b/src/functional/ffront/past_passes/type_deduction.py
@@ -143,6 +143,12 @@ class ProgramTypeDeduction(traits.VisitorWithSymbolTableTrait, NodeTranslator):
         if node.op == ct.BinaryOperator.POW:
             return left_type
 
+        if node.op == ct.BinaryOperator.MOD and not type_info.is_integral(right_type):
+            raise ProgramTypeError.from_past_node(
+                arg,
+                msg=f"Type {right_type} can not be used in operator `{node.op}`, it can only accept ints",
+            )
+
         try:
             return type_info.promote(left_type, right_type)
         except GTTypeError as ex:
diff --git a/src/functional/otf/compilation/build_systems/cmake_lists.py b/src/functional/otf/compilation/build_systems/cmake_lists.py
index d79277ac..2b5fbdff 100644
--- a/src/functional/otf/compilation/build_systems/cmake_lists.py
+++ b/src/functional/otf/compilation/build_systems/cmake_lists.py
@@ -12,7 +12,6 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-import textwrap
 from typing import Sequence
 
 import eve
@@ -84,15 +83,9 @@ class CMakeListsGenerator(eve.codegen.TemplatedGenerator):
 
                 return f"find_package(pybind11 CONFIG REQUIRED PATHS {pybind11.get_cmake_dir()})"
             case "gridtools":
-                return textwrap.dedent(
-                    """\
-                    FetchContent_Declare(GridTools
-                        GIT_REPOSITORY https://github.com/GridTools/gridtools.git
-                        GIT_TAG        master
-                    )
-                    FetchContent_MakeAvailable(GridTools)\
-                    """
-                )
+                import gridtools_cpp  # type: ignore
+
+                return f"find_package(GridTools REQUIRED PATHS {gridtools_cpp.get_cmake_dir()})"
             case _:
                 raise ValueError("Library {name} is not supported".format(name=dep.name))
 
diff --git a/src/functional/program_processors/codegens/gtfn/itir_to_gtfn_ir.py b/src/functional/program_processors/codegens/gtfn/itir_to_gtfn_ir.py
index a292357f..30ce2136 100644
--- a/src/functional/program_processors/codegens/gtfn/itir_to_gtfn_ir.py
+++ b/src/functional/program_processors/codegens/gtfn/itir_to_gtfn_ir.py
@@ -188,6 +188,7 @@ class GTFN_lowering(eve.NodeTranslator, eve.VisitorWithSymbolTableTrait):
         "and_": "&&",
         "or_": "||",
         "xor_": "^",
+        "mod": "%",
     }
     _unary_op_map: ClassVar[dict[str, str]] = {"not_": "!"}
 


Test patch:
diff --git a/tests/functional_tests/ffront_tests/ffront_test_utils.py b/tests/functional_tests/ffront_tests/ffront_test_utils.py
new file mode 100644
index 00000000..3c747afc
--- /dev/null
+++ b/tests/functional_tests/ffront_tests/ffront_test_utils.py
@@ -0,0 +1,130 @@
+# -*- coding: utf-8 -*-
+#
+# GT4Py Project - GridTools Framework
+#
+# Copyright (c) 2014-2021, ETH Zurich
+# All rights reserved.
+#
+# This file is part of the GT4Py project and the GridTools framework.
+# GT4Py is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or any later
+# version. See the LICENSE.txt file at the top-level directory of this
+# distribution for a copy of the license or check <https://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+from collections import namedtuple
+from typing import TypeVar
+
+import numpy as np
+import pytest
+
+from functional.common import DimensionKind
+from functional.ffront.fbuiltins import Dimension, FieldOffset
+from functional.iterator.embedded import (
+    NeighborTableOffsetProvider,
+    index_field,
+    np_as_located_field,
+)
+from functional.program_processors.runners import gtfn_cpu, roundtrip
+
+
+@pytest.fixture(params=[roundtrip.executor, gtfn_cpu.run_gtfn])
+def fieldview_backend(request):
+    yield request.param
+
+
+def debug_itir(tree):
+    """Compare tree snippets while debugging."""
+    from devtools import debug
+
+    from eve.codegen import format_python_source
+    from functional.program_processors import EmbeddedDSL
+
+    debug(format_python_source(EmbeddedDSL.apply(tree)))
+
+
+DimsType = TypeVar("DimsType")
+DType = TypeVar("DType")
+
+IDim = Dimension("IDim")
+JDim = Dimension("JDim")
+KDim = Dimension("KDim", kind=DimensionKind.VERTICAL)
+Ioff = FieldOffset("Ioff", source=IDim, target=(IDim,))
+Joff = FieldOffset("Joff", source=JDim, target=(JDim,))
+Koff = FieldOffset("Koff", source=KDim, target=(KDim,))
+
+Vertex = Dimension("Vertex")
+Edge = Dimension("Edge")
+EdgeOffset = FieldOffset("EdgeOffset", source=Edge, target=(Edge,))
+
+size = 10
+
+
+@pytest.fixture
+def reduction_setup():
+    num_vertices = 9
+    edge = Dimension("Edge")
+    vertex = Dimension("Vertex")
+    v2edim = Dimension("V2E", kind=DimensionKind.LOCAL)
+    e2vdim = Dimension("E2V", kind=DimensionKind.LOCAL)
+
+    v2e_arr = np.array(
+        [
+            [0, 15, 2, 9],  # 0
+            [1, 16, 0, 10],
+            [2, 17, 1, 11],
+            [3, 9, 5, 12],  # 3
+            [4, 10, 3, 13],
+            [5, 11, 4, 14],
+            [6, 12, 8, 15],  # 6
+            [7, 13, 6, 16],
+            [8, 14, 7, 17],
+        ]
+    )
+
+    # create e2v connectivity by inverting v2e
+    num_edges = np.max(v2e_arr) + 1
+    e2v_arr = [[] for _ in range(0, num_edges)]
+    for v in range(0, v2e_arr.shape[0]):
+        for e in v2e_arr[v]:
+            e2v_arr[e].append(v)
+    assert all(len(row) == 2 for row in e2v_arr)
+    e2v_arr = np.asarray(e2v_arr)
+
+    yield namedtuple(
+        "ReductionSetup",
+        [
+            "num_vertices",
+            "num_edges",
+            "Edge",
+            "Vertex",
+            "V2EDim",
+            "E2VDim",
+            "V2E",
+            "E2V",
+            "inp",
+            "out",
+            "offset_provider",
+            "v2e_table",
+            "e2v_table",
+        ],
+    )(
+        num_vertices=num_vertices,
+        num_edges=num_edges,
+        Edge=edge,
+        Vertex=vertex,
+        V2EDim=v2edim,
+        E2VDim=e2vdim,
+        V2E=FieldOffset("V2E", source=edge, target=(vertex, v2edim)),
+        E2V=FieldOffset("E2V", source=vertex, target=(edge, e2vdim)),
+        inp=index_field(edge, dtype=np.int64),
+        out=np_as_located_field(vertex)(np.zeros([num_vertices], dtype=np.int64)),
+        offset_provider={
+            "V2E": NeighborTableOffsetProvider(v2e_arr, vertex, edge, 4),
+            "E2V": NeighborTableOffsetProvider(e2v_arr, edge, vertex, 2, has_skip_values=False),
+        },
+        v2e_table=v2e_arr,
+        e2v_table=e2v_arr,
+    )  # type: ignore
diff --git a/tests/functional_tests/ffront_tests/test_execution.py b/tests/functional_tests/ffront_tests/test_execution.py
index 5da4d656..11e9027f 100644
--- a/tests/functional_tests/ffront_tests/test_execution.py
+++ b/tests/functional_tests/ffront_tests/test_execution.py
@@ -13,14 +13,10 @@
 # distribution for a copy of the license or check <https://www.gnu.org/licenses/>.
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
-from collections import namedtuple
 from functools import reduce
-from typing import TypeVar
 
-import numpy as np
-import pytest
+import pytest as pytest
 
-from functional.common import DimensionKind
 from functional.ffront.decorator import field_operator, program, scan_operator
 from functional.ffront.fbuiltins import (
     Dimension,
@@ -59,17 +55,12 @@ def debug_itir(tree):
     debug(format_python_source(EmbeddedDSL.apply(tree)))
 
 
-DimsType = TypeVar("DimsType")
-DType = TypeVar("DType")
-
-IDim = Dimension("IDim")
-JDim = Dimension("JDim")
+from .ffront_test_utils import *
 
 
 def test_copy(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size)))
-    b = np_as_located_field(IDim)(np.zeros((size)))
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
 
     @field_operator(backend=fieldview_backend)
     def copy(inp: Field[[IDim], float64]) -> Field[[IDim], float64]:
@@ -78,18 +69,17 @@ def test_copy(fieldview_backend):
         field_1 = field_tuple[1]
         return field_0
 
-    copy(a, out=b, offset_provider={})
+    copy(a_I_float, out=b_I_float, offset_provider={})
 
-    assert np.allclose(a, b)
+    assert np.allclose(a_I_float, b_I_float)
 
 
 @pytest.mark.skip(reason="no lowering for returning a tuple of fields exists yet.")
 def test_multicopy(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size)))
-    b = np_as_located_field(IDim)(np.ones((size)) * 3)
-    c = np_as_located_field(IDim)(np.zeros((size)))
-    d = np_as_located_field(IDim)(np.zeros((size)))
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
+    out_I_float_1 = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
 
     @field_operator(backend=fieldview_backend)
     def multicopy(
@@ -97,102 +87,13 @@ def test_multicopy(fieldview_backend):
     ) -> tuple[Field[[IDim], float64], Field[[IDim], float64]]:
         return inp1, inp2
 
-    multicopy(a, b, out=(c, d), offset_provider={})
-
-    assert np.allclose(a, c)
-    assert np.allclose(b, d)
-
-
-def test_arithmetic(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size)))
-    b = np_as_located_field(IDim)(np.ones((size)) * 2)
-    c = np_as_located_field(IDim)(np.zeros((size)))
-
-    @field_operator(backend=fieldview_backend)
-    def arithmetic(
-        inp1: Field[[IDim], float64], inp2: Field[[IDim], float64]
-    ) -> Field[[IDim], float64]:
-        return (inp1 + inp2) * 2.0
-
-    arithmetic(a, b, out=c, offset_provider={})
-
-    assert np.allclose((a.array() + b.array()) * 2.0, c)
-
-
-def test_power(fieldview_backend):
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.xfail("gtfn does not yet support math builtins")
-
-    size = 10
-    a = np_as_located_field(IDim)(np.random.randn((size)))
-    b = np_as_located_field(IDim)(np.zeros((size)))
-
-    @field_operator(backend=fieldview_backend)
-    def pow(inp1: Field[[IDim], float64]) -> Field[[IDim], float64]:
-        return inp1**2
-
-    pow(a, out=b, offset_provider={})
-
-    assert np.allclose(a.array() ** 2, b)
-
-
-def test_power_arithmetic(fieldview_backend):
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.xfail("gtfn does not yet support math builtins")
-
-    size = 10
-    a = np_as_located_field(IDim)(np.random.randn((size)))
-    b = np_as_located_field(IDim)(np.zeros((size)))
-    c = np_as_located_field(IDim)(np.random.randn((size)))
-
-    @field_operator(backend=fieldview_backend)
-    def power_arithmetic(
-        inp1: Field[[IDim], float64], inp2: Field[[IDim], float64]
-    ) -> Field[[IDim], float64]:
-        return inp2 + ((inp1 + inp2) ** 2)
-
-    power_arithmetic(a, c, out=b, offset_provider={})
-
-    assert np.allclose(c.array() + ((c.array() + a.array()) ** 2), b)
-
-
-def test_bit_logic(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim)(np.full((size), True))
-    b_data = np.full((size), True)
-    b_data[5] = False
-    b = np_as_located_field(IDim)(b_data)
-    c = np_as_located_field(IDim)(np.full((size), False))
-
-    @field_operator(backend=fieldview_backend)
-    def bit_and(inp1: Field[[IDim], bool], inp2: Field[[IDim], bool]) -> Field[[IDim], bool]:
-        return inp1 & inp2 & True
-
-    bit_and(a, b, out=c, offset_provider={})
-
-    assert np.allclose(a.array() & b.array(), c)
-
-
-def test_unary_neg(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size), dtype=int32))
-    b = np_as_located_field(IDim)(np.zeros((size), dtype=int32))
-
-    @field_operator(backend=fieldview_backend)
-    def uneg(inp: Field[[IDim], int32]) -> Field[[IDim], int32]:
-        return -inp
-
-    uneg(a, out=b, offset_provider={})
-
-    assert np.allclose(b, np.full((size), -1, dtype=int32))
+    assert np.allclose(a_I_float, out_I_float)
+    assert np.allclose(b_I_float, out_I_float_1)
 
 
 def test_shift(fieldview_backend):
-    size = 10
-    Ioff = FieldOffset("Ioff", source=IDim, target=(IDim,))
     a = np_as_located_field(IDim)(np.arange(size + 1, dtype=np.float64))
-    b = np_as_located_field(IDim)(np.zeros((size)))
+    out_I_float = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
 
     @field_operator
     def shift_by_one(inp: Field[[IDim], float64]) -> Field[[IDim], float64]:
@@ -202,18 +103,16 @@ def test_shift(fieldview_backend):
     def fencil(inp: Field[[IDim], float64], out: Field[[IDim], float64]) -> None:
         shift_by_one(inp, out=out)
 
-    fencil(a, b, offset_provider={"Ioff": IDim})
+    fencil(a, out_I_float, offset_provider={"Ioff": IDim})
 
-    assert np.allclose(b.array(), np.arange(1, 11))
+    assert np.allclose(out_I_float.array(), np.arange(1, 11))
 
 
 def test_fold_shifts(fieldview_backend):
     """Shifting the result of an addition should work."""
-    size = 10
-    Ioff = FieldOffset("Ioff", source=IDim, target=(IDim,))
     a = np_as_located_field(IDim)(np.arange(size + 1, dtype=np.float64))
     b = np_as_located_field(IDim)(np.ones((size + 2)) * 2)
-    c = np_as_located_field(IDim)(np.zeros((size)))
+    out_I_float = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
 
     @field_operator
     def auto_lift(
@@ -228,18 +127,18 @@ def test_fold_shifts(fieldview_backend):
     ) -> None:
         auto_lift(inp1, inp2, out=out)
 
-    fencil(a, b, c, offset_provider={"Ioff": IDim})
+    fencil(a, b, out_I_float, offset_provider={"Ioff": IDim})
 
-    assert np.allclose(a[1:] + b[2:], c)
+    assert np.allclose(a[1:] + b[2:], out_I_float)
 
 
 def test_tuples(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
+
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.skip("Tuples are not supported yet.")
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size)))
-    b = np_as_located_field(IDim)(np.ones((size)) * 2)
-    c = np_as_located_field(IDim)(np.zeros((size)))
 
     @field_operator
     def tuples(
@@ -255,264 +154,16 @@ def test_tuples(fieldview_backend):
     ) -> None:
         tuples(inp1, inp2, out=out)
 
-    fencil(a, b, c, offset_provider={})
-
-    assert np.allclose((a.array() * 1.3 + b.array() * 5.0) * 3.4, c)
-
-
-def test_promotion(fieldview_backend):
-    Edge = Dimension("Edge")
-    K = Dimension("K")
-
-    size = 10
-    ksize = 5
-    a = np_as_located_field(Edge, K)(np.ones((size, ksize)))
-    b = np_as_located_field(K)(np.ones((ksize)) * 2)
-    c = np_as_located_field(Edge, K)(np.zeros((size, ksize)))
-
-    @field_operator(backend=fieldview_backend)
-    def promotion(
-        inp1: Field[[Edge, K], float64], inp2: Field[[K], float64]
-    ) -> Field[[Edge, K], float64]:
-        return inp1 / inp2
-
-    promotion(a, b, out=c, offset_provider={})
-
-    assert np.allclose((a.array() / b.array()), c)
-
-
-@pytest.fixture
-def reduction_setup():
-    num_vertices = 9
-    edge = Dimension("Edge")
-    vertex = Dimension("Vertex")
-    v2edim = Dimension("V2E", kind=DimensionKind.LOCAL)
-    e2vdim = Dimension("E2V", kind=DimensionKind.LOCAL)
-
-    v2e_arr = np.array(
-        [
-            [0, 15, 2, 9],  # 0
-            [1, 16, 0, 10],
-            [2, 17, 1, 11],
-            [3, 9, 5, 12],  # 3
-            [4, 10, 3, 13],
-            [5, 11, 4, 14],
-            [6, 12, 8, 15],  # 6
-            [7, 13, 6, 16],
-            [8, 14, 7, 17],
-        ]
-    )
-
-    # create e2v connectivity by inverting v2e
-    num_edges = np.max(v2e_arr) + 1
-    e2v_arr = [[] for _ in range(0, num_edges)]
-    for v in range(0, v2e_arr.shape[0]):
-        for e in v2e_arr[v]:
-            e2v_arr[e].append(v)
-    assert all(len(row) == 2 for row in e2v_arr)
-    e2v_arr = np.asarray(e2v_arr)
-
-    yield namedtuple(
-        "ReductionSetup",
-        [
-            "num_vertices",
-            "num_edges",
-            "Edge",
-            "Vertex",
-            "V2EDim",
-            "E2VDim",
-            "V2E",
-            "E2V",
-            "inp",
-            "out",
-            "offset_provider",
-            "v2e_table",
-            "e2v_table",
-        ],
-    )(
-        num_vertices=num_vertices,
-        num_edges=num_edges,
-        Edge=edge,
-        Vertex=vertex,
-        V2EDim=v2edim,
-        E2VDim=e2vdim,
-        V2E=FieldOffset("V2E", source=edge, target=(vertex, v2edim)),
-        E2V=FieldOffset("E2V", source=vertex, target=(edge, e2vdim)),
-        inp=index_field(edge, dtype=np.int64),
-        out=np_as_located_field(vertex)(np.zeros([num_vertices], dtype=np.int64)),
-        offset_provider={
-            "V2E": NeighborTableOffsetProvider(v2e_arr, vertex, edge, 4),
-            "E2V": NeighborTableOffsetProvider(e2v_arr, edge, vertex, 2, has_skip_values=False),
-        },
-        v2e_table=v2e_arr,
-        e2v_table=e2v_arr,
-    )  # type: ignore
-
-
-def test_maxover_execution_sparse(reduction_setup, fieldview_backend):
-    """Testing max_over functionality."""
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.skip("not yet supported.")
-    rs = reduction_setup
-    Vertex = rs.Vertex
-    V2EDim = rs.V2EDim
-
-    inp_field = np_as_located_field(Vertex, V2EDim)(rs.v2e_table)
-
-    @field_operator(backend=fieldview_backend)
-    def maxover_fieldoperator(inp_field: Field[[Vertex, V2EDim], int64]) -> Field[[Vertex], int64]:
-        return max_over(inp_field, axis=V2EDim)
-
-    maxover_fieldoperator(inp_field, out=rs.out, offset_provider=rs.offset_provider)
-
-    ref = np.max(rs.v2e_table, axis=1)
-    assert np.allclose(ref, rs.out)
-
-
-def test_maxover_execution_negatives(reduction_setup, fieldview_backend):
-    """Testing max_over functionality for negative values in array."""
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.skip("not yet supported.")
-    rs = reduction_setup
-    Edge = rs.Edge
-    Vertex = rs.Vertex
-    V2EDim = rs.V2EDim
-    V2E = rs.V2E
-
-    edge_num = np.max(rs.v2e_table)
-    inp_field_arr = np.arange(-edge_num // 2, edge_num // 2 + 1, 1, dtype=int)
-    inp_field = np_as_located_field(Edge)(inp_field_arr)
-
-    @field_operator(backend=fieldview_backend)
-    def maxover_negvals(
-        edge_f: Field[[Edge], int64],
-    ) -> Field[[Vertex], int64]:
-        out = max_over(edge_f(V2E), axis=V2EDim)
-        return out
-
-    maxover_negvals(inp_field, out=rs.out, offset_provider=rs.offset_provider)
-
-    ref = np.max(inp_field_arr[rs.v2e_table], axis=1)
-    assert np.allclose(ref, rs.out)
-
-
-def test_minover_execution(reduction_setup, fieldview_backend):
-    """Testing the min_over functionality"""
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.skip("not implemented yet")
-    rs = reduction_setup
-    Vertex = rs.Vertex
-    V2EDim = rs.V2EDim
-
-    in_field = np_as_located_field(Vertex, V2EDim)(rs.v2e_table)
-
-    @field_operator
-    def minover_fieldoperator(input: Field[[Vertex, V2EDim], int64]) -> Field[[Vertex], int64]:
-        return min_over(input, axis=V2EDim)
-
-    minover_fieldoperator(in_field, out=rs.out, offset_provider=rs.offset_provider)
-
-    ref = np.min(rs.v2e_table, axis=1)
-    assert np.allclose(ref, rs.out)
-
-
-def test_minover_execution_float(reduction_setup, fieldview_backend):
-    """Testing the min_over functionality"""
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.skip("not implemented yet")
-    rs = reduction_setup
-    Vertex = rs.Vertex
-    V2EDim = rs.V2EDim
-
-    in_array = np.random.default_rng().uniform(low=-1, high=1, size=rs.v2e_table.shape)
-    in_field = np_as_located_field(Vertex, V2EDim)(in_array)
-    out_field = np_as_located_field(Vertex)(np.zeros(rs.num_vertices))
-
-    @field_operator
-    def minover_fieldoperator(input: Field[[Vertex, V2EDim], float64]) -> Field[[Vertex], float64]:
-        return min_over(input, axis=V2EDim)
-
-    minover_fieldoperator(in_field, out=out_field, offset_provider=rs.offset_provider)
-
-    ref = np.min(in_array, axis=1)
-    assert np.allclose(ref, out_field)
-
-
-def test_reduction_execution(reduction_setup, fieldview_backend):
-    """Testing a trivial neighbor sum."""
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.skip("IndexFields are not supported yet.")
-    rs = reduction_setup
-    Edge = rs.Edge
-    Vertex = rs.Vertex
-    V2EDim = rs.V2EDim
-    V2E = rs.V2E
-
-    @field_operator
-    def reduction(edge_f: Field[[Edge], int64]) -> Field[[Vertex], int64]:
-        return neighbor_sum(edge_f(V2E), axis=V2EDim)
-
-    @program(backend=fieldview_backend)
-    def fencil(edge_f: Field[[Edge], int64], out: Field[[Vertex], int64]) -> None:
-        reduction(edge_f, out=out)
-
-    fencil(rs.inp, rs.out, offset_provider=rs.offset_provider)
-
-    ref = np.sum(rs.v2e_table, axis=1)
-    assert np.allclose(ref, rs.out)
-
-
-def test_reduction_execution_nb(reduction_setup, fieldview_backend):
-    """Testing a neighbor sum on a neighbor field."""
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.skip("not yet supported.")
-    rs = reduction_setup
-    V2EDim = rs.V2EDim
-
-    nb_field = np_as_located_field(rs.Vertex, rs.V2EDim)(rs.v2e_table)
-
-    @field_operator(backend=fieldview_backend)
-    def reduction(nb_field: Field[[rs.Vertex, rs.V2EDim], int64]) -> Field[[rs.Vertex], int64]:  # type: ignore
-        return neighbor_sum(nb_field, axis=V2EDim)
-
-    reduction(nb_field, out=rs.out, offset_provider=rs.offset_provider)
-
-    ref = np.sum(rs.v2e_table, axis=1)
-    assert np.allclose(ref, rs.out)
-
-
-def test_reduction_expression(reduction_setup, fieldview_backend):
-    """Test reduction with an expression directly inside the call."""
-    if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.skip("IndexFields are not supported yet.")
-    rs = reduction_setup
-    Vertex = rs.Vertex
-    Edge = rs.Edge
-    V2EDim = rs.V2EDim
-    V2E = rs.V2E
-
-    @field_operator
-    def reduce_expr(edge_f: Field[[Edge], int64]) -> Field[[Vertex], int64]:
-        tmp_nbh_tup = edge_f(V2E), edge_f(V2E)
-        tmp_nbh = tmp_nbh_tup[0]
-        return 3 * neighbor_sum(-edge_f(V2E) * tmp_nbh * 2, axis=V2EDim)
-
-    @program(backend=fieldview_backend)
-    def fencil(edge_f: Field[[Edge], int64], out: Field[[Vertex], int64]) -> None:
-        reduce_expr(edge_f, out=out)
-
-    fencil(rs.inp, rs.out, offset_provider=rs.offset_provider)
+    fencil(a_I_float, b_I_float, out_I_float, offset_provider={})
 
-    ref = 3 * np.sum(-(rs.v2e_table**2) * 2, axis=1)
-    assert np.allclose(ref, rs.out.array())
+    assert np.allclose((a_I_float.array() * 1.3 + b_I_float.array() * 5.0) * 3.4, out_I_float)
 
 
 def test_scalar_arg(fieldview_backend):
     """Test scalar argument being turned into 0-dim field."""
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.skip("ConstantFields are not supported yet.")
-    Vertex = Dimension("Vertex")
-    size = 5
+
     inp = 5.0
     out = np_as_located_field(Vertex)(np.zeros([size]))
 
@@ -526,71 +177,10 @@ def test_scalar_arg(fieldview_backend):
     assert np.allclose(ref, out.array())
 
 
-def test_conditional_tuple_1():
-    size = 10
-    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
-    mask.array()[0 : (size // 2)] = True
-    a = np_as_located_field(IDim)(np.ones((size,)))
-    c = np_as_located_field(IDim)(np.zeros((size,)))
-    d = np_as_located_field(IDim)(np.zeros((size,)))
-
-    @field_operator
-    def conditional_tuple(
-        mask: Field[[IDim], bool], a: Field[[IDim], float64]
-    ) -> tuple[Field[[IDim], float64], Field[[IDim], float64]]:
-        return where(mask, (a, 3.0), (2.0, 7.0))
-
-    @program
-    def conditional_tuple_p(
-        mask: Field[[IDim], bool],
-        a: Field[[IDim], float64],
-        c: Field[[IDim], float64],
-        d: Field[[IDim], float64],
-    ):
-        conditional_tuple(mask, a, out=(c, d))
-
-    conditional_tuple_p(mask, a, c, d, offset_provider={})
-
-    assert np.allclose(
-        np.where(mask, (a, np.full(size, 3.0)), (np.full(size, 2.0), np.full(size, 7.0))), (c, d)
-    )
-
-
-def test_conditional_nested_tuple():
-    size = 10
-    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
-    mask.array()[0 : (size // 2)] = True
-    a = np_as_located_field(IDim)(np.ones((size,)))
-    b = np_as_located_field(IDim)(np.ones((size,)))
-    c = np_as_located_field(IDim)(np.zeros((size,)))
-    d = np_as_located_field(IDim)(np.zeros((size,)))
-
-    @field_operator
-    def conditional_tuple_3_field_op(
-        mask: Field[[IDim], bool], a: Field[[IDim], float64], b: Field[[IDim], float64]
-    ) -> tuple[
-        tuple[Field[[IDim], float64], Field[[IDim], float64]],
-        tuple[Field[[IDim], float64], Field[[IDim], float64]],
-    ]:
-        return where(mask, ((a, b), (b, a)), ((5.0, 7.0), (7.0, 5.0)))
-
-    conditional_tuple_3_field_op(mask, a, b, out=((c, d), (d, c)), offset_provider={})
-
-    assert np.allclose(
-        np.where(
-            mask,
-            ((a, b), (b, a)),
-            ((np.full(size, 5.0), np.full(size, 7.0)), (np.full(size, 7.0), np.full(size, 5.0))),
-        ),
-        ((c, d), (d, c)),
-    )
-
-
 def test_nested_scalar_arg(fieldview_backend):
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.skip("ConstantFields are not supported yet.")
-    Vertex = Dimension("Vertex")
-    size = 5
+
     inp = 5.0
     out = np_as_located_field(Vertex)(np.zeros([size]))
 
@@ -611,9 +201,7 @@ def test_nested_scalar_arg(fieldview_backend):
 def test_scalar_arg_with_field(fieldview_backend):
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.skip("IndexFields and ConstantFields are not supported yet.")
-    Edge = Dimension("Edge")
-    EdgeOffset = FieldOffset("EdgeOffset", source=Edge, target=(Edge,))
-    size = 5
+
     inp = index_field(Edge, dtype=float64)
     factor = 3.0
     out = np_as_located_field(Edge)(np.zeros((size), dtype=np.float64))
@@ -635,159 +223,10 @@ def test_scalar_arg_with_field(fieldview_backend):
     assert np.allclose(ref, out.array())
 
 
-def test_broadcast_simple(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim)(np.arange(0, size, 1, dtype=int64))
-    out = np_as_located_field(IDim, JDim)(np.zeros((size, size), dtype=int64))
-
-    @field_operator(backend=fieldview_backend)
-    def simple_broadcast(inp: Field[[IDim], int64]) -> Field[[IDim, JDim], int64]:
-        return broadcast(inp, (IDim, JDim))
-
-    simple_broadcast(a, out=out, offset_provider={})
-
-    assert np.allclose(a.array()[:, np.newaxis], out)
-
-
-def test_broadcast_scalar(fieldview_backend):
-    size = 10
-    out = np_as_located_field(IDim)(np.zeros((size)))
-
-    @field_operator(backend=fieldview_backend)
-    def scalar_broadcast() -> Field[[IDim], float64]:
-        return broadcast(float(1.0), (IDim,))
-
-    scalar_broadcast(out=out, offset_provider={})
-
-    assert np.allclose(1, out)
-
-
-def test_broadcast_two_fields(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim)(np.arange(0, size, 1, dtype=int64))
-    b = np_as_located_field(JDim)(np.arange(0, size, 1, dtype=int64))
-
-    out = np_as_located_field(IDim, JDim)(np.zeros((size, size), dtype=int64))
-
-    @field_operator(backend=fieldview_backend)
-    def broadcast_two_fields(
-        inp1: Field[[IDim], int64], inp2: Field[[JDim], int64]
-    ) -> Field[[IDim, JDim], int64]:
-        a = broadcast(inp1, (IDim, JDim))
-        b = broadcast(inp2, (IDim, JDim))
-        return a + b
-
-    broadcast_two_fields(a, b, out=out, offset_provider={})
-
-    expected = a.array()[:, np.newaxis] + b.array()[np.newaxis, :]
-
-    assert np.allclose(expected, out)
-
-
-def test_broadcast_shifted(fieldview_backend):
-    Joff = FieldOffset("Joff", source=JDim, target=(JDim,))
-
-    size = 10
-    a = np_as_located_field(IDim)(np.arange(0, size, 1, dtype=int))
-    out = np_as_located_field(IDim, JDim)(np.zeros((size, size), dtype=int64))
-
-    @field_operator(backend=fieldview_backend)
-    def simple_broadcast(inp: Field[[IDim], int64]) -> Field[[IDim, JDim], int64]:
-        bcasted = broadcast(inp, (IDim, JDim))
-        return bcasted(Joff[1])
-
-    simple_broadcast(a, out=out, offset_provider={"Joff": JDim})
-
-    assert np.allclose(a.array()[:, np.newaxis], out)
-
-
-def test_conditional(fieldview_backend):
-    size = 10
-    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
-    mask.array()[0 : (size // 2)] = True
-    a = np_as_located_field(IDim)(np.ones((size,)))
-    b = np_as_located_field(IDim)(2 * np.ones((size,)))
-    out = np_as_located_field(IDim)(np.zeros((size,)))
-
-    @field_operator(backend=fieldview_backend)
-    def conditional(
-        mask: Field[[IDim], bool], a: Field[[IDim], float64], b: Field[[IDim], float64]
-    ) -> Field[[IDim], float64]:
-        return where(mask, a, b)
-
-    conditional(mask, a, b, out=out, offset_provider={})
-
-    assert np.allclose(np.where(mask, a, b), out)
-
-
-def test_conditional_promotion(fieldview_backend):
-    size = 10
-    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
-    mask.array()[0 : (size // 2)] = True
-    a = np_as_located_field(IDim)(np.ones((size,)))
-    out = np_as_located_field(IDim)(np.zeros((size,)))
-
-    @field_operator(backend=fieldview_backend)
-    def conditional_promotion(
-        mask: Field[[IDim], bool], a: Field[[IDim], float64]
-    ) -> Field[[IDim], float64]:
-        return where(mask, a, 10.0)
-
-    conditional_promotion(mask, a, out=out, offset_provider={})
-
-    assert np.allclose(np.where(mask, a, 10), out)
-
-
-def test_conditional_compareop(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size,)))
-    out = np_as_located_field(IDim)(np.zeros((size,)))
-
-    @field_operator(backend=fieldview_backend)
-    def conditional_promotion(a: Field[[IDim], float64]) -> Field[[IDim], float64]:
-        return where(a != a, a, 10.0)
-
-    conditional_promotion(a, out=out, offset_provider={})
-
-    assert np.allclose(np.where(np.asarray(a) != np.asarray(a), a, 10), out)
-
-
-def test_conditional_shifted(fieldview_backend):
-    Ioff = FieldOffset("Ioff", source=IDim, target=(IDim,))
-
-    size = 10
-    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
-    mask.array()[size // 2] = True
-    a = np_as_located_field(IDim)(np.arange(0, size, 1, dtype=float64))
-    b = np_as_located_field(IDim)(np.zeros((size,)))
-    out = np_as_located_field(IDim)(np.zeros((size,)))
-
-    @field_operator()
-    def conditional_shifted(
-        mask: Field[[IDim], bool], a: Field[[IDim], float64], b: Field[[IDim], float64]
-    ) -> Field[[IDim], float64]:
-        tmp = where(mask, a, b)
-        return tmp(Ioff[1])
-
-    @program(backend=fieldview_backend)
-    def conditional_program(
-        mask: Field[[IDim], bool],
-        a: Field[[IDim], float64],
-        b: Field[[IDim], float64],
-        out: Field[[IDim], float64],
-    ):
-        conditional_shifted(mask, a, b, out=out[:-1])
-
-    conditional_program(mask, a, b, out, offset_provider={"Ioff": IDim})
-
-    assert np.allclose(np.where(mask, a, b)[1:], out.array()[:-1])
-
-
 def test_nested_tuple_return():
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size,)))
-    b = np_as_located_field(IDim)(2 * np.ones((size,)))
-    out = np_as_located_field(IDim)(np.zeros((size,)))
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
 
     @field_operator
     def pack_tuple(
@@ -800,9 +239,9 @@ def test_nested_tuple_return():
         packed = pack_tuple(a, b)
         return packed[0] + packed[1][0] + packed[1][1]
 
-    combine(a, b, out=out, offset_provider={})
+    combine(a_I_float, b_I_float, out=out_I_float, offset_provider={})
 
-    assert np.allclose(2 * a.array() + b.array(), out)
+    assert np.allclose(2 * a_I_float.array() + b_I_float.array(), out_I_float)
 
 
 def test_tuple_return_2(reduction_setup):
@@ -843,7 +282,6 @@ def test_tuple_with_local_field_in_reduction_shifted(reduction_setup):
     num_vertices = rs.num_vertices
     num_edges = rs.num_edges
 
-    size = 10
     # TODO(tehrengruber): use different values per location
     a = np_as_located_field(Edge)(np.ones((num_edges,)))
     b = np_as_located_field(Vertex)(2 * np.ones((num_vertices,)))
@@ -872,12 +310,12 @@ def test_tuple_with_local_field_in_reduction_shifted(reduction_setup):
 
 
 def test_tuple_arg(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
+
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.skip("Tuple arguments are not supported in gtfn yet.")
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size,)))
-    b = np_as_located_field(IDim)(2 * np.ones((size,)))
-    out = np_as_located_field(IDim)(np.zeros((size,)))
 
     @field_operator(backend=fieldview_backend)
     def unpack_tuple(
@@ -885,15 +323,15 @@ def test_tuple_arg(fieldview_backend):
     ) -> Field[[IDim], float64]:
         return 3.0 * inp[0][0] + inp[0][1] + inp[1]
 
-    unpack_tuple(((a, b), a), out=out, offset_provider={})
+    unpack_tuple(((a_I_float, b_I_float), a_I_float), out=out_I_float, offset_provider={})
 
-    assert np.allclose(3 * a.array() + b.array() + a.array(), out)
+    assert np.allclose(3 * a_I_float.array() + b_I_float.array() + a_I_float.array(), out_I_float)
 
 
 @pytest.mark.parametrize("forward", [True, False])
 def test_fieldop_from_scan(fieldview_backend, forward):
-    KDim = Dimension("K", kind=DimensionKind.VERTICAL)
-    size = 10
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.xfail("gtfn does not yet support scan pass.")
     init = 1.0
     out = np_as_located_field(KDim)(np.zeros((size,)))
     expected = np.arange(init + 1.0, init + 1.0 + size, 1)
@@ -917,7 +355,6 @@ def test_solve_triag(fieldview_backend):
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.xfail("gtfn does not yet support scan pass.")
 
-    KDim = Dimension("K", kind=DimensionKind.VERTICAL)
     shape = (3, 7, 5)
     rng = np.random.default_rng()
     a_np, b_np, c_np, d_np = (rng.normal(size=shape) for _ in range(4))
@@ -961,11 +398,9 @@ def test_solve_triag(fieldview_backend):
 
 
 def test_ternary_operator():
-    size = 10
-
-    a = np_as_located_field(IDim)(2 * np.ones((size,)))
-    b = np_as_located_field(IDim)(2 * np.ones((size,)))
-    out = np_as_located_field(IDim)(np.zeros((size,)))
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
 
     left = 2.0
     right = 3.0
@@ -976,25 +411,24 @@ def test_ternary_operator():
     ) -> Field[[IDim], float]:
         return a if left < right else b
 
-    ternary_field_op(a, b, left, right, out=out, offset_provider={})
-    e = np.asarray(a) if left < right else np.asarray(b)
-    np.allclose(e, out)
+    ternary_field_op(a_I_float, b_I_float, left, right, out=out_I_float, offset_provider={})
+    e = np.asarray(a_I_float) if left < right else np.asarray(b_I_float)
+    np.allclose(e, out_I_float)
 
     @field_operator
     def ternary_field_op_scalars(left: float, right: float) -> Field[[IDim], float]:
         return broadcast(3.0, (IDim,)) if left > right else broadcast(4.0, (IDim,))
 
-    ternary_field_op_scalars(left, right, out=out, offset_provider={})
+    ternary_field_op_scalars(left, right, out=out_I_float, offset_provider={})
     e = np.full(e.shape, 3.0) if left > right else e
-    np.allclose(e, out)
+    np.allclose(e, out_I_float)
 
 
 def test_ternary_operator_tuple():
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size,)))
-    b = np_as_located_field(IDim)(2 * np.ones((size,)))
-    out_1 = np_as_located_field(IDim)(np.zeros((size,)))
-    out_2 = np_as_located_field(IDim)(np.zeros((size,)))
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
+    out_I_float_1 = np_as_located_field(IDim)(np.zeros((size), dtype=float64))
 
     left = 2.0
     right = 3.0
@@ -1005,11 +439,17 @@ def test_ternary_operator_tuple():
     ) -> tuple[Field[[IDim], float], Field[[IDim], float]]:
         return (a, b) if left < right else (b, a)
 
-    ternary_field_op(a, b, left, right, out=(out_1, out_2), offset_provider={})
+    ternary_field_op(
+        a_I_float, b_I_float, left, right, out=(out_I_float, out_I_float_1), offset_provider={}
+    )
 
-    e, f = (np.asarray(a), np.asarray(b)) if left < right else (np.asarray(b), np.asarray(a))
-    np.allclose(e, out_1)
-    np.allclose(f, out_2)
+    e, f = (
+        (np.asarray(a_I_float), np.asarray(b_I_float))
+        if left < right
+        else (np.asarray(b_I_float), np.asarray(a_I_float))
+    )
+    np.allclose(e, out_I_float)
+    np.allclose(f, out_I_float_1)
 
 
 def test_ternary_builtin_neighbor_sum(reduction_setup):
@@ -1043,8 +483,6 @@ def test_ternary_builtin_neighbor_sum(reduction_setup):
 
 
 def test_ternary_scan():
-    KDim = Dimension("K", kind=DimensionKind.VERTICAL)
-    size = 10
     init = 0.0
     a_float = 4
     a = np_as_located_field(KDim)(a_float * np.ones((size,)))
@@ -1065,8 +503,6 @@ def test_scan_nested_tuple_output(fieldview_backend, forward):
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.xfail("gtfn does not yet support scan pass or tuple out arguments.")
 
-    KDim = Dimension("K", kind=DimensionKind.VERTICAL)
-    size = 10
     init = (1.0, (2.0, 3.0))
     out1, out2, out3 = (np_as_located_field(KDim)(np.zeros((size,))) for _ in range(3))
     expected = np.arange(1.0, 1.0 + size, 1)
@@ -1091,8 +527,6 @@ def test_scan_nested_tuple_input(fieldview_backend, forward):
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.xfail("gtfn does not yet support scan pass or tuple arguments.")
 
-    KDim = Dimension("K", kind=DimensionKind.VERTICAL)
-    size = 10
     init = 1.0
     inp1 = np_as_located_field(KDim)(np.ones(size))
     inp2 = np_as_located_field(KDim)(np.arange(0.0, size, 1))
@@ -1116,8 +550,7 @@ def test_scan_nested_tuple_input(fieldview_backend, forward):
 
 
 def test_docstring():
-    size = 10
-    a = np_as_located_field(IDim)(np.ones((size,)))
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
 
     @field_operator
     def fieldop_with_docstring(a: Field[[IDim], float64]) -> Field[[IDim], float64]:
@@ -1129,12 +562,11 @@ def test_docstring():
         """My docstring."""
         fieldop_with_docstring(a, out=a)
 
-    test_docstring(a, offset_provider={})
+    test_docstring(a_I_float, offset_provider={})
 
 
 def test_domain(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim, JDim)(np.ones((size, size)))
+    a_IJ_float = np_as_located_field(IDim, JDim)(np.ones((size, size), dtype=float64))
 
     @field_operator(backend=fieldview_backend)
     def fieldop_domain(a: Field[[IDim, JDim], float64]) -> Field[[IDim, JDim], float64]:
@@ -1144,20 +576,19 @@ def test_domain(fieldview_backend):
     def program_domain(a: Field[[IDim, JDim], float64]):
         fieldop_domain(a, out=a, domain={IDim: (1, 9), JDim: (4, 6)})
 
-    program_domain(a, offset_provider={})
+    program_domain(a_IJ_float, offset_provider={})
 
-    expected = np.asarray(a)
+    expected = np.asarray(a_IJ_float)
     expected[1:9, 4:6] = 1 + 1
 
-    assert np.allclose(expected, a)
+    assert np.allclose(expected, a_IJ_float)
 
 
 def test_domain_input_bounds(fieldview_backend):
     if fieldview_backend == gtfn_cpu.run_gtfn:
-        pytest.skip("FloorDiv and Power not fully supported in gtfn.")
+        pytest.skip("FloorDiv not fully supported in gtfn.")
+    a_IJ_float = np_as_located_field(IDim, JDim)(np.ones((size, size), dtype=float64))
 
-    size = 10
-    a = np_as_located_field(IDim, JDim)(np.ones((size, size)))
     lower_i = 1
     upper_i = 9
     lower_j = 4
@@ -1181,17 +612,17 @@ def test_domain_input_bounds(fieldview_backend):
             domain={IDim: (lower_i, upper_i // 1), JDim: (lower_j**1, upper_j)},
         )
 
-    program_domain(a, lower_i, upper_i, lower_j, upper_j, offset_provider={})
+    program_domain(a_IJ_float, lower_i, upper_i, lower_j, upper_j, offset_provider={})
 
-    expected = np.asarray(a)
+    expected = np.asarray(a_IJ_float)
     expected[1:9, 4:6] = 1 + 1
 
-    assert np.allclose(expected, a)
+    assert np.allclose(expected, a_IJ_float)
 
 
 def test_domain_input_bounds_1(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim, JDim)(np.ones((size, size)) * 2)
+    a_IJ_float = np_as_located_field(IDim, JDim)(np.ones((size, size), dtype=float64))
+
     lower_i = 1
     upper_i = 9
     lower_j = 4
@@ -1215,18 +646,17 @@ def test_domain_input_bounds_1(fieldview_backend):
             domain={IDim: (1 * lower_i, upper_i + 0), JDim: (lower_j - 0, upper_j)},
         )
 
-    program_domain(a, lower_i, upper_i, lower_j, upper_j, offset_provider={})
+    program_domain(a_IJ_float, lower_i, upper_i, lower_j, upper_j, offset_provider={})
 
-    expected = np.asarray(a)
+    expected = np.asarray(a_IJ_float)
     expected[1:9, 4:6] = 2 * 2
 
-    assert np.allclose(expected, a)
+    assert np.allclose(expected, a_IJ_float)
 
 
 def test_domain_tuple(fieldview_backend):
-    size = 10
-    a = np_as_located_field(IDim, JDim)(np.ones((size, size)))
-    b = np_as_located_field(IDim, JDim)(np.ones((size, size)))
+    a_IJ_float = np_as_located_field(IDim, JDim)(np.ones((size, size), dtype=float64))
+    b2d_float = a_IJ_float
 
     @field_operator(backend=fieldview_backend)
     def fieldop_domain_tuple(
@@ -1238,21 +668,18 @@ def test_domain_tuple(fieldview_backend):
     def program_domain_tuple(a: Field[[IDim, JDim], float64], b: Field[[IDim, JDim], float64]):
         fieldop_domain_tuple(a, out=(b, a), domain={IDim: (1, 9), JDim: (4, 6)})
 
-    program_domain_tuple(a, b, offset_provider={})
+    program_domain_tuple(a_IJ_float, b2d_float, offset_provider={})
 
-    expected = np.asarray(a)
+    expected = np.asarray(a_IJ_float)
     expected[1:9, 4:6] = 1 + 1
 
-    assert np.allclose(np.asarray(a), a)
-    assert np.allclose(expected, b)
+    assert np.allclose(np.asarray(a_IJ_float), a_IJ_float)
+    assert np.allclose(expected, b2d_float)
 
 
 def test_where_k_offset(fieldview_backend):
     if fieldview_backend == gtfn_cpu.run_gtfn:
         pytest.skip("IndexFields are not supported yet.")
-    size = 10
-    KDim = Dimension("K", kind=DimensionKind.VERTICAL)
-    Koff = FieldOffset("Koff", source=KDim, target=(KDim,))
     a = np_as_located_field(IDim, KDim)(np.ones((size, size)))
     out = np_as_located_field(IDim, KDim)(np.zeros((size, size)))
     k_index = index_field(KDim)
diff --git a/tests/functional_tests/ffront_tests/test_gt4py_builtins.py b/tests/functional_tests/ffront_tests/test_gt4py_builtins.py
new file mode 100644
index 00000000..7e08e403
--- /dev/null
+++ b/tests/functional_tests/ffront_tests/test_gt4py_builtins.py
@@ -0,0 +1,362 @@
+# -*- coding: utf-8 -*-
+#
+# GT4Py Project - GridTools Framework
+#
+# Copyright (c) 2014-2021, ETH Zurich
+# All rights reserved.
+#
+# This file is part of the GT4Py project and the GridTools framework.
+# GT4Py is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or any later
+# version. See the LICENSE.txt file at the top-level directory of this
+# distribution for a copy of the license or check <https://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+from functional.ffront.decorator import field_operator, program
+from functional.ffront.fbuiltins import (
+    Field,
+    broadcast,
+    float64,
+    int64,
+    max_over,
+    min_over,
+    neighbor_sum,
+    where,
+)
+
+from .ffront_test_utils import *
+
+
+def test_maxover_execution(reduction_setup, fieldview_backend):
+    """Testing max_over functionality."""
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("not yet supported.")
+
+    rs = reduction_setup
+    Vertex, V2EDim = rs.Vertex, rs.V2EDim
+    inp_field = np_as_located_field(Vertex, V2EDim)(rs.v2e_table)
+
+    @field_operator(backend=fieldview_backend)
+    def maxover_fieldoperator(inp_field: Field[[Vertex, V2EDim], int64]) -> Field[[Vertex], int64]:
+        return max_over(inp_field, axis=V2EDim)
+
+    maxover_fieldoperator(inp_field, out=rs.out, offset_provider=rs.offset_provider)
+
+    ref = np.max(rs.v2e_table, axis=1)
+    assert np.allclose(ref, rs.out)
+
+
+def test_maxover_execution_negatives(reduction_setup, fieldview_backend):
+    """Testing max_over functionality for negative values in array."""
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("not yet supported.")
+
+    rs = reduction_setup
+    Vertex, V2EDim, V2E = rs.Vertex, rs.V2EDim, rs.V2E
+    Edge = rs.Edge
+    edge_num = np.max(rs.v2e_table)
+    inp_field_arr = np.arange(-edge_num // 2, edge_num // 2 + 1, 1, dtype=int)
+    inp_field = np_as_located_field(Edge)(inp_field_arr)
+
+    @field_operator(backend=fieldview_backend)
+    def maxover_negvals(edge_f: Field[[Edge], int64]) -> Field[[Vertex], int64]:
+        out = max_over(edge_f(V2E), axis=V2EDim)
+        return out
+
+    maxover_negvals(inp_field, out=rs.out, offset_provider=rs.offset_provider)
+
+    ref = np.max(inp_field_arr[rs.v2e_table], axis=1)
+    assert np.allclose(ref, rs.out)
+
+
+def test_minover_execution(reduction_setup, fieldview_backend):
+    """Testing the min_over functionality"""
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("not implemented yet")
+
+    rs = reduction_setup
+    Vertex, V2EDim = rs.Vertex, rs.V2EDim
+    in_field = np_as_located_field(Vertex, V2EDim)(rs.v2e_table)
+
+    @field_operator
+    def minover_fieldoperator(input: Field[[Vertex, V2EDim], int64]) -> Field[[Vertex], int64]:
+        return min_over(input, axis=V2EDim)
+
+    minover_fieldoperator(in_field, out=rs.out, offset_provider=rs.offset_provider)
+
+    ref = np.min(rs.v2e_table, axis=1)
+    assert np.allclose(ref, rs.out)
+
+
+def test_minover_execution_float(reduction_setup, fieldview_backend):
+    """Testing the min_over functionality"""
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("not implemented yet")
+
+    rs = reduction_setup
+    Vertex, V2EDim = rs.Vertex, rs.V2EDim
+    in_array = np.random.default_rng().uniform(low=-1, high=1, size=rs.v2e_table.shape)
+    in_field = np_as_located_field(Vertex, V2EDim)(in_array)
+    out_field = np_as_located_field(Vertex)(np.zeros(rs.num_vertices))
+
+    @field_operator
+    def minover_fieldoperator(input: Field[[Vertex, V2EDim], float64]) -> Field[[Vertex], float64]:
+        return min_over(input, axis=V2EDim)
+
+    minover_fieldoperator(in_field, out=out_field, offset_provider=rs.offset_provider)
+
+    ref = np.min(in_array, axis=1)
+    assert np.allclose(ref, out_field)
+
+
+def test_reduction_execution(reduction_setup, fieldview_backend):
+    """Testing a trivial neighbor sum."""
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("IndexFields are not supported yet.")
+
+    rs = reduction_setup
+    Edge = rs.Edge
+    Vertex, V2EDim, V2E = rs.Vertex, rs.V2EDim, rs.V2E
+
+    @field_operator
+    def reduction(edge_f: Field[[Edge], int64]) -> Field[[Vertex], int64]:
+        return neighbor_sum(edge_f(V2E), axis=V2EDim)
+
+    @program(backend=fieldview_backend)
+    def fencil(edge_f: Field[[Edge], int64], out: Field[[Vertex], int64]) -> None:
+        reduction(edge_f, out=out)
+
+    fencil(rs.inp, rs.out, offset_provider=rs.offset_provider)
+
+    ref = np.sum(rs.v2e_table, axis=1)
+    assert np.allclose(ref, rs.out)
+
+
+def test_reduction_execution_nb(reduction_setup, fieldview_backend):
+    """Testing a neighbor sum on a neighbor field."""
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("not yet supported.")
+
+    rs = reduction_setup
+    Vertex, V2EDim = rs.Vertex, rs.V2EDim
+    nb_field = np_as_located_field(Vertex, V2EDim)(rs.v2e_table)
+
+    @field_operator(backend=fieldview_backend)
+    def reduction(nb_field: Field[[Vertex, V2EDim], int64]) -> Field[[Vertex], int64]:
+        return neighbor_sum(nb_field, axis=V2EDim)
+
+    reduction(nb_field, out=rs.out, offset_provider=rs.offset_provider)
+
+    ref = np.sum(rs.v2e_table, axis=1)
+    assert np.allclose(ref, rs.out)
+
+
+def test_reduction_expression(reduction_setup, fieldview_backend):
+    """Test reduction with an expression directly inside the call."""
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("IndexFields are not supported yet.")
+
+    rs = reduction_setup
+    Vertex, V2EDim, V2E = rs.Vertex, rs.V2EDim, rs.V2E
+    Edge = rs.Edge
+
+    @field_operator
+    def reduce_expr(edge_f: Field[[Edge], int64]) -> Field[[Vertex], int64]:
+        tmp_nbh_tup = edge_f(V2E), edge_f(V2E)
+        tmp_nbh = tmp_nbh_tup[0]
+        return 3 * neighbor_sum(-edge_f(V2E) * tmp_nbh * 2, axis=V2EDim)
+
+    @program(backend=fieldview_backend)
+    def fencil(edge_f: Field[[Edge], int64], out: Field[[Vertex], int64]) -> None:
+        reduce_expr(edge_f, out=out)
+
+    fencil(rs.inp, rs.out, offset_provider=rs.offset_provider)
+
+    ref = 3 * np.sum(-(rs.v2e_table**2) * 2, axis=1)
+    assert np.allclose(ref, rs.out.array())
+
+
+def test_conditional_nested_tuple():
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float_1 = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator
+    def conditional_nested_tuple(
+        mask: Field[[IDim], bool], a: Field[[IDim], float64], b: Field[[IDim], float64]
+    ) -> tuple[
+        tuple[Field[[IDim], float64], Field[[IDim], float64]],
+        tuple[Field[[IDim], float64], Field[[IDim], float64]],
+    ]:
+        return where(mask, ((a, b), (b, a)), ((5.0, 7.0), (7.0, 5.0)))
+
+    conditional_nested_tuple(
+        mask,
+        a_I_float,
+        b_I_float,
+        out=((out_I_float, out_I_float_1), (out_I_float_1, out_I_float)),
+        offset_provider={},
+    )
+
+    expected = np.where(
+        mask,
+        ((a_I_float, b_I_float), (b_I_float, a_I_float)),
+        ((np.full(size, 5.0), np.full(size, 7.0)), (np.full(size, 7.0), np.full(size, 5.0))),
+    )
+
+    assert np.allclose(expected, ((out_I_float, out_I_float_1), (out_I_float_1, out_I_float)))
+
+
+def test_broadcast_simple(fieldview_backend):
+    a_I_int = np_as_located_field(IDim)(np.random.randn(size).astype("int64"))
+    out_IJ_int = np_as_located_field(IDim, JDim)(np.zeros((size, size), dtype=int64))
+
+    @field_operator(backend=fieldview_backend)
+    def simple_broadcast(inp: Field[[IDim], int64]) -> Field[[IDim, JDim], int64]:
+        return broadcast(inp, (IDim, JDim))
+
+    simple_broadcast(a_I_int, out=out_IJ_int, offset_provider={})
+
+    assert np.allclose(a_I_int.array()[:, np.newaxis], out_IJ_int)
+
+
+def test_broadcast_scalar(fieldview_backend):
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+
+    @field_operator(backend=fieldview_backend)
+    def scalar_broadcast() -> Field[[IDim], float64]:
+        return broadcast(float(1.0), (IDim,))
+
+    scalar_broadcast(out=out_I_float, offset_provider={})
+
+    assert np.allclose(1, out_I_float)
+
+
+def test_broadcast_two_fields(fieldview_backend):
+    a_I_int = np_as_located_field(IDim)(np.random.randn(size).astype("int64"))
+    b_J_int = np_as_located_field(JDim)(np.random.randn(size).astype("int64"))
+    out_IJ_int = np_as_located_field(IDim, JDim)(np.zeros((size, size), dtype=int64))
+
+    @field_operator(backend=fieldview_backend)
+    def broadcast_two_fields(
+        inp1: Field[[IDim], int64], inp2: Field[[JDim], int64]
+    ) -> Field[[IDim, JDim], int64]:
+        a = broadcast(inp1, (IDim, JDim))
+        b = broadcast(inp2, (IDim, JDim))
+        return a + b
+
+    broadcast_two_fields(a_I_int, b_J_int, out=out_IJ_int, offset_provider={})
+
+    expected = a_I_int.array()[:, np.newaxis] + b_J_int.array()[np.newaxis, :]
+
+    assert np.allclose(expected, out_IJ_int)
+
+
+def test_broadcast_shifted(fieldview_backend):
+    a_I_int = np_as_located_field(IDim)(np.random.randn(size).astype("int64"))
+    out_IJ_int = np_as_located_field(IDim, JDim)(np.zeros((size, size), dtype=int64))
+
+    @field_operator(backend=fieldview_backend)
+    def simple_broadcast(inp: Field[[IDim], int64]) -> Field[[IDim, JDim], int64]:
+        bcasted = broadcast(inp, (IDim, JDim))
+        return bcasted(Joff[1])
+
+    simple_broadcast(a_I_int, out=out_IJ_int, offset_provider={"Joff": JDim})
+
+    assert np.allclose(a_I_int.array()[:, np.newaxis], out_IJ_int)
+
+
+def test_conditional(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator(backend=fieldview_backend)
+    def conditional(
+        mask: Field[[IDim], bool], a: Field[[IDim], float64], b: Field[[IDim], float64]
+    ) -> Field[[IDim], float64]:
+        return where(mask, a, b)
+
+    conditional(mask, a_I_float, b_I_float, out=out_I_float, offset_provider={})
+
+    assert np.allclose(np.where(mask, a_I_float, b_I_float), out_I_float)
+
+
+def test_conditional_promotion(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator(backend=fieldview_backend)
+    def conditional_promotion(
+        mask: Field[[IDim], bool], a: Field[[IDim], float64]
+    ) -> Field[[IDim], float64]:
+        return where(mask, a, 10.0)
+
+    conditional_promotion(mask, a_I_float, out=out_I_float, offset_provider={})
+
+    assert np.allclose(np.where(mask, a_I_float, 10), out_I_float)
+
+
+def test_conditional_compareop(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+
+    @field_operator(backend=fieldview_backend)
+    def conditional_promotion(a: Field[[IDim], float64]) -> Field[[IDim], float64]:
+        return where(a != a, a, 10.0)
+
+    conditional_promotion(a_I_float, out=out_I_float, offset_provider={})
+
+    assert np.allclose(
+        np.where(np.asarray(a_I_float) != np.asarray(a_I_float), a_I_float, 10), out_I_float
+    )
+
+
+def test_conditional_shifted(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    mask = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator()
+    def conditional_shifted(
+        mask: Field[[IDim], bool], a: Field[[IDim], float64], b: Field[[IDim], float64]
+    ) -> Field[[IDim], float64]:
+        tmp = where(mask, a, b)
+        return tmp(Ioff[1])
+
+    @program(backend=fieldview_backend)
+    def conditional_program(
+        mask: Field[[IDim], bool],
+        a: Field[[IDim], float64],
+        b: Field[[IDim], float64],
+        out: Field[[IDim], float64],
+    ):
+        conditional_shifted(mask, a, b, out=out[:-1])
+
+    conditional_program(mask, a_I_float, b_I_float, out_I_float, offset_provider={"Ioff": IDim})
+
+    assert np.allclose(np.where(mask, a_I_float, b_I_float)[1:], out_I_float.array()[:-1])
+
+
+def test_promotion(fieldview_backend):
+    ksize = 5
+    a = np_as_located_field(Edge, KDim)(np.ones((size, ksize)))
+    b = np_as_located_field(KDim)(np.ones((ksize)) * 2)
+    c = np_as_located_field(Edge, KDim)(np.zeros((size, ksize)))
+
+    @field_operator(backend=fieldview_backend)
+    def promotion(
+        inp1: Field[[Edge, KDim], float64], inp2: Field[[KDim], float64]
+    ) -> Field[[Edge, KDim], float64]:
+        return inp1 / inp2
+
+    promotion(a, b, out=c, offset_provider={})
+
+    assert np.allclose((a.array() / b.array()), c)
diff --git a/tests/functional_tests/ffront_tests/test_math_unary_builtins.py b/tests/functional_tests/ffront_tests/test_math_unary_builtins.py
new file mode 100644
index 00000000..66f4dd8e
--- /dev/null
+++ b/tests/functional_tests/ffront_tests/test_math_unary_builtins.py
@@ -0,0 +1,286 @@
+# -*- coding: utf-8 -*-
+#
+# GT4Py Project - GridTools Framework
+#
+# Copyright (c) 2014-2021, ETH Zurich
+# All rights reserved.
+#
+# This file is part of the GT4Py project and the GridTools framework.
+# GT4Py is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or any later
+# version. See the LICENSE.txt file at the top-level directory of this
+# distribution for a copy of the license or check <https://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+from functional.ffront.decorator import field_operator
+from functional.ffront.fbuiltins import (
+    Field,
+    cbrt,
+    ceil,
+    cos,
+    cosh,
+    exp,
+    float64,
+    floor,
+    int64,
+    isfinite,
+    isinf,
+    isnan,
+    log,
+    sin,
+    sinh,
+    sqrt,
+    tan,
+    tanh,
+    trunc,
+)
+
+from .ffront_test_utils import *
+
+
+# Math builtins
+
+
+def test_arithmetic(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+
+    @field_operator(backend=fieldview_backend)
+    def arithmetic(
+        inp1: Field[[IDim], float64], inp2: Field[[IDim], float64]
+    ) -> Field[[IDim], float64]:
+        return (inp1 + inp2 / 3.0 - inp2) * 2.0
+
+    arithmetic(a_I_float, b_I_float, out=out_I_float, offset_provider={})
+    expected = (a_I_float.array() + b_I_float.array() / 3.0 - b_I_float.array()) * 2.0
+    assert np.allclose(expected, out_I_float)
+
+
+def test_power(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+
+    @field_operator(backend=fieldview_backend)
+    def pow(inp1: Field[[IDim], float64]) -> Field[[IDim], float64]:
+        return inp1**2
+
+    pow(a_I_float, out=out_I_float, offset_provider={})
+    assert np.allclose(a_I_float.array() ** 2, out_I_float)
+
+
+def test_floordiv(fieldview_backend):
+    a_I_int = np_as_located_field(IDim)(np.random.randn(size).astype("int64"))
+    out_I_int = np_as_located_field(IDim)(np.zeros((size,), dtype=int64))
+
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("FloorDiv not yet supported.")
+
+    @field_operator(backend=fieldview_backend)
+    def floorDiv(inp1: Field[[IDim], int64]) -> Field[[IDim], int64]:
+        return inp1 // 2
+
+    floorDiv(a_I_int, out=out_I_int, offset_provider={})
+    assert np.allclose(a_I_int.array() // 2, out_I_int)
+
+
+def test_mod(fieldview_backend):
+    a_I_int = np_as_located_field(IDim)(np.random.randn(size).astype("int64"))
+    out_I_int = np_as_located_field(IDim)(np.zeros((size,), dtype=int64))
+
+    if fieldview_backend == gtfn_cpu.run_gtfn:
+        pytest.skip("Modulo not yet supported.")
+
+    @field_operator(backend=fieldview_backend)
+    def mod_fieldop(inp1: Field[[IDim], int64]) -> Field[[IDim], int64]:
+        return inp1 % 2
+
+    mod_fieldop(a_I_int, out=out_I_int, offset_provider={})
+    assert np.allclose(a_I_int.array() % 2, out_I_int)
+
+
+def test_bit_xor(fieldview_backend):
+    a_I_bool = np_as_located_field(IDim)(np.random.randn(size).astype(bool))
+    b_I_bool = np_as_located_field(IDim)(np.random.randn(size).astype(bool))
+    out_I_bool = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator(backend=fieldview_backend)
+    def binary_xor(inp1: Field[[IDim], bool], inp2: Field[[IDim], bool]) -> Field[[IDim], bool]:
+        return inp1 ^ inp2
+
+    binary_xor(a_I_bool, b_I_bool, out=out_I_bool, offset_provider={})
+    assert np.allclose(a_I_bool.array() ^ b_I_bool.array(), out_I_bool)
+
+
+def test_bit_and(fieldview_backend):
+    a_I_bool = np_as_located_field(IDim)(np.random.randn(size).astype(bool))
+    b_I_bool = np_as_located_field(IDim)(np.random.randn(size).astype(bool))
+    out_I_bool = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator(backend=fieldview_backend)
+    def bit_and(inp1: Field[[IDim], bool], inp2: Field[[IDim], bool]) -> Field[[IDim], bool]:
+        return inp1 & inp2 & True
+
+    bit_and(a_I_bool, b_I_bool, out=out_I_bool, offset_provider={})
+    assert np.allclose(a_I_bool.array() & b_I_bool.array(), out_I_bool)
+
+
+def test_bit_or(fieldview_backend):
+    a_I_bool = np_as_located_field(IDim)(np.random.randn(size).astype(bool))
+    b_I_bool = np_as_located_field(IDim)(np.random.randn(size).astype(bool))
+    out_I_bool = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator(backend=fieldview_backend)
+    def bit_or(inp1: Field[[IDim], bool], inp2: Field[[IDim], bool]) -> Field[[IDim], bool]:
+        return inp1 | inp2 | True
+
+    bit_or(a_I_bool, b_I_bool, out=out_I_bool, offset_provider={})
+    assert np.allclose(a_I_bool.array() | b_I_bool.array(), out_I_bool)
+
+
+# Unary builtins
+
+
+def test_unary_neg(fieldview_backend):
+    a_I_int = np_as_located_field(IDim)(np.random.randn(size).astype("int64"))
+    out_I_int = np_as_located_field(IDim)(np.zeros((size,), dtype=int64))
+
+    @field_operator(backend=fieldview_backend)
+    def uneg(inp: Field[[IDim], int64]) -> Field[[IDim], int64]:
+        return -inp
+
+    uneg(a_I_int, out=out_I_int, offset_provider={})
+    assert np.allclose(-a_I_int.array(), out_I_int)
+
+
+def test_unary_invert(fieldview_backend):
+    a_I_bool = np_as_located_field(IDim)(np.random.randn(size).astype(bool))
+    out_I_bool = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator(backend=fieldview_backend)
+    def tilde_fieldop(inp1: Field[[IDim], bool]) -> Field[[IDim], bool]:
+        return ~inp1
+
+    tilde_fieldop(a_I_bool, out=out_I_bool, offset_provider={})
+    assert np.allclose(~a_I_bool.array(), out_I_bool)
+
+
+def test_unary_not(fieldview_backend):
+    a_I_bool = np_as_located_field(IDim)(np.random.randn(size).astype(bool))
+    out_I_bool = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator(backend=fieldview_backend)
+    def not_fieldop(inp1: Field[[IDim], bool]) -> Field[[IDim], bool]:
+        return not inp1
+
+    not_fieldop(a_I_bool, out=out_I_bool, offset_provider={})
+    assert np.allclose(~a_I_bool.array(), out_I_bool)
+
+
+# Trig builtins
+
+
+def test_basic_trig(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+
+    @field_operator(backend=fieldview_backend)
+    def basic_trig_fieldop(
+        inp1: Field[[IDim], float64], inp2: Field[[IDim], float64]
+    ) -> Field[[IDim], float64]:
+        return sin(cos(inp1)) - sinh(cosh(inp2)) + tan(inp1) - tanh(inp2)
+
+    basic_trig_fieldop(a_I_float, b_I_float, out=out_I_float, offset_provider={})
+
+    expected = (
+        np.sin(np.cos(a_I_float))
+        - np.sinh(np.cosh(b_I_float))
+        + np.tan(a_I_float)
+        - np.tanh(b_I_float)
+    )
+    assert np.allclose(expected, out_I_float)
+
+
+def test_exp_log(fieldview_backend):
+    a_float = np_as_located_field(IDim)(np.ones((size)))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+
+    @field_operator(backend=fieldview_backend)
+    def exp_log_fieldop(
+        inp1: Field[[IDim], float64], inp2: Field[[IDim], float64]
+    ) -> Field[[IDim], float64]:
+        return log(inp1) - exp(inp2)
+
+    exp_log_fieldop(a_float, b_I_float, out=out_I_float, offset_provider={})
+
+    expected = np.log(a_float) - np.exp(b_I_float)
+    assert np.allclose(expected, out_I_float)
+
+
+def test_roots(fieldview_backend):
+    a_float = np_as_located_field(IDim)(np.ones((size)))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+
+    @field_operator(backend=fieldview_backend)
+    def roots_fieldop(
+        inp1: Field[[IDim], float64], inp2: Field[[IDim], float64]
+    ) -> Field[[IDim], float64]:
+        return sqrt(inp1) - cbrt(inp2)
+
+    roots_fieldop(a_float, b_I_float, out=out_I_float, offset_provider={})
+
+    expected = np.sqrt(a_float) - np.cbrt(b_I_float)
+    assert np.allclose(expected, out_I_float)
+
+
+def test_is_values(fieldview_backend):
+    out_bool_1 = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+    out_bool_2 = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_bool = np_as_located_field(IDim)(np.zeros((size,), dtype=bool))
+
+    @field_operator(backend=fieldview_backend)
+    def is_isinf_fieldop(inp1: Field[[IDim], float64]) -> Field[[IDim], bool]:
+        return isinf(inp1)
+
+    is_isinf_fieldop(a_I_float, out=out_I_bool, offset_provider={})
+    expected = np.isinf(a_I_float)
+    assert np.allclose(expected, out_I_bool)
+
+    @field_operator(backend=fieldview_backend)
+    def is_isnan_fieldop(inp1: Field[[IDim], float64]) -> Field[[IDim], bool]:
+        return isnan(inp1)
+
+    is_isnan_fieldop(a_I_float, out=out_bool_1, offset_provider={})
+    expected = np.isnan(a_I_float)
+    assert np.allclose(expected, out_bool_1)
+
+    @field_operator(backend=fieldview_backend)
+    def is_isfinite_fieldop(inp1: Field[[IDim], float64]) -> Field[[IDim], bool]:
+        return isfinite(inp1)
+
+    is_isfinite_fieldop(a_I_float, out=out_bool_2, offset_provider={})
+    expected = np.isfinite(a_I_float)
+    assert np.allclose(expected, out_bool_2)
+
+
+def test_rounding_funs(fieldview_backend):
+    a_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    b_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+    out_I_float = np_as_located_field(IDim)(np.random.randn(size).astype("float64"))
+
+    @field_operator(backend=fieldview_backend)
+    def rounding_funs_fieldop(
+        inp1: Field[[IDim], float64], inp2: Field[[IDim], float64]
+    ) -> Field[[IDim], float64]:
+        return floor(inp1) - ceil(inp2) + trunc(inp1)
+
+    rounding_funs_fieldop(a_I_float, b_I_float, out=out_I_float, offset_provider={})
+
+    expected = np.floor(a_I_float) - np.ceil(b_I_float) + np.trunc(a_I_float)
+    assert np.allclose(expected, out_I_float)
diff --git a/tests/functional_tests/ffront_tests/test_type_deduction.py b/tests/functional_tests/ffront_tests/test_type_deduction.py
index 58ff835c..65c90326 100644
--- a/tests/functional_tests/ffront_tests/test_type_deduction.py
+++ b/tests/functional_tests/ffront_tests/test_type_deduction.py
@@ -646,3 +646,22 @@ def test_where_mixed_dims():
             ),
         ]
     )
+
+
+def test_mod_floats():
+    def modulo_floats(inp: Field[..., float]):
+        return inp % 3.0
+
+    with pytest.raises(
+        FieldOperatorTypeDeductionError,
+        match=r"Type float64 can not be used in operator `%`",
+    ):
+        _ = FieldOperatorParser.apply_to_function(modulo_floats)
+
+
+def test_undefined_symbols():
+    def return_undefined():
+        return undefined_symbol
+
+    with pytest.raises(FieldOperatorTypeDeductionError, match="Undeclared symbol"):
+        _ = FieldOperatorParser.apply_to_function(return_undefined)