This commit is contained in:
MeiK 2020-10-28 18:56:56 +08:00
parent 6d7438a7d8
commit e8f41cef28
2 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@ use super::config::{STDERR_FILENAME, STDOUT_FILENAME};
use super::error::{Error, Result};
use super::process::Process;
use super::runner::RunnerStatus;
use crate::result::stanard_result;
use crate::result::standard_result;
use crate::river::judge_response::State;
use crate::river::Language;
use crate::river::{CompileData, JudgeData, JudgeResult, JudgeStatus};
@ -88,7 +88,7 @@ pub async fn judger(
if let Err(e) = file.read_to_end(&mut out).await {
return Err(Error::ReadFileError(path.join(STDOUT_FILENAME), e));
};
let result = stanard_result(&out, &data.out_data)?;
let result = standard_result(&out, &data.out_data)?;
resp.state = Some(State::Result(result as i32));
}
Ok(resp)

View File

@ -1,7 +1,7 @@
use super::error::Result;
use crate::river::JudgeResult;
pub fn stanard_result(out: &[u8], ans: &[u8]) -> Result<JudgeResult> {
pub fn standard_result(out: &[u8], ans: &[u8]) -> Result<JudgeResult> {
let out_len = out.len();
let ans_len = ans.len();
let mut out_offset = 0;
@ -143,20 +143,20 @@ mod tests {
fn test5() {
let ans: &[u8] = "Hello World!".as_bytes();
let out: &[u8] = "Hello World!".as_bytes();
assert_eq!(stanard_result(out, ans).unwrap(), JudgeResult::Accepted);
assert_eq!(standard_result(out, ans).unwrap(), JudgeResult::Accepted);
}
#[test]
fn test6() {
let ans: &[u8] = "Hello World!".as_bytes();
let out: &[u8] = "Hello World! ".as_bytes();
assert_eq!(stanard_result(out, ans).unwrap(), JudgeResult::Accepted);
assert_eq!(standard_result(out, ans).unwrap(), JudgeResult::Accepted);
}
#[test]
fn test7() {
let ans: &[u8] = "Hello World! \n\n\n\n \n\n\n\n".as_bytes();
let out: &[u8] = "Hello World!\t\t\t\t\n\n\n\n \n\n\n\n\t\t\t\t".as_bytes();
assert_eq!(stanard_result(out, ans).unwrap(), JudgeResult::Accepted);
assert_eq!(standard_result(out, ans).unwrap(), JudgeResult::Accepted);
}
}