Skip to content

Commit

Permalink
Rust selection sort (#63)
Browse files Browse the repository at this point in the history
* expand clean, allow all keyword matching

* change keyword to any

* update CI

* update readme

* shorten

* update readme
  • Loading branch information
coilysiren authored Feb 23, 2020
1 parent e841cd5 commit 3d39240
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
pipenv sync
- name: run tests
run: pipenv run tests ${{ matrix.language }}
run: pipenv run tests ${{ matrix.language }} any first_names
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ Then run any of these
```bash
# example CLI calls, run with as many args so you want
pipenv run tests
pipenv run tests $language $script_name $data
pipenv run tests $language $script $data
pipenv run tests python
pipenv run tests python sort_insertion_sort
pipenv run tests python sort_insertion_sort first_names_shortened
pipenv run tests python insertion_sort
pipenv run tests python insertion_sort first_names
# "any" is a wildcard keyword
pipenv run tests python any first_names
```
8 changes: 7 additions & 1 deletion scripts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,20 @@ def inputs_are_truthy_and_different(first, second):
# cleanup
first_cleaned = clean_string(first)
second_cleaned = clean_string(second)
# allow for wildcard matching
wildcard_keyword = "any"
if (first_cleaned == wildcard_keyword) or (second_cleaned == wildcard_keyword):
return False
# check if inputs are different
if first_cleaned != second_cleaned:
return True
return False


def clean_string(inp):
return inp.replace("-", "_").replace("_test", "")
for element in ["-", "_", "test", "sort"]:
inp = inp.replace(element, "")
return inp


if __name__ == "__main__":
Expand Down

0 comments on commit 3d39240

Please sign in to comment.