Skip to content
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
29 changes: 29 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Unit tests

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

jobs:
code_style:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: swe4s
environment-file: environment.yml
- run: pycodestyle $(git ls-files "*.py")

unit_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
cd test/unit
python -m unittest test_utils
28 changes: 28 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: swe4s
channels:
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- bzip2=1.0.8=h7f98852_4
- ca-certificates=2022.9.24=ha878542_0
- ld_impl_linux-64=2.36.1=hea4e1c9_2
- libffi=3.4.2=h7f98852_5
- libgcc-ng=12.1.0=h8d9b700_16
- libgomp=12.1.0=h8d9b700_16
- libnsl=2.0.0=h7f98852_0
- libsqlite=3.39.4=h753d276_0
- libuuid=2.32.1=h7f98852_1000
- libzlib=1.2.12=h166bdaf_4
- ncurses=6.3=h27087fc_1
- openssl=3.0.5=h166bdaf_2
- pip=22.2.2=pyhd8ed1ab_0
- pycodestyle=2.9.1=pyhd8ed1ab_0
- python=3.10.6=ha86cf86_0_cpython
- readline=8.1.2=h0f457ee_0
- setuptools=65.4.1=pyhd8ed1ab_0
- tk=8.6.12=h27826a3_0
- tzdata=2022d=h191b570_0
- wheel=0.37.1=pyhd8ed1ab_0
- xz=5.2.6=h166bdaf_0
prefix: /home/jovyan/.conda/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()