diff --git a/README.md b/README.md index f3696ff..045ffb1 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,26 @@ # Hello cheatera! -### **Some of us use checkers time to time, some of us haven't used it before, but today everything will change! Introducing pyChecker for php_piscine!!!** +### **Some of us use checkers time to time, some of us haven't used it before, but today everything will change! Introducing Checker for php_piscine!!!** So you can ask me: `How can we use these gorgeous unit-tests?` I can easily answer: `You just need to...` ### 1. Open unit-test folder + ### 2. Watch out for an appropriate test for you + For example you need to test day01 of your piscine: `test_d01.py` fits perfectly + ### 3. Then you need to configure this test for your purposes -For example your `d01` folder lies this way: - ├── d01 - └── unit-tests -So you need to edit head of `test_d01.py` the next way: -```python -#!/usr/bin/python +Go to `unit-tests` folder and run the `configurator.sh` script with one argument: + +Usage: + + ./configurator.sh -from helper import * +Example: -day_location = "../d01/" -helpers = "helpers_d01/" + ./configurator.sh /Users/vbrazas/projects/archive/php_piscine/ + ~OR~ + ./configurator.sh ../ -# START OF TESTS START OF TESTS START OF TESTS START OF TESTS -``` -### Congrats! Now unit-test is finally configured and you can easily run it: -```bash -./test_d01.py -``` \ No newline at end of file +Now you can easely use all tests! diff --git a/unit-tests/configurator.sh b/unit-tests/configurator.sh new file mode 100755 index 0000000..649dd4b --- /dev/null +++ b/unit-tests/configurator.sh @@ -0,0 +1,21 @@ +#/bin/zsh + +if [[ ! "$1" ]]; then + echo "Usage: ./configurator.sh " + exit 1 +fi + +PWD=$(pwd) +PP=$(cd $1; pwd) + +for i in {1..7}; do + k='py' + if (( i == 5 )); then continue; fi + if (( i == 6 )); then k='sh'; fi + sed -i '' -e "s|day_location = .*|day_location = '$PP/d0$i/'|" test_d0${i}.$k + sed -i '' -e "s|helpers = .*|helpers = '$PWD/helpers_d0$i/'|" test_d0${i}.$k +done + +printf "Paths successfully updated to:\n" +echo "Piscine path: $PP" +echo "Helpers path: $PWD" diff --git a/unit-tests/test_d01.py b/unit-tests/test_d01.py index 28fb77a..d6a59f5 100755 --- a/unit-tests/test_d01.py +++ b/unit-tests/test_d01.py @@ -2,8 +2,8 @@ from helper import * -day_location = "/Users/vbrazas/projects/archive/php_piscine/d01/" -helpers = "/Users/vbrazas/projects/archive/php_piscine/unit-tests/helpers_d01/" +day_location = '/Users/vbrazas/projects/archive/php_piscine/d01/' +helpers = '/Users/vbrazas/projects/archive/php_piscine/unit-tests/helpers_d01/' # START OF TESTS START OF TESTS START OF TESTS START OF TESTS @@ -124,7 +124,8 @@ print("") test_command('php ' + day_location + 'ex09/ssap2.php', "") -test_command('php ' + day_location + 'ex09/ssap2.php toto tutu 4234 "_hop XXX" "##" "1948372 AhAhAh"', """AhAhAh +test_command('php ' + day_location + 'ex09/ssap2.php toto tutu 4234 "_hop XXX" "##" "1948372 AhAhAh"' +, """AhAhAh toto tutu XXX @@ -133,18 +134,27 @@ ## _hop """) +test_command('php ' + day_location + 'ex09/ssap2.php abcd# abcd1 abcdA abcda' +, """abcdA +abcda +abcd1 +abcd# +""") test_command('php ' + day_location + 'ex09/ssap2.php aaa aaaa', """aaa aaaa """) test_command('php ' + day_location + 'ex09/ssap2.php "aaa aaaa"', """aaa aaaa """) -test_command('php ' + day_location + 'ex09/ssap2.php "hello "', """hello +test_command('php ' + day_location + 'ex09/ssap2.php "hello "' +, """hello """) -test_command('php ' + day_location + 'ex09/ssap2.php "aaaa aaa"', """aaa +test_command('php ' + day_location + 'ex09/ssap2.php "aaaa aaa"' +, """aaa aaaa """) -test_command('php ' + day_location + 'ex09/ssap2.php aaaa aaa', """aaa +test_command('php ' + day_location + 'ex09/ssap2.php aaaa aaa' +, """aaa aaaa """) # TODO: someone some tests here to test the ord thingy diff --git a/unit-tests/test_d02.py b/unit-tests/test_d02.py index 608419a..82f62f5 100755 --- a/unit-tests/test_d02.py +++ b/unit-tests/test_d02.py @@ -2,8 +2,8 @@ from helper import * -day_location = "/Users/vbrazas/projects/archive/php_piscine/d02/" -helpers = "/Users/vbrazas/projects/archive/php_piscine/unit-tests/resources_d02/" +day_location = '/Users/vbrazas/projects/archive/php_piscine/d02/' +helpers = '/Users/vbrazas/projects/archive/php_piscine/unit-tests/helpers_d02/' # START OF TESTS START OF TESTS START OF TESTS START OF TESTS diff --git a/unit-tests/test_d03.py b/unit-tests/test_d03.py index b895c70..db7e3c3 100755 --- a/unit-tests/test_d03.py +++ b/unit-tests/test_d03.py @@ -8,8 +8,8 @@ # from os.path import isfile # from os.path import isdir -day_location = "http://localhost:8100/deleteme" -# day_location = "http://localhost:8100/php_piscine/d03" +day_location = '/Users/vbrazas/projects/archive/php_piscine/d03/' +# day_location = '/Users/vbrazas/projects/archive/php_piscine/d03/' # START OF TESTS START OF TESTS START OF TESTS START OF TESTS diff --git a/unit-tests/test_d06.zsh b/unit-tests/test_d06.sh similarity index 100% rename from unit-tests/test_d06.zsh rename to unit-tests/test_d06.sh diff --git a/unit-tests/test_d07.py b/unit-tests/test_d07.py index deccc31..6bb4061 100755 --- a/unit-tests/test_d07.py +++ b/unit-tests/test_d07.py @@ -6,7 +6,7 @@ # expanduser, isfile, isdir, chdir import os -day_location = "/Users/vbrazas/.Trash/vbrazas2/" +day_location = '/Users/vbrazas/projects/archive/php_piscine/d07/' resources = "/Users/vbrazas/projects/php_piscine/unit-tests/resources_d07/" tester_dir = os.getcwd()