forked from open-atmos/PyPartMC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_rand.py
32 lines (26 loc) · 986 Bytes
/
test_rand.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
####################################################################################################
# This file is a part of PyPartMC licensed under the GNU General Public License v3 (LICENSE file) #
# Copyright (C) 2022 University of Illinois Urbana-Champaign #
# Authors: https://github.com/open-atmos/PyPartMC/graphs/contributors #
####################################################################################################
import pytest
import PyPartMC as ppmc
@pytest.mark.order(-1)
@pytest.mark.parametrize(
"seeds",
(
(44, 44),
pytest.param((44, 45), marks=pytest.mark.xfail(strict=True)),
),
)
def test_set_rand_seed(seeds):
# arrange
rand_arg = (0, 1)
values = []
# act
for seed in seeds:
ppmc.rand_init(seed)
values.append(ppmc.rand_normal(*rand_arg))
# assert
for value in values[1:]:
assert value == values[0]