Skip to content

Commit 1a30962

Browse files
committed
Remove unused sample statuses
1 parent 1792086 commit 1a30962

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

src/check_samples.rs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use anyhow::Result;
22
use colored::*;
33
use prettytable::{format, row, table, Table};
4-
use regex::Regex;
54
use std::collections::HashMap;
65
use std::io::Write;
76
use std::process::{Command, Stdio};
@@ -18,55 +17,15 @@ use crate::util::split_one_line_command;
1817
pub enum Status {
1918
AC,
2019
WA,
21-
TLE,
22-
RE,
2320
CE,
24-
WJ,
2521
}
2622

2723
impl Status {
28-
pub fn as_str(&self) -> &str {
29-
match self {
30-
Status::AC => "AC",
31-
Status::WA => "WA",
32-
Status::TLE => "TLE",
33-
Status::RE => "RE",
34-
Status::CE => "CE",
35-
Status::WJ => "WJ",
36-
}
37-
}
3824
pub fn as_display_string(&self) -> ColoredString {
3925
match self {
4026
Status::AC => "AC".green(),
4127
Status::WA => "!! WA !!".red(),
42-
Status::TLE => "!! TLE !!".yellow(),
43-
Status::RE => "!! RE !!".yellow(),
4428
Status::CE => "!! CE !!".yellow(),
45-
Status::WJ => "WJ".into(),
46-
}
47-
}
48-
49-
pub fn from_table_str(v: &str) -> Self {
50-
match v {
51-
"AC" => Status::AC,
52-
"WA" => Status::WA,
53-
"RE" => Status::RE,
54-
"TLE" => Status::TLE,
55-
"CE" => Status::CE,
56-
"WJ" => Status::WJ,
57-
_ => {
58-
let re = Regex::new(r"^(\d+) */ *(\d+) *(.*)$").unwrap();
59-
if let Some(caps) = re.captures(v) {
60-
let status = caps[3].trim();
61-
if status.is_empty() {
62-
Status::AC
63-
} else {
64-
Status::from_table_str(status)
65-
}
66-
} else {
67-
Status::WJ
68-
}
69-
}
7029
}
7130
}
7231
}
@@ -75,14 +34,10 @@ pub struct FailedDetail {
7534
pub index: usize,
7635
pub input: String,
7736
pub expected: String,
78-
#[allow(dead_code)]
79-
pub status: Status,
8037
pub output: String,
8138
}
8239

8340
pub struct SampleResults {
84-
#[allow(dead_code)]
85-
pub size: usize,
8641
pub total_status: Status,
8742
pub failed_details: Vec<FailedDetail>,
8843
}
@@ -187,7 +142,6 @@ pub fn sample_check(
187142
table = add_total_status_to_table(table, &total_status);
188143
table.printstd();
189144
return Ok(SampleResults {
190-
size: 0,
191145
total_status,
192146
failed_details: vec![],
193147
});
@@ -229,7 +183,6 @@ pub fn sample_check(
229183
failed_details.push(FailedDetail {
230184
index: sample_id,
231185
input: samples.inputs[i].clone().1,
232-
status: Status::WA,
233186
expected,
234187
output: output_str,
235188
});
@@ -242,7 +195,6 @@ pub fn sample_check(
242195
table.printstd();
243196

244197
Ok(SampleResults {
245-
size: samples.size,
246198
total_status,
247199
failed_details,
248200
})

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub fn get_config(args: &Option<GlobalArgs>) -> Result<ConfigMap> {
386386
Ok(config_map)
387387
}
388388

389-
fn config_check(mut config_map: ConfigMap) -> Result<ConfigMap> {
389+
fn config_check(config_map: ConfigMap) -> Result<ConfigMap> {
390390
let need = [
391391
"need_to_compile",
392392
"contest_dir",

0 commit comments

Comments
 (0)