@@ -933,6 +933,16 @@ def test_ceil(x):
933
933
unary_assert_against_refimpl ("ceil" , x , out , math .ceil , strict_check = True )
934
934
935
935
936
+ @pytest .mark .min_version ("2023.12" )
937
+ @given (hh .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ()))
938
+ def test_clip (x ):
939
+ # TODO: test min/max kwargs, adjust values testing accordingly
940
+ out = xp .clip (x )
941
+ ph .assert_dtype ("clip" , in_dtype = x .dtype , out_dtype = out .dtype )
942
+ ph .assert_shape ("clip" , out_shape = out .shape , expected = x .shape )
943
+ ph .assert_array_elements ("clip" , out = out , expected = x )
944
+
945
+
936
946
if api_version >= "2022.12" :
937
947
938
948
@given (hh .arrays (dtype = xps .complex_dtypes (), shape = hh .shapes ()))
@@ -943,6 +953,15 @@ def test_conj(x):
943
953
unary_assert_against_refimpl ("conj" , x , out , operator .methodcaller ("conjugate" ))
944
954
945
955
956
+ @pytest .mark .min_version ("2023.12" )
957
+ @given (* hh .two_mutual_arrays (dh .real_float_dtypes ))
958
+ def test_copysign (x1 , x2 ):
959
+ out = xp .copysign (x1 , x2 )
960
+ ph .assert_dtype ("copysign" , in_dtype = [x1 .dtype , x2 .dtype ], out_dtype = out .dtype )
961
+ ph .assert_result_shape ("copysign" , in_shapes = [x1 .shape , x2 .shape ], out_shape = out .shape )
962
+ # TODO: values testing
963
+
964
+
946
965
@given (hh .arrays (dtype = hh .all_floating_dtypes (), shape = hh .shapes ()))
947
966
def test_cos (x ):
948
967
out = xp .cos (x )
@@ -1095,6 +1114,15 @@ def test_greater_equal(ctx, data):
1095
1114
)
1096
1115
1097
1116
1117
+ @pytest .mark .min_version ("2023.12" )
1118
+ @given (* hh .two_mutual_arrays (dh .real_float_dtypes ))
1119
+ def test_hypot (x1 , x2 ):
1120
+ out = xp .hypot (x1 , x2 )
1121
+ ph .assert_dtype ("hypot" , in_dtype = [x1 .dtype , x2 .dtype ], out_dtype = out .dtype )
1122
+ ph .assert_result_shape ("hypot" , in_shapes = [x1 .shape , x2 .shape ], out_shape = out .shape )
1123
+ binary_assert_against_refimpl ("hypot" , x1 , x2 , out , math .hypot )
1124
+
1125
+
1098
1126
if api_version >= "2022.12" :
1099
1127
1100
1128
@given (hh .arrays (dtype = xps .complex_dtypes (), shape = hh .shapes ()))
@@ -1261,6 +1289,24 @@ def test_logical_xor(x1, x2):
1261
1289
)
1262
1290
1263
1291
1292
+ @pytest .mark .min_version ("2023.12" )
1293
+ @given (* hh .two_mutual_arrays (dh .real_float_dtypes ))
1294
+ def test_maximum (x1 , x2 ):
1295
+ out = xp .maximum (x1 , x2 )
1296
+ ph .assert_dtype ("maximum" , in_dtype = [x1 .dtype , x2 .dtype ], out_dtype = out .dtype )
1297
+ ph .assert_result_shape ("maximum" , in_shapes = [x1 .shape , x2 .shape ], out_shape = out .shape )
1298
+ binary_assert_against_refimpl ("maximum" , x1 , x2 , out , max , strict_check = True )
1299
+
1300
+
1301
+ @pytest .mark .min_version ("2023.12" )
1302
+ @given (* hh .two_mutual_arrays (dh .real_float_dtypes ))
1303
+ def test_minimum (x1 , x2 ):
1304
+ out = xp .minimum (x1 , x2 )
1305
+ ph .assert_dtype ("minimum" , in_dtype = [x1 .dtype , x2 .dtype ], out_dtype = out .dtype )
1306
+ ph .assert_result_shape ("minimum" , in_shapes = [x1 .shape , x2 .shape ], out_shape = out .shape )
1307
+ binary_assert_against_refimpl ("minimum" , x1 , x2 , out , min , strict_check = True )
1308
+
1309
+
1264
1310
@pytest .mark .parametrize ("ctx" , make_binary_params ("multiply" , dh .numeric_dtypes ))
1265
1311
@given (data = st .data ())
1266
1312
def test_multiply (ctx , data ):
0 commit comments