From 06c1e0ddb156d8dd2a4dfa52006145ba538f6efc Mon Sep 17 00:00:00 2001
From: Kaushik Kulkarni <kaushikcfd@gmail.com>
Date: Thu, 20 May 2021 16:24:17 -0500
Subject: [PATCH] test cla.(max|min|if_positive) on scalars

---
 test/test_array.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/test/test_array.py b/test/test_array.py
index a6a91bef..3bfd0d04 100644
--- a/test/test_array.py
+++ b/test/test_array.py
@@ -1560,6 +1560,19 @@ def test_assign_different_strides(ctx_factory):
         b[:] = a
 
 
+def test_branch_operations_on_pure_scalars(ctx_factory):
+    x = np.random.rand()
+    y = np.random.rand()
+    cond = np.random.choice([False, True])
+
+    np.testing.assert_allclose(np.maximum(x, y),
+                               cl_array.maximum(x, y))
+    np.testing.assert_allclose(np.minimum(x, y),
+                               cl_array.minimum(x, y))
+    np.testing.assert_allclose(np.where(cond, x, y),
+                               cl_array.if_positive(cond, x, y))
+
+
 if __name__ == "__main__":
     if len(sys.argv) > 1:
         exec(sys.argv[1])
-- 
GitLab