diff --git a/dep-tests.toml b/dep-tests.toml index 6dce855..17def88 100644 --- a/dep-tests.toml +++ b/dep-tests.toml @@ -4,6 +4,7 @@ exclude = [ "c2-chacha:0.2.3", # よくわからない理由でビルドに失敗する "derive_more:0.99.2", # 必要なファイルがexcludeされている + "jemalloc-ctl:0.3.3", # CI上で偶にSIGFPEで落ちる。テストがまずいのか根本的にまずいのか不明 "libm:0.1.4", # `#![deny(warnings)]` "mac:0.1.1", # `#![deny(warnings)]` "nom:5.0.1", # 必要なファイルがexcludeされている @@ -14,9 +15,9 @@ exclude = [ "rand:0.6.5", # 現状同一の`name`のpackageは一つのworkspace内で共存できない "rand_core:0.3.1", # よくわからない理由でビルドに失敗する "rand_pcg:0.1.2", # 現状同一の`name`のpackageは一つのworkspace内で共存できない + "smallvec:0.6.13", # 現状同一の`name`のpackageは一つのworkspace内で共存できない "syn:0.15.44", # よくわからない理由でビルドに失敗する "syn:1.0.8", # よくわからない理由でビルドに失敗する - "smallvec:0.6.13", # 現状同一の`name`のpackageは一つのworkspace内で共存できない ] # key部分でSPECを指定すると、そのSPECの対象のpackageはvalue部分で指定したtargetのみ実行する。 diff --git a/examples/apg4b-a.rs b/examples/apg4b-a.rs new file mode 100644 index 0000000..20e8cfe --- /dev/null +++ b/examples/apg4b-a.rs @@ -0,0 +1,64 @@ +use aho_corasick as _; +use alga as _; +use approx as _; +use ascii as _; +use bitset_fixed as _; +use defmac as _; +use derive_more as _; +use derive_new as _; +use either as _; +use euclid as _; +use fixedbitset as _; +use getrandom as _; +use if_chain as _; +use im_rc as _; +use indexmap as _; +use itertools as _; +use itertools_num as _; +use lazy_static as _; +use libm as _; +use mac as _; +use maplit as _; +use modtype as _; +use nalgebra as _; +use ndarray as _; +use nom as _; +use num as _; +use num_bigint as _; +use num_complex as _; +use num_derive as _; +use num_integer as _; +use num_iter as _; +use num_rational as _; +use num_traits as _; +use ordered_float as _; +use permutohedron as _; +use petgraph as _; +use primal as _; +use primal_check as _; +use primal_estimate as _; +use primal_sieve as _; +use proconio as _; +use rand as _; +use rand_chacha as _; +use rand_core as _; +use rand_distr as _; +use rand_hc as _; +use rand_pcg as _; +use regex as _; +use rustc_hash as _; +use smallvec as _; +use strsim as _; +use superslice as _; +use take_mut as _; +use text_io as _; +use whiteread as _; + +#[cfg(feature = "jemalloc-ctl")] +use jemalloc_ctl as _; +#[cfg(feature = "jemallocator")] +use jemallocator as _; + +fn main() { + println!("Hello, world!"); +} diff --git a/examples/tests.ron b/examples/tests.ron index 6abbc51..445367d 100644 --- a/examples/tests.ron +++ b/examples/tests.ron @@ -1,12 +1,16 @@ ( tests: { + "apg4b-a": ( + name: "APG4b: A - 1.00.はじめに", + matching: ExactWhole, + ), "practice-a": ( name: "practice contest: A - Welcome to AtCoder", - word_match: Exact, + matching: ExactWords, ), "arc065-c": ( name: "ABC049 / ARC065: C - 白昼夢 / Daydream", - word_match: Exact, + matching: ExactWords, ), } ) diff --git a/examples/testsets/apg4b-a/in/sample_01.txt b/examples/testsets/apg4b-a/in/sample_01.txt new file mode 100644 index 0000000..e69de29 diff --git a/examples/testsets/apg4b-a/out/sample_01.txt b/examples/testsets/apg4b-a/out/sample_01.txt new file mode 100644 index 0000000..af5626b --- /dev/null +++ b/examples/testsets/apg4b-a/out/sample_01.txt @@ -0,0 +1 @@ +Hello, world! diff --git a/tools/test-with-generated-opts/src/main.rs b/tools/test-with-generated-opts/src/main.rs index c9e59b6..0928fc7 100644 --- a/tools/test-with-generated-opts/src/main.rs +++ b/tools/test-with-generated-opts/src/main.rs @@ -14,7 +14,6 @@ use std::fs::{self, File}; use std::io::{self, Read as _, Write as _}; use std::path::{Path, PathBuf}; use std::process::{Command, Output, Stdio}; -use std::str::SplitWhitespace; use std::time::Instant; #[derive(StructOpt, Debug)] @@ -56,16 +55,16 @@ fn main() -> anyhow::Result<()> { let tests = tests .into_iter() - .map(|(slug, Test { name, word_match })| { + .map(|(slug, Test { name, matching })| { let src = Path::new("./examples").join(&slug).with_extension("rs"); let testsets = Path::new("./examples/testsets").join(&slug); let binary = compile(&src, tempdir.path(), &slug)?; - Ok((name, word_match, testsets, binary)) + Ok((name, matching, testsets, binary)) }) .collect::>>()?; - for (name, word_match, testsets, binary) in tests { - test(&name, word_match, &testsets, &binary)?; + for (name, matching, testsets, binary) in tests { + test(&name, matching, &testsets, &binary)?; } Ok(()) } @@ -135,12 +134,7 @@ fn compile(src: &Path, tempdir: &Path, dir_name: &str) -> anyhow::Result anyhow::Result<()> { +fn test(task_name: &str, matching: Matching, testsets: &Path, binary: &Path) -> anyhow::Result<()> { let testsets = { let find_files = |dir: &str| -> _ { fs::read_dir(testsets.join(dir))? @@ -199,8 +193,7 @@ fn test( }; let time = (stop - start).as_millis(); - let (expected, actual) = (expected.split_whitespace(), actual.split_whitespace()); - let verdict = if status.success() && word_match.accepts(expected, actual) { + let verdict = if status.success() && matching.accepts(&expected, &actual) { "AC" } else if status.success() { "WA" @@ -223,18 +216,22 @@ struct Tests { #[derive(Debug, Deserialize)] struct Test { name: String, - word_match: WordMatch, + matching: Matching, } #[derive(Debug, Clone, Copy, Deserialize)] -enum WordMatch { - Exact, +enum Matching { + ExactWhole, + ExactWords, } -impl WordMatch { - fn accepts(self, expected: SplitWhitespace, actual: SplitWhitespace) -> bool { +impl Matching { + fn accepts(self, expected: &str, actual: &str) -> bool { match self { - WordMatch::Exact => itertools::equal(expected, actual), + Matching::ExactWhole => expected == actual, + Matching::ExactWords => { + itertools::equal(expected.split_whitespace(), actual.split_whitespace()) + } } } }