Created
December 28, 2020 15:29
-
-
Save wilfreddesert/cbe78b951b15729d49162764a7600430 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from hypothesis import given | |
from hypothesis.strategies import integers, lists, sampled_from | |
from merge_sort import merge_sort | |
lists = lists(integers(), min_size=0, max_size=1000) | |
def test_sorted(): | |
assert merge_sort([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5] | |
def test_reversed(): | |
assert merge_sort([5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5] | |
def test_simple(): | |
for i in range(1000): | |
arr = list(np.random.rand(i)) | |
assert merge_sort(arr) == sorted(arr) | |
@given(lists) | |
def test_sort(arr): | |
assert merge_sort(arr) == sorted(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment