Skip to content
This repository was archived by the owner on Feb 13, 2020. It is now read-only.

Commit d15f79f

Browse files
committed
updated tests
1 parent 61ee632 commit d15f79f

File tree

7 files changed

+56
-27
lines changed

7 files changed

+56
-27
lines changed

README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
# Hello cheatera!
2-
### **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!!!**
2+
### **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!!!**
33

44
So you can ask me: `How can we use these gorgeous unit-tests?` I can easily answer: `You just need to...`
55

66
### 1. Open unit-test folder
7+
78
### 2. Watch out for an appropriate test for you
9+
810
For example you need to test day01 of your piscine: `test_d01.py` fits perfectly
11+
912
### 3. Then you need to configure this test for your purposes
10-
For example your `d01` folder lies this way:
1113

12-
├── d01
13-
└── unit-tests
14-
So you need to edit head of `test_d01.py` the next way:
15-
```python
16-
#!/usr/bin/python
14+
Go to `unit-tests` folder and run the `configurator.sh` script with one argument:
15+
16+
Usage:
17+
18+
./configurator.sh <Path_to_your_php_piscine_folder>
1719

18-
from helper import *
20+
Example:
1921

20-
day_location = "../d01/"
21-
helpers = "helpers_d01/"
22+
./configurator.sh /Users/vbrazas/projects/archive/php_piscine/
23+
~OR~
24+
./configurator.sh ../
2225

23-
# START OF TESTS START OF TESTS START OF TESTS START OF TESTS
24-
```
25-
### Congrats! Now unit-test is finally configured and you can easily run it:
26-
```bash
27-
./test_d01.py
28-
```
26+
Now you can easely use all tests!

unit-tests/configurator.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#/bin/zsh
2+
3+
if [[ ! "$1" ]]; then
4+
echo "Usage: ./configurator.sh <Path_to_your_php_piscine_folder>"
5+
exit 1
6+
fi
7+
8+
PWD=$(pwd)
9+
PP=$(cd $1; pwd)
10+
11+
for i in {1..7}; do
12+
k='py'
13+
if (( i == 5 )); then continue; fi
14+
if (( i == 6 )); then k='sh'; fi
15+
sed -i '' -e "s|day_location = .*|day_location = '$PP/d0$i/'|" test_d0${i}.$k
16+
sed -i '' -e "s|helpers = .*|helpers = '$PWD/helpers_d0$i/'|" test_d0${i}.$k
17+
done
18+
19+
printf "Paths successfully updated to:\n"
20+
echo "Piscine path: $PP"
21+
echo "Helpers path: $PWD"

unit-tests/test_d01.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from helper import *
44

5-
day_location = "/Users/vbrazas/projects/archive/php_piscine/d01/"
6-
helpers = "/Users/vbrazas/projects/archive/php_piscine/unit-tests/helpers_d01/"
5+
day_location = '/Users/vbrazas/projects/archive/php_piscine/d01/'
6+
helpers = '/Users/vbrazas/projects/archive/php_piscine/unit-tests/helpers_d01/'
77

88
# START OF TESTS START OF TESTS START OF TESTS START OF TESTS
99

@@ -124,7 +124,8 @@
124124
print("")
125125

126126
test_command('php ' + day_location + 'ex09/ssap2.php', "")
127-
test_command('php ' + day_location + 'ex09/ssap2.php toto tutu 4234 "_hop XXX" "##" "1948372 AhAhAh"', """AhAhAh
127+
test_command('php ' + day_location + 'ex09/ssap2.php toto tutu 4234 "_hop XXX" "##" "1948372 AhAhAh"'
128+
, """AhAhAh
128129
toto
129130
tutu
130131
XXX
@@ -133,18 +134,27 @@
133134
##
134135
_hop
135136
""")
137+
test_command('php ' + day_location + 'ex09/ssap2.php abcd# abcd1 abcdA abcda'
138+
, """abcdA
139+
abcda
140+
abcd1
141+
abcd#
142+
""")
136143
test_command('php ' + day_location + 'ex09/ssap2.php aaa aaaa', """aaa
137144
aaaa
138145
""")
139146
test_command('php ' + day_location + 'ex09/ssap2.php "aaa aaaa"', """aaa
140147
aaaa
141148
""")
142-
test_command('php ' + day_location + 'ex09/ssap2.php "hello "', """hello
149+
test_command('php ' + day_location + 'ex09/ssap2.php "hello "'
150+
, """hello
143151
""")
144-
test_command('php ' + day_location + 'ex09/ssap2.php "aaaa aaa"', """aaa
152+
test_command('php ' + day_location + 'ex09/ssap2.php "aaaa aaa"'
153+
, """aaa
145154
aaaa
146155
""")
147-
test_command('php ' + day_location + 'ex09/ssap2.php aaaa aaa', """aaa
156+
test_command('php ' + day_location + 'ex09/ssap2.php aaaa aaa'
157+
, """aaa
148158
aaaa
149159
""")
150160
# TODO: someone some tests here to test the ord thingy

unit-tests/test_d02.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from helper import *
44

5-
day_location = "/Users/vbrazas/projects/archive/php_piscine/d02/"
6-
helpers = "/Users/vbrazas/projects/archive/php_piscine/unit-tests/resources_d02/"
5+
day_location = '/Users/vbrazas/projects/archive/php_piscine/d02/'
6+
helpers = '/Users/vbrazas/projects/archive/php_piscine/unit-tests/helpers_d02/'
77

88
# START OF TESTS START OF TESTS START OF TESTS START OF TESTS
99

unit-tests/test_d03.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# from os.path import isfile
99
# from os.path import isdir
1010

11-
day_location = "http://localhost:8100/deleteme"
12-
# day_location = "http://localhost:8100/php_piscine/d03"
11+
day_location = '/Users/vbrazas/projects/archive/php_piscine/d03/'
12+
# day_location = '/Users/vbrazas/projects/archive/php_piscine/d03/'
1313

1414
# START OF TESTS START OF TESTS START OF TESTS START OF TESTS
1515

unit-tests/test_d07.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# expanduser, isfile, isdir, chdir
77
import os
88

9-
day_location = "/Users/vbrazas/.Trash/vbrazas2/"
9+
day_location = '/Users/vbrazas/projects/archive/php_piscine/d07/'
1010
resources = "/Users/vbrazas/projects/php_piscine/unit-tests/resources_d07/"
1111
tester_dir = os.getcwd()
1212

0 commit comments

Comments
 (0)