From e45143d59beabf409f00300b12f674b0b5048258 Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Mon, 7 Sep 2020 07:09:48 +0900 Subject: [PATCH] Add a prefix to each package names to adapt to rust-lang/cargo#7959 --- CHANGELOG.md | 22 +++ resources/compete.toml.liquid | 17 ++- src/commands/new.rs | 139 ++++++++++++------ tests/new.rs | 37 +++-- .../init__atcoder_no_crate_file_tree.snap | 2 +- .../init__atcoder_use_crate_file_tree.snap | 2 +- ...tcoder_use_crate_via_bianry_file_tree.snap | 2 +- .../snapshots/init__codeforces_file_tree.snap | 2 +- .../new__yukicoder_contest_100_file_tree.snap | 31 ++++ .../new__yukicoder_contest_100_output.snap | 12 ++ 10 files changed, 203 insertions(+), 63 deletions(-) create mode 100644 tests/snapshots/new__yukicoder_contest_100_file_tree.snap create mode 100644 tests/snapshots/new__yukicoder_contest_100_output.snap diff --git a/CHANGELOG.md b/CHANGELOG.md index 79a0292..582b793 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [Unreleased] + +### Added + +- [`new`] Added `contest` variable to `new.path`. + +### Changed + +- [`new`] Package names will be `"contest{}"` to adapt to [rust-lang/cargo#7959](https://github.com/rust-lang/cargo/pull/7959). + + Modify `new.path` as following. + + ```diff + -path = "./{{ package_name }}" + +path = "./{{ contest }}" + ``` + +### Fixed + +- [`new`] `new.path` will work correctly. +- [`new`] `new` command for yukicoder will work properly. + ## [0.5.1] - 2020-09-04Z ### Added diff --git a/resources/compete.toml.liquid b/resources/compete.toml.liquid index a13cffa..99f109e 100644 --- a/resources/compete.toml.liquid +++ b/resources/compete.toml.liquid @@ -20,8 +20,23 @@ test-suite = {% raw %}"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.ym #open = '["emacsclient", "-n"] + (.paths | map([.src, .test_suite]) | flatten)' [new] +# Platform +# +# - atcoder +# - codeforces +# - yukicoder platform = "{{ new_platform }}" -path = {% raw %}"./{{ package_name }}"{% endraw %} +# Path (Liquid template) +# +# Variables: +# +# - `contest`: Contest ID. **May be nil** +# - `package_name`: Package name +{% if new_platform == "yukicoder" -%} +path = {% raw %}"./{{ contest | default: 'problems' }}"{% endraw %} +{%- else -%} +path = {% raw %}"./{{ contest }}"{% endraw %} +{%- endif %} [new.template] {% if new_template_lockfile -%} diff --git a/src/commands/new.rs b/src/commands/new.rs index 44e53f9..e9d07cb 100644 --- a/src/commands/new.rs +++ b/src/commands/new.rs @@ -5,7 +5,7 @@ use crate::{ }, shell::{ColorChoice, Shell}, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{anyhow, bail, Context as _}; use heck::KebabCase as _; use itertools::Itertools as _; use liquid::object; @@ -88,12 +88,14 @@ pub fn run(opt: OptCompeteNew, ctx: crate::Context<'_>) -> anyhow::Result<()> { shell, )?; - let package_name = outcome + let contest = outcome .contest .as_ref() .map(|RetrieveTestCasesOutcomeContest { id, .. }| id) .unwrap_or(&contest); + let group = Group::Atcoder(contest); + let problems = outcome .problems .iter() @@ -105,9 +107,8 @@ pub fn run(opt: OptCompeteNew, ctx: crate::Context<'_>) -> anyhow::Result<()> { let (manifest_dir, src_paths) = create_new_package( &cargo_compete_config_path, &cargo_compete_config, - package_name, + group, &problems, - false, shell, )?; @@ -145,12 +146,14 @@ pub fn run(opt: OptCompeteNew, ctx: crate::Context<'_>) -> anyhow::Result<()> { shell, )?; - let package_name = outcome + let contest = outcome .contest .as_ref() .map(|RetrieveTestCasesOutcomeContest { id, .. }| id) .unwrap_or(&contest); + let group = Group::Codeforces(contest); + let problems = outcome .problems .iter() @@ -162,9 +165,8 @@ pub fn run(opt: OptCompeteNew, ctx: crate::Context<'_>) -> anyhow::Result<()> { let (manifest_dir, src_paths) = create_new_package( &cargo_compete_config_path, &cargo_compete_config, - package_name, + group, &problems, - false, shell, )?; @@ -198,13 +200,16 @@ pub fn run(opt: OptCompeteNew, ctx: crate::Context<'_>) -> anyhow::Result<()> { let outcome = crate::web::retrieve_testcases::dl_from_yukicoder(contest, problems, full, shell)?; - let package_name = outcome + let contest = outcome .contest .as_ref() .map(|RetrieveTestCasesOutcomeContest { id, .. }| &**id) .or(contest); - let is_no = package_name.is_none(); - let package_name = package_name.unwrap_or("problems"); + + let group = match contest { + None => Group::YukicoderProblems, + Some(contest) => Group::YukicoderContest(contest), + }; let problems = outcome .problems @@ -217,9 +222,8 @@ pub fn run(opt: OptCompeteNew, ctx: crate::Context<'_>) -> anyhow::Result<()> { let (manifest_dir, src_paths) = create_new_package( &cargo_compete_config_path, &cargo_compete_config, - package_name, + group, &problems, - is_no, shell, )?; @@ -254,31 +258,47 @@ fn urls(outcome: &RetrieveTestCasesOutcome) -> Vec { outcome.problems.iter().map(|p| p.url.clone()).collect() } +#[derive(Copy, Clone, Debug)] +enum Group<'a> { + Atcoder(&'a str), + Codeforces(&'a str), + YukicoderProblems, + YukicoderContest(&'a str), +} + +impl<'a> Group<'a> { + fn contest(self) -> Option<&'a str> { + match self { + Self::Atcoder(contest) + | Self::Codeforces(contest) + | Self::YukicoderContest(contest) => Some(contest), + Self::YukicoderProblems => None, + } + } + + fn package_name(self) -> String { + match self { + Self::Atcoder(contest) => contest.to_owned(), + Self::Codeforces(contest) | Self::YukicoderContest(contest) => { + format!("contest{}", contest) + } + Self::YukicoderProblems => "problems".to_owned(), + } + } +} + fn create_new_package( cargo_compete_config_path: &Path, cargo_compete_config: &CargoCompeteConfig, - package_name: &str, + group: Group<'_>, problems: &BTreeMap<&str, &Url>, - problems_are_yukicoder_no: bool, shell: &mut Shell, ) -> anyhow::Result<(PathBuf, Vec)> { - crate::process::process(crate::process::cargo_exe()?) - .args(&[ - "new", - "-q", - "--vcs", - "none", - "--name", - package_name, - package_name, - ]) - .cwd(cargo_compete_config_path.with_file_name("")) - .exec()?; - let cargo_compete_config_dir = cargo_compete_config_path.with_file_name(""); let manifest_dir = cargo_compete_config.new.path.render(&object!({ - "package_name": package_name, + "contest": group.contest(), + "package_name": group.package_name(), }))?; let manifest_dir = Path::new(&manifest_dir); let manifest_dir = cargo_compete_config_path @@ -287,6 +307,24 @@ fn create_new_package( let manifest_path = manifest_dir.join("Cargo.toml"); + if manifest_dir.exists() { + bail!( + "could not create a new package. `{}` already exists", + manifest_dir.display(), + ); + } + + crate::process::process(crate::process::cargo_exe()?) + .arg("new") + .arg("-q") + .arg("--vcs") + .arg("none") + .arg("--name") + .arg(group.package_name()) + .arg(&manifest_dir) + .cwd(cargo_compete_config_path.with_file_name("")) + .exec()?; + let mut package_metadata_cargo_compete_bin = problems .keys() .map(|problem_index| { @@ -294,14 +332,14 @@ fn create_new_package( r#"{} = {{ name = "", problem = {{ {} }} }} "#, escape_key(&problem_index.to_kebab_case()), - match (cargo_compete_config.new.platform, problems_are_yukicoder_no) { - (PlatformKind::Atcoder, _) | (PlatformKind::Codeforces, _) => { + match group { + Group::Atcoder(_) | Group::Codeforces(_) => { r#"platform = "", contest = "", index = "", url = """# } - (PlatformKind::Yukicoder, true) => { - r#"platform = "", kind = "no", no = "", url = """# + Group::YukicoderProblems => { + r#"platform = "", kind = "problem", no = 0, url = """# } - (PlatformKind::Yukicoder, false) => { + Group::YukicoderContest(_) => { r#"platform = "", kind = "contest", contest = "", index = "", url = """# } } @@ -314,34 +352,35 @@ fn create_new_package( package_metadata_cargo_compete_bin[&problem_index.to_kebab_case()]["name"] = toml_edit::value(format!( "{}-{}", - package_name, + group.package_name(), problem_index.to_kebab_case(), )); let tbl = &mut package_metadata_cargo_compete_bin[&problem_index.to_kebab_case()]["problem"]; - match cargo_compete_config.new.platform { - PlatformKind::Atcoder => { + match group { + Group::Atcoder(contest) => { tbl["platform"] = toml_edit::value("atcoder"); - tbl["contest"] = toml_edit::value(package_name); + tbl["contest"] = toml_edit::value(contest); tbl["index"] = toml_edit::value(&**problem_index); tbl["url"] = toml_edit::value(problem_url.as_str()); } - PlatformKind::Codeforces => { + Group::Codeforces(contest) => { tbl["platform"] = toml_edit::value("codeforces"); - tbl["contest"] = toml_edit::value(package_name); + tbl["contest"] = toml_edit::value(contest); tbl["index"] = toml_edit::value(&**problem_index); tbl["url"] = toml_edit::value(problem_url.as_str()); } - PlatformKind::Yukicoder => { + Group::YukicoderProblems => { tbl["platform"] = toml_edit::value("yukicoder"); - if problems_are_yukicoder_no { - tbl["no"] = toml_edit::value(&**problem_index); - } else { - tbl["contest"] = toml_edit::value(package_name); - tbl["index"] = toml_edit::value(&**problem_index); - } + tbl["no"] = toml_edit::value(problem_index.parse::()?); + tbl["url"] = toml_edit::value(problem_url.as_str()); + } + Group::YukicoderContest(contest) => { + tbl["platform"] = toml_edit::value("yukicoder"); + tbl["contest"] = toml_edit::value(contest); + tbl["index"] = toml_edit::value(&**problem_index); tbl["url"] = toml_edit::value(problem_url.as_str()); } } @@ -353,7 +392,7 @@ fn create_new_package( let mut tbl = toml_edit::Table::new(); tbl["name"] = toml_edit::value(format!( "{}-{}", - package_name, + group.package_name(), problem_index.to_kebab_case(), )); tbl["path"] = toml_edit::value(format!("src/bin/{}.rs", problem_index.to_kebab_case())); @@ -461,7 +500,11 @@ fn create_new_package( shell.status( "Created", - format!("`{}` package at {}", package_name, manifest_dir.display()), + format!( + "`{}` package at {}", + group.package_name(), + manifest_dir.display(), + ), )?; Ok((manifest_dir, src_paths)) diff --git a/tests/new.rs b/tests/new.rs index b1972dc..5926e4c 100644 --- a/tests/new.rs +++ b/tests/new.rs @@ -2,11 +2,12 @@ pub mod common; use ignore::overrides::Override; use insta::{assert_json_snapshot, assert_snapshot}; +use snowchains_core::web::PlatformKind; use std::io::BufRead; #[test] fn atcoder_abc003() -> anyhow::Result<()> { - let (output, tree) = run(&b""[..], "abc003")?; + let (output, tree) = run(PlatformKind::Atcoder, "abc003", &b""[..])?; assert_snapshot!("atcoder_abc003_output", output); assert_json_snapshot!("atcoder_abc003_file_tree", tree, { r#".**["Cargo.lock"]"# => ".." }); Ok(()) @@ -14,7 +15,7 @@ fn atcoder_abc003() -> anyhow::Result<()> { #[test] fn atcoder_abc007() -> anyhow::Result<()> { - let (output, tree) = run(&b""[..], "abc007")?; + let (output, tree) = run(PlatformKind::Atcoder, "abc007", &b""[..])?; assert_snapshot!("atcoder_abc007_output", output); assert_json_snapshot!("atcoder_abc007_file_tree", tree, { r#".**["Cargo.lock"]"# => ".." }); Ok(()) @@ -22,7 +23,7 @@ fn atcoder_abc007() -> anyhow::Result<()> { #[test] fn atcoder_agc047() -> anyhow::Result<()> { - let (output, tree) = run(&b""[..], "agc047")?; + let (output, tree) = run(PlatformKind::Atcoder, "agc047", &b""[..])?; assert_snapshot!("atcoder_agc047_output", output); assert_json_snapshot!("atcoder_agc047_file_tree", tree, { r#".**["Cargo.lock"]"# => ".." }); Ok(()) @@ -31,25 +32,39 @@ fn atcoder_agc047() -> anyhow::Result<()> { #[cfg(feature = "__test_with_credentials")] #[test] fn atcoder_practice() -> anyhow::Result<()> { - let (output, tree) = run(common::atcoder_credentials()?, "practice")?; + let (output, tree) = run( + PlatformKind::Atcoder, + "practice", + common::atcoder_credentials()?, + )?; assert_snapshot!("atcoder_practice_output", output); assert_json_snapshot!("atcoder_practice_file_tree", tree, { r#".**["Cargo.lock"]"# => ".." }); Ok(()) } +#[test] +fn yukicoder_contest_100() -> anyhow::Result<()> { + let (output, tree) = run(PlatformKind::Yukicoder, "100", &b""[..])?; + assert_snapshot!("yukicoder_contest_100_output", output); + assert_json_snapshot!("yukicoder_contest_100_file_tree", tree, { r#".**["Cargo.lock"]"# => ".." }); + Ok(()) +} + fn run( - input: impl BufRead + 'static, + platform: PlatformKind, contest: &str, + input: impl BufRead + 'static, ) -> anyhow::Result<(String, serde_json::Value)> { common::run( |cwd| -> _ { std::fs::write( cwd.join("compete.toml"), - r#"test-suite = "{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml" + format!( + r#"test-suite = "{{{{ manifest_dir }}}}/testcases/{{{{ problem | kebabcase }}}}.yml" [new] -platform = "atcoder" -path = "./{{ package_name }}" +platform = "{}" +path = "./{{{{ package_name }}}}" [new.template] target-dir = "./target" @@ -63,11 +78,13 @@ proconio = "=0.3.6" [new.template.src] kind = "inline" content = ''' -fn main() { +fn main() {{ todo!(); -} +}} ''' "#, + platform.to_kebab_case_str(), + ), )?; std::fs::create_dir(cwd.join(".cargo"))?; diff --git a/tests/snapshots/init__atcoder_no_crate_file_tree.snap b/tests/snapshots/init__atcoder_no_crate_file_tree.snap index b770968..7cee914 100644 --- a/tests/snapshots/init__atcoder_no_crate_file_tree.snap +++ b/tests/snapshots/init__atcoder_no_crate_file_tree.snap @@ -6,6 +6,6 @@ expression: tree ".cargo": { "config.toml": "[build]\ntarget-dir = \"target\"\n" }, - "compete.toml": "# Path to the test file (Liquid template)\n#\n# Variables:\n#\n# - `manifest_dir`: Package directory\n# - `contest`: Contest ID (e.g. \"abc100\")\n# - `problem`: Problem index (e.g. \"A\", \"B\")\n#\n# Additional filters:\n#\n# - `kebabcase`: Convert to kebab case (by using the `heck` crate)\ntest-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n#test-suite = \"./testcases/{{ contest }}/{{ problem | kebabcase }}.yml\"\n\n# Open files with the command (`jq` command)\n#\n# VSCode:\n#open = '[\"bash\", \"-c\"] + [\"code -a \" + .manifest_dir + \" && code \" + (.paths | map([.src, .test_suite]) | flatten | join(\" \"))]'\n# Emacs:\n#open = '[\"emacsclient\", \"-n\"] + (.paths | map([.src, .test_suite]) | flatten)'\n\n[new]\nplatform = \"atcoder\"\npath = \"./{{ package_name }}\"\n\n[new.template]\n#lockfile = \"/path/to/cargo-lock-template.toml\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\n#proconio = { version = \"0.3.6\", features = [\"derive\"] }\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n\n#[submit.transpile]\n#kind = \"command\"\n#args = [\"cargo\", \"equip\", \"--oneline\", \"mods\", \"--rustfmt\", \"--check\", \"--bin\", \"{{ bin_name }}\"]\n#language_id = \"\"\n\n#[submit.via-binary]\n#target = \"x86_64-unknown-linux-musl\"\n##cross = \"cross\"\n#strip = \"strip\"\n##upx = \"upx\"\n", + "compete.toml": "# Path to the test file (Liquid template)\n#\n# Variables:\n#\n# - `manifest_dir`: Package directory\n# - `contest`: Contest ID (e.g. \"abc100\")\n# - `problem`: Problem index (e.g. \"A\", \"B\")\n#\n# Additional filters:\n#\n# - `kebabcase`: Convert to kebab case (by using the `heck` crate)\ntest-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n#test-suite = \"./testcases/{{ contest }}/{{ problem | kebabcase }}.yml\"\n\n# Open files with the command (`jq` command)\n#\n# VSCode:\n#open = '[\"bash\", \"-c\"] + [\"code -a \" + .manifest_dir + \" && code \" + (.paths | map([.src, .test_suite]) | flatten | join(\" \"))]'\n# Emacs:\n#open = '[\"emacsclient\", \"-n\"] + (.paths | map([.src, .test_suite]) | flatten)'\n\n[new]\n# Platform\n#\n# - atcoder\n# - codeforces\n# - yukicoder\nplatform = \"atcoder\"\n# Path (Liquid template)\n#\n# Variables:\n#\n# - `contest`: Contest ID. **May be nil**\n# - `package_name`: Package name\npath = \"./{{ contest }}\"\n\n[new.template]\n#lockfile = \"/path/to/cargo-lock-template.toml\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\n#proconio = { version = \"0.3.6\", features = [\"derive\"] }\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n\n#[submit.transpile]\n#kind = \"command\"\n#args = [\"cargo\", \"equip\", \"--oneline\", \"mods\", \"--rustfmt\", \"--check\", \"--bin\", \"{{ bin_name }}\"]\n#language_id = \"\"\n\n#[submit.via-binary]\n#target = \"x86_64-unknown-linux-musl\"\n##cross = \"cross\"\n#strip = \"strip\"\n##upx = \"upx\"\n", "rust-toolchain": "1.42.0" } diff --git a/tests/snapshots/init__atcoder_use_crate_file_tree.snap b/tests/snapshots/init__atcoder_use_crate_file_tree.snap index 5bd5461..7b00bb8 100644 --- a/tests/snapshots/init__atcoder_use_crate_file_tree.snap +++ b/tests/snapshots/init__atcoder_use_crate_file_tree.snap @@ -6,7 +6,7 @@ expression: tree ".cargo": { "config.toml": "[build]\ntarget-dir = \"target\"\n" }, - "compete.toml": "# Path to the test file (Liquid template)\n#\n# Variables:\n#\n# - `manifest_dir`: Package directory\n# - `contest`: Contest ID (e.g. \"abc100\")\n# - `problem`: Problem index (e.g. \"A\", \"B\")\n#\n# Additional filters:\n#\n# - `kebabcase`: Convert to kebab case (by using the `heck` crate)\ntest-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n#test-suite = \"./testcases/{{ contest }}/{{ problem | kebabcase }}.yml\"\n\n# Open files with the command (`jq` command)\n#\n# VSCode:\n#open = '[\"bash\", \"-c\"] + [\"code -a \" + .manifest_dir + \" && code \" + (.paths | map([.src, .test_suite]) | flatten | join(\" \"))]'\n# Emacs:\n#open = '[\"emacsclient\", \"-n\"] + (.paths | map([.src, .test_suite]) | flatten)'\n\n[new]\nplatform = \"atcoder\"\npath = \"./{{ package_name }}\"\n\n[new.template]\nlockfile = \"./template-cargo-lock.toml\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\nnum = \"=0.2.1\"\nnum-bigint = \"=0.2.6\"\nnum-complex = \"=0.2.4\"\nnum-integer = \"=0.1.42\"\nnum-iter = \"=0.1.40\"\nnum-rational = \"=0.2.4\"\nnum-traits = \"=0.2.11\"\nnum-derive = \"=0.3.0\"\nndarray = \"=0.13.0\"\nnalgebra = \"=0.20.0\"\nalga = \"=0.9.3\"\nlibm = \"=0.2.1\"\nrand = { version = \"=0.7.3\", features = [\"small_rng\"] }\ngetrandom = \"=0.1.14\"\nrand_chacha = \"=0.2.2\"\nrand_core = \"=0.5.1\"\nrand_hc = \"=0.2.0\"\nrand_pcg = \"=0.2.1\"\nrand_distr = \"=0.2.2\"\npetgraph = \"=0.5.0\"\nindexmap = \"=1.3.2\"\nregex = \"=1.3.6\"\nlazy_static = \"=1.4.0\"\nordered-float = \"=1.0.2\"\nascii = \"=1.0.0\"\npermutohedron = \"=0.2.4\"\nsuperslice = \"=1.0.0\"\nitertools = \"=0.9.0\"\nitertools-num = \"=0.1.3\"\nmaplit = \"=1.0.2\"\neither = \"=1.5.3\"\nim-rc = \"=14.3.0\"\nfixedbitset = \"=0.2.0\"\nbitset-fixed = \"=0.1.0\"\nproconio = { version = \"=0.3.6\", features = [\"derive\"] }\ntext_io = \"=0.1.8\"\nwhiteread = \"=0.5.0\"\nrustc-hash = \"=1.1.0\"\nsmallvec = \"=1.2.0\"\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n\n#[submit.transpile]\n#kind = \"command\"\n#args = [\"cargo\", \"equip\", \"--oneline\", \"mods\", \"--rustfmt\", \"--check\", \"--bin\", \"{{ bin_name }}\"]\n#language_id = \"\"\n\n#[submit.via-binary]\n#target = \"x86_64-unknown-linux-musl\"\n##cross = \"cross\"\n#strip = \"strip\"\n##upx = \"upx\"\n", + "compete.toml": "# Path to the test file (Liquid template)\n#\n# Variables:\n#\n# - `manifest_dir`: Package directory\n# - `contest`: Contest ID (e.g. \"abc100\")\n# - `problem`: Problem index (e.g. \"A\", \"B\")\n#\n# Additional filters:\n#\n# - `kebabcase`: Convert to kebab case (by using the `heck` crate)\ntest-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n#test-suite = \"./testcases/{{ contest }}/{{ problem | kebabcase }}.yml\"\n\n# Open files with the command (`jq` command)\n#\n# VSCode:\n#open = '[\"bash\", \"-c\"] + [\"code -a \" + .manifest_dir + \" && code \" + (.paths | map([.src, .test_suite]) | flatten | join(\" \"))]'\n# Emacs:\n#open = '[\"emacsclient\", \"-n\"] + (.paths | map([.src, .test_suite]) | flatten)'\n\n[new]\n# Platform\n#\n# - atcoder\n# - codeforces\n# - yukicoder\nplatform = \"atcoder\"\n# Path (Liquid template)\n#\n# Variables:\n#\n# - `contest`: Contest ID. **May be nil**\n# - `package_name`: Package name\npath = \"./{{ contest }}\"\n\n[new.template]\nlockfile = \"./template-cargo-lock.toml\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\nnum = \"=0.2.1\"\nnum-bigint = \"=0.2.6\"\nnum-complex = \"=0.2.4\"\nnum-integer = \"=0.1.42\"\nnum-iter = \"=0.1.40\"\nnum-rational = \"=0.2.4\"\nnum-traits = \"=0.2.11\"\nnum-derive = \"=0.3.0\"\nndarray = \"=0.13.0\"\nnalgebra = \"=0.20.0\"\nalga = \"=0.9.3\"\nlibm = \"=0.2.1\"\nrand = { version = \"=0.7.3\", features = [\"small_rng\"] }\ngetrandom = \"=0.1.14\"\nrand_chacha = \"=0.2.2\"\nrand_core = \"=0.5.1\"\nrand_hc = \"=0.2.0\"\nrand_pcg = \"=0.2.1\"\nrand_distr = \"=0.2.2\"\npetgraph = \"=0.5.0\"\nindexmap = \"=1.3.2\"\nregex = \"=1.3.6\"\nlazy_static = \"=1.4.0\"\nordered-float = \"=1.0.2\"\nascii = \"=1.0.0\"\npermutohedron = \"=0.2.4\"\nsuperslice = \"=1.0.0\"\nitertools = \"=0.9.0\"\nitertools-num = \"=0.1.3\"\nmaplit = \"=1.0.2\"\neither = \"=1.5.3\"\nim-rc = \"=14.3.0\"\nfixedbitset = \"=0.2.0\"\nbitset-fixed = \"=0.1.0\"\nproconio = { version = \"=0.3.6\", features = [\"derive\"] }\ntext_io = \"=0.1.8\"\nwhiteread = \"=0.5.0\"\nrustc-hash = \"=1.1.0\"\nsmallvec = \"=1.2.0\"\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n\n#[submit.transpile]\n#kind = \"command\"\n#args = [\"cargo\", \"equip\", \"--oneline\", \"mods\", \"--rustfmt\", \"--check\", \"--bin\", \"{{ bin_name }}\"]\n#language_id = \"\"\n\n#[submit.via-binary]\n#target = \"x86_64-unknown-linux-musl\"\n##cross = \"cross\"\n#strip = \"strip\"\n##upx = \"upx\"\n", "rust-toolchain": "1.42.0", "template-cargo-lock.toml": "[[package]]\nname = \"aho-corasick\"\nversion = \"0.7.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada\"\ndependencies = [\n \"memchr\",\n]\n\n[[package]]\nname = \"alga\"\nversion = \"0.9.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"4f823d037a7ec6ea2197046bafd4ae150e6bc36f9ca347404f46a46823fa84f2\"\ndependencies = [\n \"approx\",\n \"num-complex\",\n \"num-traits\",\n]\n\n[[package]]\nname = \"approx\"\nversion = \"0.3.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3\"\ndependencies = [\n \"num-traits\",\n]\n\n[[package]]\nname = \"ascii\"\nversion = \"1.0.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"bbf56136a5198c7b01a49e3afcbef6cf84597273d298f54432926024107b0109\"\n\n[[package]]\nname = \"autocfg\"\nversion = \"1.0.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d\"\n\n[[package]]\nname = \"bitmaps\"\nversion = \"2.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2\"\ndependencies = [\n \"typenum\",\n]\n\n[[package]]\nname = \"bitset-fixed\"\nversion = \"0.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a8cc868e96ba5c32ffae4d42bf2940ca7fca317dcef3f19b6d7de66b6885abff\"\n\n[[package]]\nname = \"cfg-if\"\nversion = \"0.1.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822\"\n\n[[package]]\nname = \"either\"\nversion = \"1.5.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3\"\n\n[[package]]\nname = \"fixedbitset\"\nversion = \"0.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d\"\n\n[[package]]\nname = \"generic-array\"\nversion = \"0.13.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd\"\ndependencies = [\n \"typenum\",\n]\n\n[[package]]\nname = \"getrandom\"\nversion = \"0.1.14\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb\"\ndependencies = [\n \"cfg-if\",\n \"libc\",\n \"wasi\",\n]\n\n[[package]]\nname = \"im-rc\"\nversion = \"14.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"303f7e6256d546e01979071417432425f15c1891fb309a5f2d724ee908fabd6e\"\ndependencies = [\n \"bitmaps\",\n \"rand_core\",\n \"rand_xoshiro\",\n \"sized-chunks\",\n \"typenum\",\n \"version_check\",\n]\n\n[[package]]\nname = \"indexmap\"\nversion = \"1.3.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292\"\ndependencies = [\n \"autocfg\",\n]\n\n[[package]]\nname = \"itertools\"\nversion = \"0.8.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484\"\ndependencies = [\n \"either\",\n]\n\n[[package]]\nname = \"itertools\"\nversion = \"0.9.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b\"\ndependencies = [\n \"either\",\n]\n\n[[package]]\nname = \"itertools-num\"\nversion = \"0.1.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a872a22f9e6f7521ca557660adb96dd830e54f0f490fa115bb55dd69d38b27e7\"\ndependencies = [\n \"num-traits\",\n]\n\n[[package]]\nname = \"lazy_static\"\nversion = \"1.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646\"\n\n[[package]]\nname = \"libc\"\nversion = \"0.2.68\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0\"\n\n[[package]]\nname = \"libm\"\nversion = \"0.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a\"\n\n[[package]]\nname = \"maplit\"\nversion = \"1.0.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d\"\n\n[[package]]\nname = \"matrixmultiply\"\nversion = \"0.2.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f\"\ndependencies = [\n \"rawpointer\",\n]\n\n[[package]]\nname = \"memchr\"\nversion = \"2.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400\"\n\n[[package]]\nname = \"nalgebra\"\nversion = \"0.20.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"c6511777ed3da44b6a11e732a66a7d6274dfbbcd68ad968e64b778dcb829d94a\"\ndependencies = [\n \"alga\",\n \"approx\",\n \"generic-array\",\n \"matrixmultiply\",\n \"num-complex\",\n \"num-rational\",\n \"num-traits\",\n \"rand\",\n \"rand_distr\",\n \"typenum\",\n]\n\n[[package]]\nname = \"ndarray\"\nversion = \"0.13.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"25b001fc2f5df269365fb77bd8396ce6b1f61c9848f7f088c25e57494bacc57b\"\ndependencies = [\n \"itertools 0.8.2\",\n \"matrixmultiply\",\n \"num-complex\",\n \"num-integer\",\n \"num-traits\",\n \"rawpointer\",\n]\n\n[[package]]\nname = \"num\"\nversion = \"0.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36\"\ndependencies = [\n \"num-bigint\",\n \"num-complex\",\n \"num-integer\",\n \"num-iter\",\n \"num-rational\",\n \"num-traits\",\n]\n\n[[package]]\nname = \"num-bigint\"\nversion = \"0.2.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304\"\ndependencies = [\n \"autocfg\",\n \"num-integer\",\n \"num-traits\",\n]\n\n[[package]]\nname = \"num-complex\"\nversion = \"0.2.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95\"\ndependencies = [\n \"autocfg\",\n \"num-traits\",\n]\n\n[[package]]\nname = \"num-derive\"\nversion = \"0.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"0c8b15b261814f992e33760b1fca9fe8b693d8a65299f20c9901688636cfb746\"\ndependencies = [\n \"proc-macro2 1.0.10\",\n \"quote 1.0.3\",\n \"syn 1.0.17\",\n]\n\n[[package]]\nname = \"num-integer\"\nversion = \"0.1.42\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba\"\ndependencies = [\n \"autocfg\",\n \"num-traits\",\n]\n\n[[package]]\nname = \"num-iter\"\nversion = \"0.1.40\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00\"\ndependencies = [\n \"autocfg\",\n \"num-integer\",\n \"num-traits\",\n]\n\n[[package]]\nname = \"num-rational\"\nversion = \"0.2.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef\"\ndependencies = [\n \"autocfg\",\n \"num-bigint\",\n \"num-integer\",\n \"num-traits\",\n]\n\n[[package]]\nname = \"num-traits\"\nversion = \"0.2.11\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096\"\ndependencies = [\n \"autocfg\",\n \"libm\",\n]\n\n[[package]]\nname = \"ordered-float\"\nversion = \"1.0.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518\"\ndependencies = [\n \"num-traits\",\n]\n\n[[package]]\nname = \"permutohedron\"\nversion = \"0.2.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b687ff7b5da449d39e418ad391e5e08da53ec334903ddbb921db208908fc372c\"\n\n[[package]]\nname = \"petgraph\"\nversion = \"0.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"29c127eea4a29ec6c85d153c59dc1213f33ec74cead30fe4730aecc88cc1fd92\"\ndependencies = [\n \"fixedbitset\",\n \"indexmap\",\n]\n\n[[package]]\nname = \"ppv-lite86\"\nversion = \"0.2.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b\"\n\n[[package]]\nname = \"proc-macro2\"\nversion = \"0.4.30\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759\"\ndependencies = [\n \"unicode-xid 0.1.0\",\n]\n\n[[package]]\nname = \"proc-macro2\"\nversion = \"1.0.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3\"\ndependencies = [\n \"unicode-xid 0.2.0\",\n]\n\n[[package]]\nname = \"proconio\"\nversion = \"0.3.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"3bed4f95f88d84bb8efd51dbc080d463e6ca953f05dfade2e24daf19dd861ccd\"\ndependencies = [\n \"lazy_static\",\n \"proconio-derive\",\n]\n\n[[package]]\nname = \"proconio-derive\"\nversion = \"0.1.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"fc2f2111a9562adf5ba291143c434818c908a05636c8a492a0a69ba4720a2c16\"\ndependencies = [\n \"proc-macro2 0.4.30\",\n \"quote 0.6.13\",\n \"syn 0.15.44\",\n]\n\n[[package]]\nname = \"quote\"\nversion = \"0.6.13\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1\"\ndependencies = [\n \"proc-macro2 0.4.30\",\n]\n\n[[package]]\nname = \"quote\"\nversion = \"1.0.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f\"\ndependencies = [\n \"proc-macro2 1.0.10\",\n]\n\n[[package]]\nname = \"rand\"\nversion = \"0.7.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03\"\ndependencies = [\n \"getrandom\",\n \"libc\",\n \"rand_chacha\",\n \"rand_core\",\n \"rand_hc\",\n \"rand_pcg\",\n]\n\n[[package]]\nname = \"rand_chacha\"\nversion = \"0.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402\"\ndependencies = [\n \"ppv-lite86\",\n \"rand_core\",\n]\n\n[[package]]\nname = \"rand_core\"\nversion = \"0.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19\"\ndependencies = [\n \"getrandom\",\n]\n\n[[package]]\nname = \"rand_distr\"\nversion = \"0.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2\"\ndependencies = [\n \"rand\",\n]\n\n[[package]]\nname = \"rand_hc\"\nversion = \"0.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c\"\ndependencies = [\n \"rand_core\",\n]\n\n[[package]]\nname = \"rand_pcg\"\nversion = \"0.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429\"\ndependencies = [\n \"rand_core\",\n]\n\n[[package]]\nname = \"rand_xoshiro\"\nversion = \"0.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004\"\ndependencies = [\n \"rand_core\",\n]\n\n[[package]]\nname = \"rawpointer\"\nversion = \"0.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3\"\n\n[[package]]\nname = \"regex\"\nversion = \"1.3.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3\"\ndependencies = [\n \"aho-corasick\",\n \"memchr\",\n \"regex-syntax\",\n \"thread_local\",\n]\n\n[[package]]\nname = \"regex-syntax\"\nversion = \"0.6.17\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae\"\n\n[[package]]\nname = \"rustc-hash\"\nversion = \"1.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2\"\n\n[[package]]\nname = \"sized-chunks\"\nversion = \"0.5.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d59044ea371ad781ff976f7b06480b9f0180e834eda94114f2afb4afc12b7718\"\ndependencies = [\n \"bitmaps\",\n \"typenum\",\n]\n\n[[package]]\nname = \"smallvec\"\nversion = \"1.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc\"\n\n[[package]]\nname = \"superslice\"\nversion = \"1.0.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f\"\n\n[[package]]\nname = \"syn\"\nversion = \"0.15.44\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5\"\ndependencies = [\n \"proc-macro2 0.4.30\",\n \"quote 0.6.13\",\n \"unicode-xid 0.1.0\",\n]\n\n[[package]]\nname = \"syn\"\nversion = \"1.0.17\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03\"\ndependencies = [\n \"proc-macro2 1.0.10\",\n \"quote 1.0.3\",\n \"unicode-xid 0.2.0\",\n]\n\n[[package]]\nname = \"text_io\"\nversion = \"0.1.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"6cb170b4f47dc48835fbc56259c12d8963e542b05a24be2e3a1f5a6c320fd2d4\"\n\n[[package]]\nname = \"thread_local\"\nversion = \"1.0.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14\"\ndependencies = [\n \"lazy_static\",\n]\n\n[[package]]\nname = \"typenum\"\nversion = \"1.11.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9\"\n\n[[package]]\nname = \"unicode-xid\"\nversion = \"0.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc\"\n\n[[package]]\nname = \"unicode-xid\"\nversion = \"0.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c\"\n\n[[package]]\nname = \"version_check\"\nversion = \"0.9.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce\"\n\n[[package]]\nname = \"wasi\"\nversion = \"0.9.0+wasi-snapshot-preview1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519\"\n\n[[package]]\nname = \"whiteread\"\nversion = \"0.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8bc25de0a968755322a6b517a7257df7ec3216ed7907b8fc064906542f9714b3\"\n" } diff --git a/tests/snapshots/init__atcoder_use_crate_via_bianry_file_tree.snap b/tests/snapshots/init__atcoder_use_crate_via_bianry_file_tree.snap index 52bc394..56daba3 100644 --- a/tests/snapshots/init__atcoder_use_crate_via_bianry_file_tree.snap +++ b/tests/snapshots/init__atcoder_use_crate_via_bianry_file_tree.snap @@ -6,6 +6,6 @@ expression: tree ".cargo": { "config.toml": "[build]\ntarget-dir = \"target\"\n" }, - "compete.toml": "# Path to the test file (Liquid template)\n#\n# Variables:\n#\n# - `manifest_dir`: Package directory\n# - `contest`: Contest ID (e.g. \"abc100\")\n# - `problem`: Problem index (e.g. \"A\", \"B\")\n#\n# Additional filters:\n#\n# - `kebabcase`: Convert to kebab case (by using the `heck` crate)\ntest-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n#test-suite = \"./testcases/{{ contest }}/{{ problem | kebabcase }}.yml\"\n\n# Open files with the command (`jq` command)\n#\n# VSCode:\n#open = '[\"bash\", \"-c\"] + [\"code -a \" + .manifest_dir + \" && code \" + (.paths | map([.src, .test_suite]) | flatten | join(\" \"))]'\n# Emacs:\n#open = '[\"emacsclient\", \"-n\"] + (.paths | map([.src, .test_suite]) | flatten)'\n\n[new]\nplatform = \"atcoder\"\npath = \"./{{ package_name }}\"\n\n[new.template]\n#lockfile = \"/path/to/cargo-lock-template.toml\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\n#proconio = { version = \"0.3.6\", features = [\"derive\"] }\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n\n#[submit.transpile]\n#kind = \"command\"\n#args = [\"cargo\", \"equip\", \"--oneline\", \"mods\", \"--rustfmt\", \"--check\", \"--bin\", \"{{ bin_name }}\"]\n#language_id = \"\"\n\n[submit.via-binary]\ntarget = \"x86_64-unknown-linux-musl\"\n#cross = \"cross\"\nstrip = \"strip\"\n#upx = \"upx\"\n", + "compete.toml": "# Path to the test file (Liquid template)\n#\n# Variables:\n#\n# - `manifest_dir`: Package directory\n# - `contest`: Contest ID (e.g. \"abc100\")\n# - `problem`: Problem index (e.g. \"A\", \"B\")\n#\n# Additional filters:\n#\n# - `kebabcase`: Convert to kebab case (by using the `heck` crate)\ntest-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n#test-suite = \"./testcases/{{ contest }}/{{ problem | kebabcase }}.yml\"\n\n# Open files with the command (`jq` command)\n#\n# VSCode:\n#open = '[\"bash\", \"-c\"] + [\"code -a \" + .manifest_dir + \" && code \" + (.paths | map([.src, .test_suite]) | flatten | join(\" \"))]'\n# Emacs:\n#open = '[\"emacsclient\", \"-n\"] + (.paths | map([.src, .test_suite]) | flatten)'\n\n[new]\n# Platform\n#\n# - atcoder\n# - codeforces\n# - yukicoder\nplatform = \"atcoder\"\n# Path (Liquid template)\n#\n# Variables:\n#\n# - `contest`: Contest ID. **May be nil**\n# - `package_name`: Package name\npath = \"./{{ contest }}\"\n\n[new.template]\n#lockfile = \"/path/to/cargo-lock-template.toml\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\n#proconio = { version = \"0.3.6\", features = [\"derive\"] }\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n\n#[submit.transpile]\n#kind = \"command\"\n#args = [\"cargo\", \"equip\", \"--oneline\", \"mods\", \"--rustfmt\", \"--check\", \"--bin\", \"{{ bin_name }}\"]\n#language_id = \"\"\n\n[submit.via-binary]\ntarget = \"x86_64-unknown-linux-musl\"\n#cross = \"cross\"\nstrip = \"strip\"\n#upx = \"upx\"\n", "rust-toolchain": "1.42.0" } diff --git a/tests/snapshots/init__codeforces_file_tree.snap b/tests/snapshots/init__codeforces_file_tree.snap index 3d5af50..871f9bb 100644 --- a/tests/snapshots/init__codeforces_file_tree.snap +++ b/tests/snapshots/init__codeforces_file_tree.snap @@ -6,6 +6,6 @@ expression: tree ".cargo": { "config.toml": "[build]\ntarget-dir = \"target\"\n" }, - "compete.toml": "# Path to the test file (Liquid template)\n#\n# Variables:\n#\n# - `manifest_dir`: Package directory\n# - `contest`: Contest ID (e.g. \"abc100\")\n# - `problem`: Problem index (e.g. \"A\", \"B\")\n#\n# Additional filters:\n#\n# - `kebabcase`: Convert to kebab case (by using the `heck` crate)\ntest-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n#test-suite = \"./testcases/{{ contest }}/{{ problem | kebabcase }}.yml\"\n\n# Open files with the command (`jq` command)\n#\n# VSCode:\n#open = '[\"bash\", \"-c\"] + [\"code -a \" + .manifest_dir + \" && code \" + (.paths | map([.src, .test_suite]) | flatten | join(\" \"))]'\n# Emacs:\n#open = '[\"emacsclient\", \"-n\"] + (.paths | map([.src, .test_suite]) | flatten)'\n\n[new]\nplatform = \"codeforces\"\npath = \"./{{ package_name }}\"\n\n[new.template]\n#lockfile = \"/path/to/cargo-lock-template.toml\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\n#proconio = { version = \"0.3.6\", features = [\"derive\"] }\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n\n#[submit.transpile]\n#kind = \"command\"\n#args = [\"cargo\", \"equip\", \"--oneline\", \"mods\", \"--rustfmt\", \"--check\", \"--bin\", \"{{ bin_name }}\"]\n#language_id = \"\"\n\n#[submit.via-binary]\n#target = \"x86_64-unknown-linux-musl\"\n##cross = \"cross\"\n#strip = \"strip\"\n##upx = \"upx\"\n", + "compete.toml": "# Path to the test file (Liquid template)\n#\n# Variables:\n#\n# - `manifest_dir`: Package directory\n# - `contest`: Contest ID (e.g. \"abc100\")\n# - `problem`: Problem index (e.g. \"A\", \"B\")\n#\n# Additional filters:\n#\n# - `kebabcase`: Convert to kebab case (by using the `heck` crate)\ntest-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n#test-suite = \"./testcases/{{ contest }}/{{ problem | kebabcase }}.yml\"\n\n# Open files with the command (`jq` command)\n#\n# VSCode:\n#open = '[\"bash\", \"-c\"] + [\"code -a \" + .manifest_dir + \" && code \" + (.paths | map([.src, .test_suite]) | flatten | join(\" \"))]'\n# Emacs:\n#open = '[\"emacsclient\", \"-n\"] + (.paths | map([.src, .test_suite]) | flatten)'\n\n[new]\n# Platform\n#\n# - atcoder\n# - codeforces\n# - yukicoder\nplatform = \"codeforces\"\n# Path (Liquid template)\n#\n# Variables:\n#\n# - `contest`: Contest ID. **May be nil**\n# - `package_name`: Package name\npath = \"./{{ contest }}\"\n\n[new.template]\n#lockfile = \"/path/to/cargo-lock-template.toml\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\n#proconio = { version = \"0.3.6\", features = [\"derive\"] }\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n\n#[submit.transpile]\n#kind = \"command\"\n#args = [\"cargo\", \"equip\", \"--oneline\", \"mods\", \"--rustfmt\", \"--check\", \"--bin\", \"{{ bin_name }}\"]\n#language_id = \"\"\n\n#[submit.via-binary]\n#target = \"x86_64-unknown-linux-musl\"\n##cross = \"cross\"\n#strip = \"strip\"\n##upx = \"upx\"\n", "rust-toolchain": "1.42.0" } diff --git a/tests/snapshots/new__yukicoder_contest_100_file_tree.snap b/tests/snapshots/new__yukicoder_contest_100_file_tree.snap new file mode 100644 index 0000000..e90169f --- /dev/null +++ b/tests/snapshots/new__yukicoder_contest_100_file_tree.snap @@ -0,0 +1,31 @@ +--- +source: tests/new.rs +expression: tree +--- +{ + ".cargo": { + "config.toml": "[cargo-new]\nname = \"\"\nemail = \"\"\n" + }, + "compete.toml": "test-suite = \"{{ manifest_dir }}/testcases/{{ problem | kebabcase }}.yml\"\n\n[new]\nplatform = \"yukicoder\"\npath = \"./{{ package_name }}\"\n\n[new.template]\ntarget-dir = \"./target\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\nproconio = \"=0.3.6\"\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n", + "contest100": { + "Cargo.toml": "[package]\nname = \"contest100\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete]\nconfig = \"../compete.toml\"\n\n[package.metadata.cargo-compete.bin]\n191 = { name = \"contest100-191\", problem = { platform = \"yukicoder\", kind = \"contest\", contest = \"100\", index = \"191\", url = \"https://yukicoder.me/problems/no/191\" } }\n192 = { name = \"contest100-192\", problem = { platform = \"yukicoder\", kind = \"contest\", contest = \"100\", index = \"192\", url = \"https://yukicoder.me/problems/no/192\" } }\n193 = { name = \"contest100-193\", problem = { platform = \"yukicoder\", kind = \"contest\", contest = \"100\", index = \"193\", url = \"https://yukicoder.me/problems/no/193\" } }\n194 = { name = \"contest100-194\", problem = { platform = \"yukicoder\", kind = \"contest\", contest = \"100\", index = \"194\", url = \"https://yukicoder.me/problems/no/194\" } }\n195 = { name = \"contest100-195\", problem = { platform = \"yukicoder\", kind = \"contest\", contest = \"100\", index = \"195\", url = \"https://yukicoder.me/problems/no/195\" } }\n196 = { name = \"contest100-196\", problem = { platform = \"yukicoder\", kind = \"contest\", contest = \"100\", index = \"196\", url = \"https://yukicoder.me/problems/no/196\" } }\n\n[[bin]]\nname = \"contest100-191\"\npath = \"src/bin/191.rs\"\n\n[[bin]]\nname = \"contest100-192\"\npath = \"src/bin/192.rs\"\n\n[[bin]]\nname = \"contest100-193\"\npath = \"src/bin/193.rs\"\n\n[[bin]]\nname = \"contest100-194\"\npath = \"src/bin/194.rs\"\n\n[[bin]]\nname = \"contest100-195\"\npath = \"src/bin/195.rs\"\n\n[[bin]]\nname = \"contest100-196\"\npath = \"src/bin/196.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n", + "src": { + "bin": { + "191.rs": "fn main() {\n todo!();\n}\n", + "192.rs": "fn main() {\n todo!();\n}\n", + "193.rs": "fn main() {\n todo!();\n}\n", + "194.rs": "fn main() {\n todo!();\n}\n", + "195.rs": "fn main() {\n todo!();\n}\n", + "196.rs": "fn main() {\n todo!();\n}\n" + } + }, + "testcases": { + "191.yml": "---\ntype: Batch\ntimelimit: 5s\nmatch: Lines\n\ncases:\n - name: sample1\n in: |\n 4\n 500 300 200 100\n out: |\n 30\n - name: sample2\n in: |\n 5\n 400 250 200 100 50\n out: |\n 60\n - name: sample3\n in: |\n 5\n 200 200 200 200 200\n out: |\n 0\n\nextend: []\n", + "192.yml": "---\ntype: Batch\ntimelimit: 2s\nmatch: Lines\ncases:\n - name: sample1\n in: \"101\\n\"\n out: ~\n timelimit: ~\n match: ~\n - name: sample2\n in: \"1000\\n\"\n out: ~\n timelimit: ~\n match: ~\nextend: []", + "193.yml": "---\ntype: Batch\ntimelimit: 1s\nmatch: Lines\n\ncases:\n - name: sample1\n in: |\n 1+1\n out: |\n 2\n - name: sample2\n in: |\n 1+111\n out: |\n 112\n - name: sample3\n in: |\n 10+4-1+15\n out: |\n 514\n\nextend: []\n", + "194.yml": "---\ntype: Batch\ntimelimit: 5s\nmatch: Lines\n\ncases:\n - name: sample1\n in: \"2 5\\n1 1\"\n out: 5 12\n - name: sample2\n in: \"5 10\\n1 2 3 4 5\"\n out: 214 438\n - name: sample3\n in: \"30 987654321012\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7\"\n out: 923032656 920866414\n\nextend: []\n", + "195.yml": "---\ntype: Batch\ntimelimit: 5s\nmatch: Lines\n\ncases:\n - name: sample1\n in: 5 13 34\n out: 1 1\n - name: sample2\n in: 11 11 11\n out: 1 3\n - name: sample3\n in: 5 6 9\n out: \"-1\"\n - name: sample4\n in: 35169 76228629 17995137\n out: 5487 14841\n\nextend: []\n", + "196.yml": "---\ntype: Batch\ntimelimit: 2s\nmatch: Lines\n\ncases:\n - name: sample1\n in: |\n 6 1\n 0 1\n 0 2\n 1 3\n 2 4\n 2 5\n out: |\n 3\n - name: sample2\n in: |\n 6 2\n 0 1\n 0 2\n 1 3\n 2 4\n 2 5\n out: |\n 4\n - name: sample3\n in: |\n 6 3\n 0 1\n 0 2\n 1 3\n 2 4\n 2 5\n out: |\n 4\n\nextend: []\n" + } + } +} diff --git a/tests/snapshots/new__yukicoder_contest_100_output.snap b/tests/snapshots/new__yukicoder_contest_100_output.snap new file mode 100644 index 0000000..18a2a78 --- /dev/null +++ b/tests/snapshots/new__yukicoder_contest_100_output.snap @@ -0,0 +1,12 @@ +--- +source: tests/new.rs +expression: output +--- + Created `contest100` package at {{ cwd }}{{ slash_or_backslash }}.{{ slash_or_backslash }}contest100 + Saved 3 test cases to {{ cwd }}{{ slash_or_backslash }}.{{ slash_or_backslash }}contest100{{ slash_or_backslash }}testcases{{ slash_or_backslash }}191.yml + Saved 2 test cases to {{ cwd }}{{ slash_or_backslash }}.{{ slash_or_backslash }}contest100{{ slash_or_backslash }}testcases{{ slash_or_backslash }}192.yml + Saved 3 test cases to {{ cwd }}{{ slash_or_backslash }}.{{ slash_or_backslash }}contest100{{ slash_or_backslash }}testcases{{ slash_or_backslash }}193.yml + Saved 3 test cases to {{ cwd }}{{ slash_or_backslash }}.{{ slash_or_backslash }}contest100{{ slash_or_backslash }}testcases{{ slash_or_backslash }}194.yml + Saved 4 test cases to {{ cwd }}{{ slash_or_backslash }}.{{ slash_or_backslash }}contest100{{ slash_or_backslash }}testcases{{ slash_or_backslash }}195.yml + Saved 3 test cases to {{ cwd }}{{ slash_or_backslash }}.{{ slash_or_backslash }}contest100{{ slash_or_backslash }}testcases{{ slash_or_backslash }}196.yml +