Skip to content

Commit 82df741

Browse files
authored
Fix checking of checker output (#65)
* Fix checking of checker output * Bump version * Add tests for this
1 parent 93b0499 commit 82df741

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/sinol_make/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from sinol_make import util
88

9-
__version__ = "1.3.1"
9+
__version__ = "1.3.2"
1010

1111
def configure_parsers():
1212
parser = argparse.ArgumentParser(

src/sinol_make/commands/run/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,8 @@ def check_output_checker(self, name, input_file, output_file, answer_file):
366366
pass
367367

368368
return True, points
369-
elif checker_output[0].strip() == "WRONG":
370-
return False, 0
371369
else:
372-
raise CheckerOutputException("Checker output is invalid.")
370+
return False, 0
373371

374372

375373
def check_output(self, name, input_file, output_file_path, output, answer_file_path):

tests/packages/chk/prog/chkchk.cpp

+16-2
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,32 @@
22

33
using namespace std;
44

5+
void print_wrong(char num, char letter) {
6+
if (num == '1' && letter == 'a')
7+
cout << "NOT OK" << endl;
8+
else if (num == '2' && letter == 'a')
9+
cout << "BAD" << endl;
10+
else if (num == '2' && letter == 'b')
11+
cout << "ABCDEF" << endl;
12+
else
13+
cout << "WRONG" << endl;
14+
}
15+
516
int main(int argc, char** argv) {
617
assert(argc == 4);
718
ifstream in(argv[1]);
819
ifstream out(argv[2]);
920
ifstream correct(argv[3]);
1021

22+
char num = argv[1][6];
23+
char letter = argv[1][7];
24+
1125
int ans, out_ans;
1226
correct >> ans;
1327
out >> out_ans;
1428

1529
if (ans == -1 && out_ans != -1) {
16-
cout << "WRONG" << endl;
30+
print_wrong(num, letter);
1731
cout << "Expected -1, got " << out_ans << endl;
1832
return 0;
1933
}
@@ -27,7 +41,7 @@ int main(int argc, char** argv) {
2741
}
2842

2943
if (out_ans > s) {
30-
cout << "WRONG" << endl;
44+
print_wrong(num, letter);
3145
cout << "Answer to big" << endl;
3246
return 0;
3347
}

0 commit comments

Comments
 (0)