From d50c3ebdcab35a996783f904572f315e47ce1876 Mon Sep 17 00:00:00 2001
From: AzeezIsh <azishaqui@gmail.com>
Date: Wed, 20 Mar 2024 13:13:39 -0400
Subject: [PATCH 1/5] Adding logical tests

Added several logical tests
---
 tests/test_logical.py | 113 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
 create mode 100644 tests/test_logical.py

diff --git a/tests/test_logical.py b/tests/test_logical.py
new file mode 100644
index 0000000..4cb3105
--- /dev/null
+++ b/tests/test_logical.py
@@ -0,0 +1,113 @@
+import random
+
+import numpy as np
+import pytest
+
+import arrayfire_wrapper.dtypes as dtype
+import arrayfire_wrapper.lib as wrapper
+
+from arrayfire_wrapper.lib.create_and_modify_array.helper_functions import array_to_string
+
+dtype_map = {
+    "int16": dtype.s16,
+    "int32": dtype.s32,
+    "int64": dtype.s64,
+    "uint8": dtype.u8,
+    "uint16": dtype.u16,
+    "uint32": dtype.u32,
+    "uint64": dtype.u64,
+    "float16": dtype.f16,
+    "float32": dtype.f32,
+    # 'float64': dtype.f64,
+    # 'complex64': dtype.c64,
+    "complex32": dtype.c32,
+    "bool": dtype.b8,
+    "s16": dtype.s16,
+    "s32": dtype.s32,
+    "s64": dtype.s64,
+    "u8": dtype.u8,
+    "u16": dtype.u16,
+    "u32": dtype.u32,
+    "u64": dtype.u64,
+    "f16": dtype.f16,
+    "f32": dtype.f32,
+    # 'f64': dtype.f64,
+    "c32": dtype.c32,
+    # 'c64': dtype.c64,
+    "b8": dtype.b8,
+}
+
+
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_and_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test and_ operation between two arrays of the same shape"""
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.and_(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_and_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test and_ operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+
+        result = wrapper.and_(lhs, rhs)
+
+        assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {invdtypes}"  # noqa
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_bitandshape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test bitand operation between two arrays of the same shape"""
+    print(dtype_name)
+    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+        pytest.skip()
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.bitand(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_bitandshapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test bitand operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
\ No newline at end of file

From 430ad1a4496b052c9ec42ea3084a08fc9a3dce11 Mon Sep 17 00:00:00 2001
From: AzeezIsh <azishaqui@gmail.com>
Date: Wed, 20 Mar 2024 14:08:49 -0400
Subject: [PATCH 2/5] Completed all logical operations tests

Tested for shapes and datatypes
---
 tests/test_logical.py | 391 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 387 insertions(+), 4 deletions(-)

diff --git a/tests/test_logical.py b/tests/test_logical.py
index 4cb3105..056868a 100644
--- a/tests/test_logical.py
+++ b/tests/test_logical.py
@@ -86,9 +86,8 @@ def test_and_shapes_invalid(invdtypes: dtype.Dtype) -> None:
     ],
 )
 @pytest.mark.parametrize("dtype_name", dtype_map.values())
-def test_bitandshape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+def test_bitand_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitand operation between two arrays of the same shape"""
-    print(dtype_name)
     if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
         pytest.skip()
     lhs = wrapper.randu(shape, dtype_name)
@@ -105,9 +104,393 @@ def test_bitandshape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
         dtype.f64,
     ],
 )
-def test_bitandshapes_invalid(invdtypes: dtype.Dtype) -> None:
+def test_bitand_shapes_invalid(invdtypes: dtype.Dtype) -> None:
     """Test bitand operation between two arrays of the same shape"""
     with pytest.raises(RuntimeError):
         shape = (3, 3)
         lhs = wrapper.randu(shape, invdtypes)
-        rhs = wrapper.randu(shape, invdtypes)
\ No newline at end of file
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.bitand(lhs, rhs)
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_bitnot_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test bitnot operation between two arrays of the same shape"""
+    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+        pytest.skip()
+    out = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.bitnot(out)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_bitnot_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test bitnot operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        out = wrapper.randu(shape, invdtypes)
+        wrapper.bitnot(out)
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_bitor_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test bitor operation between two arrays of the same shape"""
+    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+        pytest.skip()
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.bitor(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_bitor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test bitor operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.bitor(lhs, rhs)
+
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_bitxor_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test bitxor operation between two arrays of the same shape"""
+    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+        pytest.skip()
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.bitxor(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_bitxor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test bitxor operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.bitxor(lhs, rhs)
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_eq_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test eq operation between two arrays of the same shape"""
+    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+        pytest.skip()
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.eq(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_eq_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test eq operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.eq(lhs, rhs)
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_ge_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test >= operation between two arrays of the same shape"""
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.ge(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_ge_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test >= operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.ge(lhs, rhs)
+
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_gt_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test > operation between two arrays of the same shape"""
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.gt(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_gt_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test > operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.gt(lhs, rhs)
+
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_le_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test <= operation between two arrays of the same shape"""
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.le(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_le_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test <= operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.le(lhs, rhs)
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_lt_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test < operation between two arrays of the same shape"""
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.lt(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_lt_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test < operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.lt(lhs, rhs)
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_neq_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test not equal operation between two arrays of the same shape"""
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.neq(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_neq_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test neq operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.neq(lhs, rhs)
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_not_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test not operation between two arrays of the same shape"""
+    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+        pytest.skip()
+    out = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.not_(out)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_not_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test not operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        out = wrapper.randu(shape, invdtypes)
+        wrapper.not_(out)
+@pytest.mark.parametrize(
+    "shape",
+    [
+        (),
+        (random.randint(1, 10),),
+        (random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
+    ],
+)
+@pytest.mark.parametrize("dtype_name", dtype_map.values())
+def test_or_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
+    """Test or operation between two arrays of the same shape"""
+    lhs = wrapper.randu(shape, dtype_name)
+    rhs = wrapper.randu(shape, dtype_name)
+
+    result = wrapper.or_(lhs, rhs)
+
+    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+
+@pytest.mark.parametrize(
+    "invdtypes",
+    [
+        dtype.c64,
+        dtype.f64,
+    ],
+)
+def test_or_shapes_invalid(invdtypes: dtype.Dtype) -> None:
+    """Test or operation between two arrays of the same shape"""
+    with pytest.raises(RuntimeError):
+        shape = (3, 3)
+        lhs = wrapper.randu(shape, invdtypes)
+        rhs = wrapper.randu(shape, invdtypes)
+        wrapper.or_(lhs, rhs)
\ No newline at end of file

From 0bc17beefccb2d993fb027bdd2765d11ef716041 Mon Sep 17 00:00:00 2001
From: AzeezIsh <azishaqui@gmail.com>
Date: Wed, 20 Mar 2024 14:13:49 -0400
Subject: [PATCH 3/5] Adhered to all checkstyle requirements.

---
 tests/test_logical.py | 143 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 119 insertions(+), 24 deletions(-)

diff --git a/tests/test_logical.py b/tests/test_logical.py
index 056868a..87c60e3 100644
--- a/tests/test_logical.py
+++ b/tests/test_logical.py
@@ -1,13 +1,10 @@
 import random
 
-import numpy as np
 import pytest
 
 import arrayfire_wrapper.dtypes as dtype
 import arrayfire_wrapper.lib as wrapper
 
-from arrayfire_wrapper.lib.create_and_modify_array.helper_functions import array_to_string
-
 dtype_map = {
     "int16": dtype.s16,
     "int32": dtype.s32,
@@ -56,7 +53,10 @@ def test_and_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
 
     result = wrapper.and_(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -74,7 +74,11 @@ def test_and_shapes_invalid(invdtypes: dtype.Dtype) -> None:
 
         result = wrapper.and_(lhs, rhs)
 
-        assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {invdtypes}"  # noqa
+        assert (
+            wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+        ), f"failed for shape: {shape} and dtype {invdtypes}"
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -88,14 +92,23 @@ def test_and_shapes_invalid(invdtypes: dtype.Dtype) -> None:
 @pytest.mark.parametrize("dtype_name", dtype_map.values())
 def test_bitand_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitand operation between two arrays of the same shape"""
-    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+    if (
+        dtype_name == dtype.c32
+        or dtype_name == dtype.c64
+        or dtype_name == dtype.f32
+        or dtype_name == dtype.f64
+        or dtype_name == dtype.f16
+    ):
         pytest.skip()
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
     result = wrapper.bitand(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -111,6 +124,8 @@ def test_bitand_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         lhs = wrapper.randu(shape, invdtypes)
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.bitand(lhs, rhs)
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -124,13 +139,22 @@ def test_bitand_shapes_invalid(invdtypes: dtype.Dtype) -> None:
 @pytest.mark.parametrize("dtype_name", dtype_map.values())
 def test_bitnot_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitnot operation between two arrays of the same shape"""
-    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+    if (
+        dtype_name == dtype.c32
+        or dtype_name == dtype.c64
+        or dtype_name == dtype.f32
+        or dtype_name == dtype.f64
+        or dtype_name == dtype.f16
+    ):
         pytest.skip()
     out = wrapper.randu(shape, dtype_name)
 
     result = wrapper.bitnot(out)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -145,6 +169,8 @@ def test_bitnot_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         shape = (3, 3)
         out = wrapper.randu(shape, invdtypes)
         wrapper.bitnot(out)
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -158,14 +184,23 @@ def test_bitnot_shapes_invalid(invdtypes: dtype.Dtype) -> None:
 @pytest.mark.parametrize("dtype_name", dtype_map.values())
 def test_bitor_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitor operation between two arrays of the same shape"""
-    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+    if (
+        dtype_name == dtype.c32
+        or dtype_name == dtype.c64
+        or dtype_name == dtype.f32
+        or dtype_name == dtype.f64
+        or dtype_name == dtype.f16
+    ):
         pytest.skip()
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
     result = wrapper.bitor(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -182,6 +217,7 @@ def test_bitor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.bitor(lhs, rhs)
 
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -195,14 +231,23 @@ def test_bitor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
 @pytest.mark.parametrize("dtype_name", dtype_map.values())
 def test_bitxor_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitxor operation between two arrays of the same shape"""
-    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+    if (
+        dtype_name == dtype.c32
+        or dtype_name == dtype.c64
+        or dtype_name == dtype.f32
+        or dtype_name == dtype.f64
+        or dtype_name == dtype.f16
+    ):
         pytest.skip()
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
     result = wrapper.bitxor(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -218,6 +263,8 @@ def test_bitxor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         lhs = wrapper.randu(shape, invdtypes)
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.bitxor(lhs, rhs)
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -231,14 +278,23 @@ def test_bitxor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
 @pytest.mark.parametrize("dtype_name", dtype_map.values())
 def test_eq_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test eq operation between two arrays of the same shape"""
-    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+    if (
+        dtype_name == dtype.c32
+        or dtype_name == dtype.c64
+        or dtype_name == dtype.f32
+        or dtype_name == dtype.f64
+        or dtype_name == dtype.f16
+    ):
         pytest.skip()
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
     result = wrapper.eq(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -254,6 +310,8 @@ def test_eq_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         lhs = wrapper.randu(shape, invdtypes)
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.eq(lhs, rhs)
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -272,7 +330,10 @@ def test_ge_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
 
     result = wrapper.ge(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -289,6 +350,7 @@ def test_ge_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.ge(lhs, rhs)
 
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -307,7 +369,10 @@ def test_gt_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
 
     result = wrapper.gt(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -324,6 +389,7 @@ def test_gt_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.gt(lhs, rhs)
 
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -342,7 +408,10 @@ def test_le_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
 
     result = wrapper.le(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -358,6 +427,8 @@ def test_le_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         lhs = wrapper.randu(shape, invdtypes)
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.le(lhs, rhs)
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -376,7 +447,10 @@ def test_lt_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
 
     result = wrapper.lt(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -392,6 +466,8 @@ def test_lt_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         lhs = wrapper.randu(shape, invdtypes)
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.lt(lhs, rhs)
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -410,7 +486,10 @@ def test_neq_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
 
     result = wrapper.neq(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -426,6 +505,8 @@ def test_neq_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         lhs = wrapper.randu(shape, invdtypes)
         rhs = wrapper.randu(shape, invdtypes)
         wrapper.neq(lhs, rhs)
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -439,13 +520,22 @@ def test_neq_shapes_invalid(invdtypes: dtype.Dtype) -> None:
 @pytest.mark.parametrize("dtype_name", dtype_map.values())
 def test_not_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test not operation between two arrays of the same shape"""
-    if dtype_name == dtype.c32 or dtype_name == dtype.c64 or dtype_name == dtype.f32 or dtype_name == dtype.f64 or dtype_name == dtype.f16:
+    if (
+        dtype_name == dtype.c32
+        or dtype_name == dtype.c64
+        or dtype_name == dtype.f32
+        or dtype_name == dtype.f64
+        or dtype_name == dtype.f16
+    ):
         pytest.skip()
     out = wrapper.randu(shape, dtype_name)
 
     result = wrapper.not_(out)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -460,6 +550,8 @@ def test_not_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         shape = (3, 3)
         out = wrapper.randu(shape, invdtypes)
         wrapper.not_(out)
+
+
 @pytest.mark.parametrize(
     "shape",
     [
@@ -478,7 +570,10 @@ def test_or_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
 
     result = wrapper.or_(lhs, rhs)
 
-    assert wrapper.get_dims(result)[0 : len(shape)] == shape, f"failed for shape: {shape} and dtype {dtype_name}"  # noqa
+    assert (
+        wrapper.get_dims(result)[0 : len(shape)] == shape  # noqa
+    ), f"failed for shape: {shape} and dtype {dtype_name}"
+
 
 @pytest.mark.parametrize(
     "invdtypes",
@@ -493,4 +588,4 @@ def test_or_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         shape = (3, 3)
         lhs = wrapper.randu(shape, invdtypes)
         rhs = wrapper.randu(shape, invdtypes)
-        wrapper.or_(lhs, rhs)
\ No newline at end of file
+        wrapper.or_(lhs, rhs)

From 6e58189959d7a076aebdecda0da4079d9ae70589 Mon Sep 17 00:00:00 2001
From: AzeezIsh <azishaqui@gmail.com>
Date: Tue, 26 Mar 2024 15:45:15 -0400
Subject: [PATCH 4/5] Added all necessary dtype coverage.

---
 tests/test_logical.py | 117 ++++++++++--------------------------------
 1 file changed, 27 insertions(+), 90 deletions(-)

diff --git a/tests/test_logical.py b/tests/test_logical.py
index 87c60e3..feba97d 100644
--- a/tests/test_logical.py
+++ b/tests/test_logical.py
@@ -4,35 +4,7 @@
 
 import arrayfire_wrapper.dtypes as dtype
 import arrayfire_wrapper.lib as wrapper
-
-dtype_map = {
-    "int16": dtype.s16,
-    "int32": dtype.s32,
-    "int64": dtype.s64,
-    "uint8": dtype.u8,
-    "uint16": dtype.u16,
-    "uint32": dtype.u32,
-    "uint64": dtype.u64,
-    "float16": dtype.f16,
-    "float32": dtype.f32,
-    # 'float64': dtype.f64,
-    # 'complex64': dtype.c64,
-    "complex32": dtype.c32,
-    "bool": dtype.b8,
-    "s16": dtype.s16,
-    "s32": dtype.s32,
-    "s64": dtype.s64,
-    "u8": dtype.u8,
-    "u16": dtype.u16,
-    "u32": dtype.u32,
-    "u64": dtype.u64,
-    "f16": dtype.f16,
-    "f32": dtype.f32,
-    # 'f64': dtype.f64,
-    "c32": dtype.c32,
-    # 'c64': dtype.c64,
-    "b8": dtype.b8,
-}
+from tests.utility_functions import check_type_supported, get_all_types
 
 
 @pytest.mark.parametrize(
@@ -45,9 +17,10 @@
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_and_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test and_ operation between two arrays of the same shape"""
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -89,17 +62,10 @@ def test_and_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_bitand_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitand operation between two arrays of the same shape"""
-    if (
-        dtype_name == dtype.c32
-        or dtype_name == dtype.c64
-        or dtype_name == dtype.f32
-        or dtype_name == dtype.f64
-        or dtype_name == dtype.f16
-    ):
-        pytest.skip()
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -136,17 +102,10 @@ def test_bitand_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_bitnot_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitnot operation between two arrays of the same shape"""
-    if (
-        dtype_name == dtype.c32
-        or dtype_name == dtype.c64
-        or dtype_name == dtype.f32
-        or dtype_name == dtype.f64
-        or dtype_name == dtype.f16
-    ):
-        pytest.skip()
+    check_type_supported(dtype_name)
     out = wrapper.randu(shape, dtype_name)
 
     result = wrapper.bitnot(out)
@@ -181,17 +140,10 @@ def test_bitnot_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_bitor_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitor operation between two arrays of the same shape"""
-    if (
-        dtype_name == dtype.c32
-        or dtype_name == dtype.c64
-        or dtype_name == dtype.f32
-        or dtype_name == dtype.f64
-        or dtype_name == dtype.f16
-    ):
-        pytest.skip()
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -228,17 +180,10 @@ def test_bitor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_bitxor_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitxor operation between two arrays of the same shape"""
-    if (
-        dtype_name == dtype.c32
-        or dtype_name == dtype.c64
-        or dtype_name == dtype.f32
-        or dtype_name == dtype.f64
-        or dtype_name == dtype.f16
-    ):
-        pytest.skip()
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -275,17 +220,10 @@ def test_bitxor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_eq_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test eq operation between two arrays of the same shape"""
-    if (
-        dtype_name == dtype.c32
-        or dtype_name == dtype.c64
-        or dtype_name == dtype.f32
-        or dtype_name == dtype.f64
-        or dtype_name == dtype.f16
-    ):
-        pytest.skip()
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -322,9 +260,10 @@ def test_eq_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_ge_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test >= operation between two arrays of the same shape"""
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -361,9 +300,10 @@ def test_ge_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_gt_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test > operation between two arrays of the same shape"""
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -400,9 +340,10 @@ def test_gt_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_le_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test <= operation between two arrays of the same shape"""
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -439,9 +380,10 @@ def test_le_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_lt_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test < operation between two arrays of the same shape"""
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -478,9 +420,10 @@ def test_lt_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_neq_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test not equal operation between two arrays of the same shape"""
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -517,17 +460,10 @@ def test_neq_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_not_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test not operation between two arrays of the same shape"""
-    if (
-        dtype_name == dtype.c32
-        or dtype_name == dtype.c64
-        or dtype_name == dtype.f32
-        or dtype_name == dtype.f64
-        or dtype_name == dtype.f16
-    ):
-        pytest.skip()
+    check_type_supported(dtype_name)
     out = wrapper.randu(shape, dtype_name)
 
     result = wrapper.not_(out)
@@ -562,9 +498,10 @@ def test_not_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", dtype_map.values())
+@pytest.mark.parametrize("dtype_name", get_all_types())
 def test_or_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test or operation between two arrays of the same shape"""
+    check_type_supported(dtype_name)
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 

From 76970d5a4ce7365831021b03fc622c599ebed93b Mon Sep 17 00:00:00 2001
From: AzeezIsh <azishaqui@gmail.com>
Date: Tue, 26 Mar 2024 15:49:31 -0400
Subject: [PATCH 5/5] Removed float coverage for bit specific tests.

---
 tests/test_logical.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tests/test_logical.py b/tests/test_logical.py
index feba97d..b9e8db2 100644
--- a/tests/test_logical.py
+++ b/tests/test_logical.py
@@ -4,7 +4,7 @@
 
 import arrayfire_wrapper.dtypes as dtype
 import arrayfire_wrapper.lib as wrapper
-from tests.utility_functions import check_type_supported, get_all_types
+from tests.utility_functions import check_type_supported, get_all_types, get_real_types
 
 
 @pytest.mark.parametrize(
@@ -62,10 +62,12 @@ def test_and_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", get_all_types())
+@pytest.mark.parametrize("dtype_name", get_real_types())
 def test_bitand_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitand operation between two arrays of the same shape"""
     check_type_supported(dtype_name)
+    if dtype_name == dtype.f16 or dtype_name == dtype.f32:
+        pytest.skip()
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -102,10 +104,12 @@ def test_bitand_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", get_all_types())
+@pytest.mark.parametrize("dtype_name", get_real_types())
 def test_bitnot_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitnot operation between two arrays of the same shape"""
     check_type_supported(dtype_name)
+    if dtype_name == dtype.f16 or dtype_name == dtype.f32:
+        pytest.skip()
     out = wrapper.randu(shape, dtype_name)
 
     result = wrapper.bitnot(out)
@@ -140,10 +144,12 @@ def test_bitnot_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", get_all_types())
+@pytest.mark.parametrize("dtype_name", get_real_types())
 def test_bitor_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitor operation between two arrays of the same shape"""
     check_type_supported(dtype_name)
+    if dtype_name == dtype.f16 or dtype_name == dtype.f32:
+        pytest.skip()
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)
 
@@ -180,10 +186,12 @@ def test_bitor_shapes_invalid(invdtypes: dtype.Dtype) -> None:
         (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
     ],
 )
-@pytest.mark.parametrize("dtype_name", get_all_types())
+@pytest.mark.parametrize("dtype_name", get_real_types())
 def test_bitxor_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
     """Test bitxor operation between two arrays of the same shape"""
     check_type_supported(dtype_name)
+    if dtype_name == dtype.f16 or dtype_name == dtype.f32:
+        pytest.skip()
     lhs = wrapper.randu(shape, dtype_name)
     rhs = wrapper.randu(shape, dtype_name)