Skip to content

Commit

Permalink
Attempt to split tests for normal into smaller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-pavlyk committed Jul 21, 2024
1 parent 9640607 commit f6f0a68
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mkl_random/tests/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,21 +788,25 @@ def test_randomdist_noncentral_f(randomdist):
np.testing.assert_allclose(actual, desired, atol=1e-7, rtol=1e-10)


def test_randomdist_normal(randomdist):
def test_randomdist_normal_case1(randomdist):
rnd.seed(randomdist.seed, brng=randomdist.brng)
actual = rnd.normal(loc=.123456789, scale=2.0, size=(3, 2))
desired = np.array([[4.405778774782659, -4.020116569348963],
[-1.732103577371005, 1.2282652034983546],
[0.21648943171034918, 4.625591634211608]])
np.testing.assert_allclose(actual, desired, atol=1e-7, rtol=1e-10)


def test_randomdist_normal_case2(randomdist):
rnd.seed(randomdist.seed, brng=randomdist.brng)
actual = rnd.normal(loc=.123456789, scale=2.0, size=(3, 2), method="BoxMuller")
desired = np.array([[0.16673479781277187, -3.4809986872165952],
[-0.05193761082535492, 3.249201213154922],
[-0.11915582299214138, 3.555636100927892]])
np.testing.assert_allclose(actual, desired, atol=1e-8, rtol=1e-8)


def test_randomdist_normal_case3(randomdist):
rnd.seed(randomdist.seed, brng=randomdist.brng)
actual = rnd.normal(loc=.123456789, scale=2.0, size=(3, 2), method="BoxMuller2")
desired = np.array([[0.16673479781277187, 0.48153966449249175],
Expand Down Expand Up @@ -893,14 +897,16 @@ def test_randomdist_standard_gamma(randomdist):
np.testing.assert_allclose(actual, desired, atol=1e-7, rtol=1e-10)


def test_randomdist_standard_normal(randomdist):
def test_randomdist_standard_normal_case1(randomdist):
rnd.seed(randomdist.seed, brng=randomdist.brng)
actual = rnd.standard_normal(size=(3, 2))
desired = np.array([[2.1411609928913298, -2.071786679174482],
[-0.9277801831855025, 0.5524042072491773],
[0.04651632135517459, 2.2510674226058036]])
np.testing.assert_allclose(actual, desired, atol=1e-7, rtol=1e-10)


def test_randomdist_standard_normal_case2(randomdist):
rnd.seed(randomdist.seed, brng=randomdist.brng)
actual = rnd.standard_normal(size=(3, 2), method='BoxMuller2')
desired = np.array([[0.021639004406385935, 0.17904143774624587],
Expand Down

0 comments on commit f6f0a68

Please sign in to comment.