Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #3

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/classex_unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

# make a job name: running unit tests
jobs:
unit_tests:
# configure the operating system 'environment'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
cd test/unit
python -m unittest test_utils.py
func_tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
# get to branch
- uses: actions/checkout@v2
# get the proper environment
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: swe4s
environment-file: environment.yml
# run the functional tests
- run: |
cd ./test/func
bash test_search.sh

# job for running pycodestyle
code_style:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
# checkout code again because independent jobs
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: swe4s
environment-file: environment.yml
# $() tells bash to do that command first
- run: pycodestyle $(git ls-files "*.py")

23 changes: 23 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: swe4s
channels:
- conda-forge
dependencies:
- bzip2=1.0.8=h1de35cc_0
- ca-certificates=2022.07.19=hecd8cb5_0
- certifi=2022.6.15=py310hecd8cb5_0
- libcxx=12.0.0=h2f01273_0
- libffi=3.3=hb1e8313_2
- ncurses=6.3=hca72f7f_3
- openssl=1.1.1q=hca72f7f_0
- pip=22.1.2=py310hecd8cb5_0
- pycodestyle=2.8.0=pyhd3eb1b0_0
- python=3.10.4=hdfd78df_0
- readline=8.1.2=hca72f7f_1
- setuptools=63.4.1=py310hecd8cb5_0
- sqlite=3.39.2=h707629a_0
- tk=8.6.12=h5d9f67b_0
- tzdata=2022a=hda174b7_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.2.5=hca72f7f_1
- zlib=1.2.12=h4dc903c_2
prefix: /Users/hopekirby/opt/anaconda3/envs/swe4s
13 changes: 6 additions & 7 deletions search.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def main():
linear_search_total_time += toc - tic

linear_search_mean_time = linear_search_total_time / args.num_searches
print('Linear search: ' \
+ '{:.5f}'.format(linear_search_mean_time) \
print('Linear search: '
+ '{:.5f}'.format(linear_search_mean_time)
+ ' seconds')

tic = time.perf_counter()
Expand All @@ -42,8 +42,8 @@ def main():

bsearch_idx_time = toc - tic

print('Indexing: ' \
+ '{:.5f}'.format(bsearch_idx_time) \
print('Indexing: '
+ '{:.5f}'.format(bsearch_idx_time)
+ ' seconds')

bsearch_total_time = 0
Expand All @@ -55,11 +55,10 @@ def main():
bsearch_total_time += toc - tic

bsearch_mean_time = bsearch_total_time / args.num_searches
print('Binary search: ' \
+ '{:.5f}'.format(bsearch_mean_time) \
print('Binary search: '
+ '{:.5f}'.format(bsearch_mean_time)
+ ' seconds')



if __name__ == '__main__':
main()