-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from fromfall/patch-13
Тесты, 6
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import unittest | ||
import random | ||
import lab6 | ||
|
||
|
||
class TestSorting(unittest.TestCase): | ||
def test_trivial(self): | ||
arr = [1, 333, 22] | ||
res = lab6.radixsort(arr) | ||
expected = [1, 22, 333] | ||
self.assertFalse(not res) # check res not empty | ||
self.assertEqual(expected, res) | ||
|
||
def test_empty(self): | ||
arr = [] | ||
res = lab6.radixsort(arr) | ||
expected = [] | ||
self.assertEqual(expected, res) | ||
|
||
def test_alot(self): | ||
arr = [random.randint(0, 10000) for i in range(100000)] | ||
res = lab6.radixsort(arr) | ||
arr.sort() | ||
self.assertFalse(not res) | ||
self.assertEqual(arr, res) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |