Skip to content

Commit

Permalink
Improve judge.
Browse files Browse the repository at this point in the history
  • Loading branch information
agrawal-d committed Nov 24, 2023
1 parent 50127cc commit c7188b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/judge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ export const isResultCorrect = (
testCase: TestCase,
stdout: string,
): boolean => {
const expectedLines = testCase.output.trim().split('\n');
const resultLines = stdout.trim().split(EOL);
// convert crlf to lf
const expected = testCase.output.replace(/\r\n/g, '\n');
const result = stdout.replace(/\r\n/g, '\n');

const expectedLines = expected.trim().split('\n');
const resultLines = result.trim().split('\n');
console.log('res', resultLines);
if (expectedLines.length !== resultLines.length) {
console.log('Failed precheck', expectedLines, resultLines);
return false;
Expand Down
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"files":[
"src/types.ts",
],
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
Expand Down

0 comments on commit c7188b6

Please sign in to comment.