Skip to content

Commit cb2071c

Browse files
committed
[FEATURE] Added results display for libft_unit_test
1 parent c2d1b35 commit cb2071c

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

PyChecker/projects/libft.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ def check(root_path: str, args):
8888
if not args.no_maintest:
8989
maintest_ok, maintest_fail = maintest.run_libft(args.path, root_path)
9090
if not args.no_libft_unit_test:
91-
# @todo: Add return message/values to results for libft-unit-test
92-
libft_unit_test.run(root_path, args)
91+
libft_unit_test_results = libft_unit_test.run(root_path, args)
9392
print("\n\n\nThe results are in:\n")
9493
if not args.no_author:
9594
print("Author File: \n" + author_results + '\n')
@@ -115,4 +114,6 @@ def check(root_path: str, args):
115114
print("Libft Bonuses: " + libftest_results[2] + '\n')
116115
if not args.no_maintest:
117116
print("Maintest: \n{} OKs and {} FAILs.".format(maintest_ok, maintest_fail))
118-
return 0
117+
if not args.no_libft_unit_test:
118+
print('libft-unit-test: \n' + libft_unit_test_results)
119+
return 0

PyChecker/testing_suite/libft_unit_test.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import platform
77
import subprocess
88
import os
9+
import io
910

1011

1112
def run(root_path: str, args):
@@ -29,4 +30,14 @@ def run(root_path: str, args):
2930
result = subprocess.run([root_path + '/testing_suites/libft-unit-test/run_test', '-b'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode('utf-8')
3031
print(result)
3132
file.write(result)
32-
# @todo: return results from benchmark and tests
33+
# @todo: return results from benchmark
34+
with io.open(root_path + '/.mylibftunittest-results', "r", encoding="ISO-8859-1") as file:
35+
data = file.read()
36+
results = 'OKs: ' + str(data.count('OK')) + '\n'
37+
results += 'KOs: ' + str(data.count('KO')) + '\n'
38+
results += 'FAILED: ' + str(data.count('FAILED')) + '\n'
39+
results += 'NO CRASH: ' + str(data.count('NO CRASH')) + '\n'
40+
results += 'protected: ' + str(data.count('protected')) + '\n'
41+
results += 'not protected:' + str(data.count('not protected'))
42+
print(results)
43+
return results

0 commit comments

Comments
 (0)