From c7188b62d500b6b15a8b53924b260457310c4a82 Mon Sep 17 00:00:00 2001 From: Divyanshu Agrawal Date: Fri, 24 Nov 2023 16:25:12 +0530 Subject: [PATCH] Improve judge. --- src/judge.ts | 9 +++++++-- tsconfig.json | 3 --- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/judge.ts b/src/judge.ts index afea689..9c166fa 100644 --- a/src/judge.ts +++ b/src/judge.ts @@ -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; diff --git a/tsconfig.json b/tsconfig.json index 27182ad..64557c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,4 @@ { - "files":[ - "src/types.ts", - ], "compilerOptions": { "module": "commonjs", "target": "es2017",