-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from ColColty/dev
Adding reformed code v1.2
- Loading branch information
Showing
15 changed files
with
387 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
FROM python:3 | ||
|
||
COPY makefile_completer.py /app/makefile_completer.py | ||
COPY . /app | ||
|
||
RUN pip install --upgrade pip | ||
RUN pip install watchdog | ||
|
||
CMD [ "python3", "/app/makefile_completer.py" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,63 @@ | ||
#!/bin/bash | ||
|
||
echo -e "\033[1m Testing whem we the file has a bad extension\033[0m" | ||
|
||
touch testing/src/bad_extension_file.pdf | ||
# ================ functions ====================== | ||
function test_add() { | ||
touch $1 | ||
|
||
sleep 3 | ||
sleep 4 | ||
|
||
python3 ./ci/tests/find_file.py "./testing/" "SRC\t=" "/bad_extension_file.pdf" | ||
python3 ./ci/tests/find_file.py $2 $3 $4 | ||
|
||
if [ $? -ne 84 ]; then | ||
echo -e "When the file has another extension than \".c\" it won't be add to Makefile" | ||
exit 84 | ||
fi | ||
if [ $? -ne $5 ]; then | ||
echo -e "$1 FAILED with code $?" | ||
exit 84 | ||
else | ||
echo -e "\033[1;32m$1 PASSED\033[0m" | ||
fi | ||
|
||
rm testing/src/bad_extension_file.pdf | ||
rm $1 | ||
sleep 2 | ||
} | ||
|
||
echo -e "\033[1;32mTest 1 passed\033[0m" | ||
function test_add_wfolder() { | ||
mkdir $1 | ||
touch $1/$2 | ||
|
||
echo -e "\033[1m Testing whem we add a file in src\033[0m" | ||
sleep 4 | ||
|
||
touch testing/src/good_file.c | ||
python3 ./ci/tests/find_file.py $3 $4 $5 | ||
|
||
sleep 3 | ||
if [ $? -ne $6 ]; then | ||
echo "$1/$2 FAILED with exit code $?" | ||
exit 84 | ||
else | ||
echo -e "\033[1;32m$1/$2 PASSED\033[0m" | ||
fi | ||
|
||
python3 ./ci/tests/find_file.py "./testing/" "SRC\t=" "/good_file.c" | ||
rm $1/$2 | ||
sleep 2 | ||
} | ||
|
||
if [ $? -ne 0 ]; then | ||
echo -e "When a file with \".c\" extension was created it would be added to Makefile" | ||
exit 84 | ||
fi | ||
|
||
rm testing/src/good_file.c | ||
echo -e "\033[1m Testing whem we the file has a bad extension\033[0m" | ||
test_add testing/src/bad_extension_file.pdf "./testing/" "SRC\t=" "/bad_extension_file.pdf" 84 | ||
|
||
echo -e "\033[1;32mTest 2 passed\033[0m" | ||
echo -e "\033[1m Testing whem we add a file in src\033[0m" | ||
test_add testing/src/good_file.c "./testing/" "SRC\t=" "/good_file.c" 0 | ||
|
||
echo -e "\033[1m Testing whem we add a file on a folder in src\033[0m" | ||
|
||
mkdir testing/src/folder | ||
touch testing/src/folder/good_file.c | ||
|
||
sleep 3 | ||
|
||
python3 ./ci/tests/find_file.py "./testing/" "SRC\t=" "/folder/good_file.c" | ||
|
||
if [ $? -ne 0 ]; then | ||
echo -e "When a file with \".c\" extension was created it would be added to Makefile" | ||
exit 84 | ||
fi | ||
|
||
rm testing/src/folder/good_file.c | ||
|
||
echo -e "\033[1;32mTest 3 passed\033[0m" | ||
test_add_wfolder testing/src/folder good_file.c "./testing/" "SRC\t=" "/folder/good_file.c" 0 | ||
|
||
echo -e "\033[1m Testing whem we add a file on tests\033[0m" | ||
|
||
touch testing/tests/good_tests_file.c | ||
|
||
sleep 3 | ||
|
||
python3 ./ci/tests/find_file.py "./testing/" "TESTS\t=" "/good_tests_file.c" | ||
|
||
if [ $? -ne 0 ]; then | ||
echo -e "When a file with \".c\" extension was created it would be added to Makefile" | ||
exit 84 | ||
fi | ||
|
||
rm testing/tests/good_tests_file.c | ||
|
||
echo -e "\033[1;32mTest 4 passed\033[0m" | ||
test_add testing/tests/good_tests_file.c "./testing/" "TESTS\t=" "/good_tests_file.c" 0 | ||
|
||
echo -e "\033[1m Testing whem we add a file in a folder in tests\033[0m" | ||
|
||
mkdir testing/tests/folder | ||
touch testing/tests/folder/good_tests_file.c | ||
|
||
sleep 3 | ||
|
||
python3 ./ci/tests/find_file.py "./testing/" "TESTS\t=" "/folder/good_tests_file.c" | ||
|
||
if [ $? -ne 0 ]; then | ||
echo -e "When a file with \".c\" extension was created it would be added to Makefile" | ||
exit 84 | ||
fi | ||
|
||
rm testing/tests/folder/good_tests_file.c | ||
|
||
echo -e "\033[1;32mTest 5 passed\033[0m" | ||
test_add_wfolder testing/tests/folder good_tests_file.c "./testing/" "TESTS\t=" "/folder/good_tests_file.c" 0 | ||
|
||
echo -e "\033[1m Testing whem we add a file in lib/my\033[0m" | ||
|
||
touch testing/lib/my/good_lib_file.c | ||
|
||
sleep 3 | ||
|
||
python3 ./ci/tests/find_file.py "./testing/lib/my/" "SRC\t=" "good_lib_file.c" | ||
|
||
if [ $? -ne 0 ]; then | ||
echo -e "When a file with \".c\" extension was created it would be added to Makefile" | ||
exit 84 | ||
fi | ||
|
||
rm testing/lib/my/good_lib_file.c | ||
|
||
echo -e "\033[1;32mTest 6 passed\033[0m" | ||
test_add testing/lib/my/good_lib_file.c "./testing/lib/my/" "SRC\t=" "good_lib_file.c" 0 | ||
|
||
echo -e "\033[1m Testing whem we add a file in a folder in lib/my\033[0m" | ||
|
||
|
||
mkdir testing/lib/my/folder | ||
touch testing/lib/my/folder/good_lib_file.c | ||
|
||
sleep 3 | ||
|
||
python3 ./ci/tests/find_file.py "./testing/lib/my/" "SRC\t=" "folder/good_lib_file.c" | ||
|
||
if [ $? -ne 0 ]; then | ||
echo -e "When a file with \".c\" extension was created it would be added to Makefile" | ||
exit 84 | ||
fi | ||
|
||
rm testing/lib/my/folder/good_lib_file.c | ||
|
||
echo -e "\033[1;32mTest 7 passed\033[0m" | ||
test_add_wfolder testing/lib/my/folder good_lib_file.c "./testing/lib/my/" "SRC\t=" "folder/good_lib_file.c" 0 | ||
|
||
exit 0 |
Oops, something went wrong.