Skip to content

Commit a9b4fe9

Browse files
author
peng.li24
committed
test: increase minimum test data size 10 → 100
Change all 1D test array sizes from 10 to 100 elements: - _UNARY_MATH parametrized table: (10,42) → (100,42) for all 17 functions - _COMP_ARGS table: (10,42) → (100,42) for comparison functions - All random_array((10,), ...) → random_array((100,), ...) - np.zeros((10,), ...) → np.zeros((100,), ...) 2D shapes and einsum dimensions kept as-is. Test count unchanged (475), data volume increased.
1 parent ba99a96 commit a9b4fe9

1 file changed

Lines changed: 37 additions & 37 deletions

File tree

tests/test_all.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,24 @@ def dtype(request):
148148
# _multiarray_umath.so by the SVML bridge. No AVX-512 required.
149149

150150
_UNARY_MATH = [
151-
("sqrt", np.sqrt, lambda a: np.abs(a), [(10, 42), (10000, 7), (100000, 7)]),
152-
("abs", np.abs, None, [(10, 42), (10000, 7), (100000, 7)]),
153-
("exp", np.exp, None, [(10, 1), (1000, 7), (10000, 7), (100000, 7)]),
154-
("log", np.log, lambda a: np.abs(a) + 0.1, [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
155-
("sin", np.sin, None, [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
156-
("cos", np.cos, None, [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
157-
("tan", np.tan, lambda a: a * 0.5, [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
158-
("log10", np.log10, lambda a: np.abs(a) + 0.1, [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
159-
("log2", np.log2, lambda a: np.abs(a) + 0.1, [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
160-
("arcsin", np.arcsin, lambda a: np.clip(a * 0.5, -1, 1), [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
161-
("arccos", np.arccos, lambda a: np.clip(a * 0.5, -1, 1), [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
162-
("arctan", np.arctan, None, [(10, 42), (1000, 7), (10000, 7), (100000, 7)]),
163-
("round", np.round, lambda a: a * 100, [(10, 42), (10000, 7), (100000, 7)]),
164-
("floor", np.floor, lambda a: a * 100, [(10, 42), (10000, 7), (100000, 7)]),
165-
("ceil", np.ceil, lambda a: a * 100, [(10, 42), (10000, 7), (100000, 7)]),
166-
("degrees", np.degrees, None, [(10, 42), (10000, 7), (100000, 7)]),
167-
("radians", np.radians, None, [(10, 42), (10000, 7), (100000, 7)]),
168-
("sign", np.sign, None, [(10, 42), (10000, 7), (100000, 7)]),
151+
("sqrt", np.sqrt, lambda a: np.abs(a), [(100, 42), (10000, 7), (100000, 7)]),
152+
("abs", np.abs, None, [(100, 42), (10000, 7), (100000, 7)]),
153+
("exp", np.exp, None, [(100, 1), (1000, 7), (10000, 7), (100000, 7)]),
154+
("log", np.log, lambda a: np.abs(a) + 0.1, [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
155+
("sin", np.sin, None, [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
156+
("cos", np.cos, None, [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
157+
("tan", np.tan, lambda a: a * 0.5, [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
158+
("log10", np.log10, lambda a: np.abs(a) + 0.1, [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
159+
("log2", np.log2, lambda a: np.abs(a) + 0.1, [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
160+
("arcsin", np.arcsin, lambda a: np.clip(a * 0.5, -1, 1), [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
161+
("arccos", np.arccos, lambda a: np.clip(a * 0.5, -1, 1), [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
162+
("arctan", np.arctan, None, [(100, 42), (1000, 7), (10000, 7), (100000, 7)]),
163+
("round", np.round, lambda a: a * 100, [(100, 42), (10000, 7), (100000, 7)]),
164+
("floor", np.floor, lambda a: a * 100, [(100, 42), (10000, 7), (100000, 7)]),
165+
("ceil", np.ceil, lambda a: a * 100, [(100, 42), (10000, 7), (100000, 7)]),
166+
("degrees", np.degrees, None, [(100, 42), (10000, 7), (100000, 7)]),
167+
("radians", np.radians, None, [(100, 42), (10000, 7), (100000, 7)]),
168+
("sign", np.sign, None, [(100, 42), (10000, 7), (100000, 7)]),
169169
]
170170

171171

@@ -232,8 +232,8 @@ def test_clip(lo, hi, size, cpp, dtype):
232232
]
233233

234234

235-
_COMP_ARGS = [(fn, npf, size, seed) for fn, npf in _COMPARISONS for size, seed in [(10, 42), (100000, 7)]]
236-
_COMP_IDS = [f"{fn}_{size}" for fn, npf in _COMPARISONS for size, seed in [(10, 42), (100000, 7)]]
235+
_COMP_ARGS = [(fn, npf, size, seed) for fn, npf in _COMPARISONS for size, seed in [(100, 42), (100000, 7)]]
236+
_COMP_IDS = [f"{fn}_{size}" for fn, npf in _COMPARISONS for size, seed in [(100, 42), (100000, 7)]]
237237

238238

239239
@pytest.mark.parametrize("fn_name, np_fn, size, seed", _COMP_ARGS, ids=_COMP_IDS)
@@ -257,8 +257,8 @@ def test_not_equal_scalar(cpp, dtype):
257257
assert_bit_aligned(cpp.not_equal(a, dtype(0.0)), np.not_equal(a, dtype(0.0)), "not_equal scalar")
258258

259259
def test_not_equal_array(cpp, dtype):
260-
a = random_array((10,), dtype=dtype)
261-
b = random_array((10,), seed=99, dtype=dtype)
260+
a = random_array((100,), dtype=dtype)
261+
b = random_array((100,), seed=99, dtype=dtype)
262262
assert_bit_aligned(cpp.not_equal(a, b), np.not_equal(a, b), "not_equal array")
263263

264264
def test_not_equal_large(cpp, dtype):
@@ -272,12 +272,12 @@ def test_not_equal_large(cpp, dtype):
272272
# ============================================================================
273273

274274
def test_maximum_array(cpp, dtype):
275-
a = random_array((10,), seed=1, dtype=dtype)
276-
b = random_array((10,), seed=2, dtype=dtype)
275+
a = random_array((100,), seed=1, dtype=dtype)
276+
b = random_array((100,), seed=2, dtype=dtype)
277277
assert_bit_aligned(cpp.maximum(a, b), np.maximum(a, b), "maximum(a,b)")
278278

279279
def test_maximum_scalar(cpp, dtype):
280-
a = random_array((10,), dtype=dtype)
280+
a = random_array((100,), dtype=dtype)
281281
assert_bit_aligned(cpp.maximum(a, dtype(0.0)), np.maximum(a, dtype(0.0)), "maximum(a,0)")
282282

283283
def test_maximum_large(cpp, dtype):
@@ -286,12 +286,12 @@ def test_maximum_large(cpp, dtype):
286286
assert_bit_aligned(cpp.maximum(a, b), np.maximum(a, b), "maximum large")
287287

288288
def test_minimum_array(cpp, dtype):
289-
a = random_array((10,), seed=1, dtype=dtype)
290-
b = random_array((10,), seed=2, dtype=dtype)
289+
a = random_array((100,), seed=1, dtype=dtype)
290+
b = random_array((100,), seed=2, dtype=dtype)
291291
assert_bit_aligned(cpp.minimum(a, b), np.minimum(a, b), "minimum(a,b)")
292292

293293
def test_minimum_scalar(cpp, dtype):
294-
a = random_array((10,), dtype=dtype)
294+
a = random_array((100,), dtype=dtype)
295295
assert_bit_aligned(cpp.minimum(a, dtype(0.0)), np.minimum(a, dtype(0.0)), "minimum(a,0)")
296296

297297
def test_minimum_large(cpp, dtype):
@@ -300,12 +300,12 @@ def test_minimum_large(cpp, dtype):
300300
assert_bit_aligned(cpp.minimum(a, b), np.minimum(a, b), "minimum large")
301301

302302
def test_arctan2_array(cpp, dtype):
303-
a = random_array((10,), dtype=dtype)
304-
b = np.abs(random_array((10,), dtype=dtype)) + dtype(0.1)
303+
a = random_array((100,), dtype=dtype)
304+
b = np.abs(random_array((100,), dtype=dtype)) + dtype(0.1)
305305
assert_bit_aligned(cpp.arctan2(a, b), np.arctan2(a, b), "arctan2(a,b)")
306306

307307
def test_arctan2_scalar(cpp, dtype):
308-
a = random_array((10,), dtype=dtype)
308+
a = random_array((100,), dtype=dtype)
309309
assert_bit_aligned(cpp.arctan2(a, dtype(1.0)), np.arctan2(a, dtype(1.0)), "arctan2(a,1)")
310310

311311
def test_arctan2_large(cpp, dtype):
@@ -319,7 +319,7 @@ def test_arctan2_large(cpp, dtype):
319319
# ============================================================================
320320

321321
def test_sum_1d(cpp, dtype):
322-
a = random_array((10,), dtype=dtype)
322+
a = random_array((100,), dtype=dtype)
323323
assert cpp.sum(a) == np.sum(a), "sum 1d"
324324

325325
def test_sum_2d(cpp, dtype):
@@ -332,23 +332,23 @@ def test_sum_empty(cpp, dtype):
332332

333333

334334
def test_mean_1d(cpp, dtype):
335-
a = random_array((10,), dtype=dtype)
335+
a = random_array((100,), dtype=dtype)
336336
assert_bit_aligned(np.float64(cpp.mean(a)), np.float64(np.mean(a)), "mean 1d")
337337

338338
def test_mean_empty(cpp, dtype):
339339
assert np.float64(cpp.mean(np.array([], dtype=dtype))) == 0.0, "mean empty"
340340

341341

342342
def test_max_1d(cpp, dtype):
343-
a = random_array((10,), dtype=dtype)
343+
a = random_array((100,), dtype=dtype)
344344
assert cpp.max(a) == np.max(a), "max 1d"
345345

346346
def test_max_large(cpp, dtype):
347347
a = random_array((100000,), seed=7, dtype=dtype)
348348
assert cpp.max(a) == np.max(a), "max large"
349349

350350
def test_min_1d(cpp, dtype):
351-
a = random_array((10,), dtype=dtype)
351+
a = random_array((100,), dtype=dtype)
352352
assert cpp.min(a) == np.min(a), "min 1d"
353353

354354
def test_min_large(cpp, dtype):
@@ -822,15 +822,15 @@ def test_to_vector_bool(cpp):
822822
# ============================================================================
823823

824824
def test_norm_1d(cpp, dtype):
825-
a = random_array((10,), dtype=dtype)
825+
a = random_array((100,), dtype=dtype)
826826
assert_bit_aligned(dtype(cpp.linalg.norm(a)), np.sqrt(np.sum(a * a)), "linalg.norm 1d")
827827

828828
def test_norm_2d(cpp, dtype):
829829
a = random_array((5, 4), dtype=dtype)
830830
assert_bit_aligned(dtype(cpp.linalg.norm(a)), np.sqrt(np.sum(a * a)), "linalg.norm 2d")
831831

832832
def test_norm_zero(cpp, dtype):
833-
a = np.zeros((10,), dtype=dtype)
833+
a = np.zeros((100,), dtype=dtype)
834834
assert_bit_aligned(dtype(cpp.linalg.norm(a)), dtype(0.0), "linalg.norm zero")
835835

836836
def test_norm_axis_2d(cpp, dtype):

0 commit comments

Comments
 (0)