Skip to content

Commit

Permalink
fix: trim end of each line in output
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Jun 1, 2023
1 parent c5abbbf commit b751acd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/judger/io_fast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,16 @@ impl Judger for FastIOJudgeSpec {
}

async fn judge_output(&self, _input: &Input, output: &Output) -> Result<(), String> {
let output_hash = digest(output.stdout.trim().as_bytes());
let output_hash = digest(
output
.stdout
.lines()
.map(|l| l.trim_end())
.collect::<Vec<_>>()
.join("\n")
.trim()
.as_bytes(),
);

if output_hash != self.output_hash {
return Err(format!(
Expand Down

0 comments on commit b751acd

Please sign in to comment.