Skip to content

Commit d4a8726

Browse files
committed
[FEATURE] Added libftest to the testing suite for the libft.
1 parent 627080d commit d4a8726

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libftest"]
2+
path = libftest
3+
url = https://github.com/jtoty/libftest

42PyChecker.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import subprocess
55
import re
66

7+
78
def check_author_file(project_path: str):
89
"""
910
:param project_path: The path of the project where you want to check the author file
@@ -221,6 +222,23 @@ def check_forbidden_functions(project_path: str, binary: str):
221222
return 0
222223

223224

225+
def run_libftest(project_path: str):
226+
try:
227+
open("libftest/my_config.sh", 'r')
228+
except FileNotFoundError:
229+
subprocess.run(['bash', "libftest/grademe.sh"])
230+
with open('libftest/my_config.sh', 'r') as file:
231+
filedata = file.read()
232+
filedata = filedata.replace('PATH_LIBFT=~/libft', "PATH_LIBFT=" + project_path)
233+
filedata = filedata.replace('PATH_DEEPTHOUGHT=${PATH_TEST}', "PATH_DEEPTHOUGHT=" + os.path.dirname(os.path.realpath(__file__)))
234+
with open('libftest/my_config.sh', 'w') as file:
235+
file.write(filedata)
236+
# @todo Parse libftest output for UI and parse score for display and return values.
237+
subprocess.run(['bash', "libftest/grademe.sh", "-s -f -n -u"])
238+
os.rename("deepthought", ".mylibftest")
239+
return 0
240+
241+
224242
def check_libft(project_path: str):
225243
required_functions = ['libft.h', 'ft_strcat.c', 'ft_strncat.c',
226244
'ft_strlcat.c', 'ft_strchr.c', 'ft_strnstr.c',
@@ -265,10 +283,11 @@ def check_libft(project_path: str):
265283
file.write(result)
266284
check_makefile(project_path, "libft.a")
267285
check_forbidden_functions(project_path, "libft.a")
286+
run_libftest(project_path)
268287
#moulitest
269288
#libft-unit-test
270289
#maintest
271290
return 0
272291

273292

274-
sys.exit(check_forbidden_functions("/tmp/libft", "libft.a"))
293+
sys.exit(check_libft("/tmp/libft"))

libftest

Submodule libftest added at 63f6c49

0 commit comments

Comments
 (0)