FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
basic-programs/python/recursion/quicksort_tests.py at master · Scarlet-Coder/basic-programs · GitHub
Scarlet-Coder
/
basic-programs
Public
forked from
utkarsh-shekhar/basic-programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
basic-programs
/
python
/
recursion
/
quicksort_tests.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (38 loc) · 1.13 KB
Breadcrumbs
basic-programs
/
python
/
recursion
/
quicksort_tests.py
Copy path
File metadata and controls
47 lines (38 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import
unittest
from
random
import
randint
from
quicksort
import
quicksort
class
QuickSortUnitTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
pass
def
test_empty_list
(
self
):
a
,
b
=
[], []
quicksort
(
a
)
self
.
assertEqual
(
a
,
b
)
def
test_one_item_list
(
self
):
a
,
b
=
[
1
], [
1
]
quicksort
(
a
)
self
.
assertEqual
(
a
,
b
)
def
test_sorted_list
(
self
):
a
,
b
=
[
1
,
2
,
3
,
4
,
5
], [
1
,
2
,
3
,
4
,
5
]
quicksort
(
a
)
self
.
assertEqual
(
a
,
b
)
def
test_partially_sorted
(
self
):
a
,
b
=
[
5
,
12
,
4
,
18
,
0
,
1
,
2
,
3
], [
5
,
12
,
4
,
18
,
0
,
1
,
2
,
3
]
quicksort
(
a
)
#sort a copy using python inbuilt sort method
b
.
sort
()
self
.
assertEqual
(
a
,
b
)
def
test_reverse_sorted_list
(
self
):
a
,
b
=
[
5
,
3
,
1
,
0
], [
5
,
3
,
1
,
0
]
quicksort
(
a
)
b
.
sort
()
self
.
assertEqual
(
a
,
b
)
def
test_random_list
(
self
):
random_sz
=
randint
(
1
,
2000
)
a
=
[
randint
(
-
2000
,
5000
)
for
i
in
range
(
0
,
random_sz
)]
b
=
a
[:]
quicksort
(
a
)
b
.
sort
()
self
.
assertEqual
(
a
,
b
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL