This repository was archived by the owner on Feb 13, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +56
-27
lines changed
Expand file tree Collapse file tree 7 files changed +56
-27
lines changed Original file line number Diff line number Diff line change 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
44So 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+
810For 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!
Original file line number Diff line number Diff line change 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 "
Original file line number Diff line number Diff line change 22
33from 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
124124print ("" )
125125
126126test_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
128129toto
129130tutu
130131XXX
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+ """ )
136143test_command ('php ' + day_location + 'ex09/ssap2.php aaa aaaa' , """aaa
137144aaaa
138145""" )
139146test_command ('php ' + day_location + 'ex09/ssap2.php "aaa aaaa"' , """aaa
140147aaaa
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
145154aaaa
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
148158aaaa
149159""" )
150160# TODO: someone some tests here to test the ord thingy
Original file line number Diff line number Diff line change 22
33from 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
Original file line number Diff line number Diff line change 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
File renamed without changes.
Original file line number Diff line number Diff line change 66# expanduser, isfile, isdir, chdir
77import os
88
9- day_location = " /Users/vbrazas/.Trash/vbrazas2/"
9+ day_location = ' /Users/vbrazas/projects/archive/php_piscine/d07/'
1010resources = "/Users/vbrazas/projects/php_piscine/unit-tests/resources_d07/"
1111tester_dir = os .getcwd ()
1212
You can’t perform that action at this time.
0 commit comments