-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_shuffle.py
More file actions
24 lines (20 loc) · 1.02 KB
/
test_shuffle.py
File metadata and controls
24 lines (20 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from arrayutilities import Arr
import unittest
class TestArr(unittest.TestCase):
def test_shuffle_no_seed(self):
test_array = [i for i in range(1, 25)]
shuffled_array = Arr.shuffle(test_array)
self.assertNotEqual(shuffled_array, test_array, "Should shuffle the array without a specified seed")
def test_shuffle_with_seed(self):
test_array = [i for i in range(1, 25)]
seed = 42
shuffled_array_1 = Arr.shuffle(test_array, seed)
shuffled_array_2 = Arr.shuffle(test_array, seed)
self.assertEqual(shuffled_array_1, shuffled_array_2, "Should produce the same shuffle with a specified seed")
def test_shuffle_with_different_seeds(self):
test_array = [i for i in range(1, 25)]
shuffled_array_1 = Arr.shuffle(test_array, seed=1)
shuffled_array_2 = Arr.shuffle(test_array, seed=50)
self.assertNotEqual(shuffled_array_1, shuffled_array_2, "Should produce different shuffles with different seeds")
if __name__ == '__main__':
unittest.main()