Skip to content

Commit b07a9a2

Browse files
Merge pull request #11 from AladdinPerzon/Test
test for sorting
2 parents 574b078 + 1f77cc4 commit b07a9a2

File tree

2 files changed

+81
-15
lines changed

2 files changed

+81
-15
lines changed

.circleci/config.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Python CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-python/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
build:
8+
docker:
9+
# specify the version you desire here
10+
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
11+
- image: circleci/python:3.6.1
12+
13+
# Specify service dependencies here if necessary
14+
# CircleCI maintains a library of pre-built images
15+
# documented at https://circleci.com/docs/2.0/circleci-images/
16+
# - image: circleci/postgres:9.4
17+
18+
working_directory: ~/repo
19+
20+
steps:
21+
- checkout
22+
23+
# Download and cache dependencies
24+
- restore_cache:
25+
keys:
26+
- v1-dependencies-{{ checksum "requirements.txt" }}
27+
# fallback to using the latest cache if no exact match is found
28+
- v1-dependencies-
29+
30+
- run:
31+
name: install dependencies
32+
command: |
33+
python3 -m venv venv
34+
. venv/bin/activate
35+
pip install -r requirements.txt
36+
37+
- save_cache:
38+
paths:
39+
- ./venv
40+
key: v1-dependencies-{{ checksum "requirements.txt" }}
41+
42+
# run tests!
43+
# this example uses Django's built-in test-runner
44+
# other common Python testing frameworks include pytest and nose
45+
# https://pytest.org
46+
# https://nose.readthedocs.io
47+
- run:
48+
name: run tests
49+
command: |
50+
. venv/bin/activate
51+
python manage.py test
52+
53+
- store_artifacts:
54+
path: test-reports
55+
destination: test-reports

Algorithm_tests/sorting_tests/test_sorting.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,41 @@
1-
# import alla sorting algoritms
1+
# Import folder where sorting algorithms
2+
import sys
3+
sys.path.append('../../Algorithms/sorting')
4+
5+
# from bubblesort import bubblesort
6+
7+
from bubblesort import bubblesort
28

39
L1 = [1,2,3,4,5,6,7,8,9]
4-
L1_sorted = []
10+
L1_sorted = sorted(L1)
11+
512
L2 = [9,8,7,6,5,4,3,2,1]
6-
L2_sorted = []
13+
L2_sorted = sorted(L2)
14+
715
L3 = [1,1,1,1,1,1,1,1,1]
8-
L3_sorted = []
16+
L3_sorted = sorted(L3)
17+
918
L4 = [6,7,3,5,1,3]
10-
L4_sorted = [1,3,3,5,6,7]
19+
L4_sorted = sorted(L4)
20+
1121
L5 = []
1222
L5_sorted = []
1323

1424

1525
# Bubblesort
16-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
17-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
18-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
19-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
20-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
26+
def test_bubblesort():
27+
assert bubblesort(L1) == L1_sorted, "Not correctly sorted"
28+
assert bubblesort(L4) == L4_sorted, "Not correctly sorted"
29+
assert bubblesort(L4) == L4_sorted, "Not correctly sorted"
30+
assert bubblesort(L4) == L4_sorted, "Not correctly sorted"
31+
assert bubblesort(L4) == L4_sorted, "Not correctly sorted"
2132

2233
# Selectionsort
23-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
24-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
25-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
26-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
27-
assert sorted(L4) == L4_sorted, "Not correctly sorted"
34+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
35+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
36+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
37+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
38+
# assert sorted(L4) == L4_sorted, "Not correctly sorted"
2839

2940
# Heapsort
3041

0 commit comments

Comments
 (0)