Skip to content

Commit 074fab6

Browse files
authored
run output improvements (#32)
* Change printed messages * Print what tests will be run * Small fixes for tests * Reindent run with spaces * Remove remaining tabs * Reformat help message in code
1 parent dfcdfd6 commit 074fab6

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

src/sinol_make/commands/run/__init__.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def parse_memory(self, memory_str):
9696

9797

9898
def extract_test_no(self, test_path):
99-
return os.path.split(os.path.splitext(test_path)[0])[1][3:]
99+
return os.path.split(os.path.splitext(test_path)[0])[1][len(self.ID):]
100100

101101

102102
def extract_file_name(self, file_path):
@@ -730,21 +730,21 @@ def run(self, args):
730730
self.compilers, self.timetool_path = self.validate_arguments(args)
731731

732732
title = self.config["title"]
733-
print("Task %s (%s)" % (title, self.ID))
733+
print("Task: %s (tag: %s)" % (title, self.ID))
734734
config_time_limit = self.config["time_limit"]
735735
config_memory_limit = self.config["memory_limit"]
736736
self.time_limit = args.tl * 1000.0 if args.tl is not None else config_time_limit
737737
self.memory_limit = args.ml * 1024 if args.ml is not None else config_memory_limit
738738
self.cpus = args.cpus or mp.cpu_count()
739739
if self.time_limit == config_time_limit:
740-
print("Time limit (in ms):", self.time_limit)
740+
print(f'Time limit: {self.time_limit} ms')
741741
else:
742-
print("Time limit (in ms):", self.time_limit,
742+
print(f'Time limit: {self.time_limit} ms',
743743
util.warning(("[originally was %.1f ms]" % config_time_limit)))
744744
if self.memory_limit == config_memory_limit:
745-
print("Memory limit (in kb):", self.memory_limit)
745+
print(f'Memory limit: {self.memory_limit} kB')
746746
else:
747-
print("Memory limit (in kb):", self.memory_limit,
747+
print(f'Memory limit: {self.memory_limit} kB',
748748
util.warning(("[originally was %.1f kb]" % config_memory_limit)))
749749
self.scores = collections.defaultdict(int)
750750
print("Scores:")
@@ -758,6 +758,16 @@ def run(self, args):
758758
print()
759759

760760
self.tests = self.get_tests(args.tests)
761+
762+
if len(self.tests) > 0:
763+
print(util.bold('Tests that will be run:'), ' '.join([self.extract_file_name(test) for test in self.tests]))
764+
765+
example_tests = [test for test in self.tests if self.get_group(test) == 0]
766+
if len(example_tests) == len(self.tests):
767+
print(util.warning('Running only on example tests.'))
768+
else:
769+
print(util.warning('There are no tests to run.'))
770+
761771
self.groups = list(sorted(set([self.get_group(test) for test in self.tests])))
762772
self.possible_score = self.get_possible_score(self.groups)
763773

tests/packages/vso/prog/vso1.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using namespace std;
88

99
int main() {
10+
int a, b;
1011
cin >> a >> b;
1112
if (a == 1 && b == 1) {
1213
cout << 0;

tests/packages/vso/prog/vsoingen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ using namespace std;
44

55
int main() {
66
for (char c = 'a'; c <= 'e'; c++) {
7-
ofstream f("vso1" + c + ".in");
7+
string letter(1, c);
8+
ofstream f("vso1" + letter + ".in");
89
f << "1 " << (c - 'a' + 1) << endl;
910
f.close();
1011
}

0 commit comments

Comments
 (0)