-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: automatically trim output and compare
- Loading branch information
Showing
3 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,7 +207,8 @@ | |
source: [ | ||
{ | ||
name: '1', | ||
source: '123', | ||
source: `123 | ||
`, | ||
}, | ||
], | ||
dataSet: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,36 @@ | ||
import {JudgeRequest, JudgeSourceType, JudgeType, OutputOnly} from "../types/request"; | ||
import { | ||
JudgeRequest, | ||
JudgeSourceType, | ||
JudgeType, | ||
OutputOnly, | ||
} from '../types/request' | ||
|
||
import judgeText from './text'; | ||
import judgeText from './text' | ||
|
||
export function isSame(in1: string, in2: string): boolean { | ||
let res1 = in1 | ||
.split('\n') | ||
.map((str) => str.trimEnd()) | ||
.filter((x) => x), | ||
res2 = in2 | ||
.split('\n') | ||
.map((str) => str.trimEnd()) | ||
.filter((x) => x) | ||
return res1.length === res2.length && res1.every((x, i) => x === res2[i]) | ||
} | ||
|
||
export default function (data: JudgeRequest) { | ||
switch (data.judgeType) { | ||
case JudgeType.OutputOnly: | ||
return judgeText(data as JudgeRequest<JudgeType.OutputOnly, JudgeSourceType.TEXT, OutputOnly>); | ||
return judgeText( | ||
data as JudgeRequest< | ||
JudgeType.OutputOnly, | ||
JudgeSourceType.TEXT, | ||
OutputOnly | ||
> | ||
) | ||
case JudgeType.CommonJudge: | ||
switch (data.language) { | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters