Skip to content

Commit 8f5e519

Browse files
committed
Move ./examples/tests.ron to ./test-with-generated-opts.toml
1 parent f363d6b commit 8f5e519

File tree

4 files changed

+85
-84
lines changed

4 files changed

+85
-84
lines changed

examples/tests.ron

Lines changed: 0 additions & 75 deletions
This file was deleted.

test-with-generated-opts.toml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# 手元でDropboxのテストケース(ある場合)で確認し、サンプルに含まれていないやつが大きいときはそれらをGitに入れない。
2+
# その場合CI上でもサンプルだけテストする。(Dropboxから引っ張るのも面倒だし何より誰のアカウントを使うかという問題がある)
3+
4+
[tests.abc054-c]
5+
name = "ABC054: C - One-stroke Path"
6+
matching = "Words"
7+
8+
[tests.abc057-b]
9+
name = "ABC057: B - Checkpoints"
10+
matching = "Words"
11+
12+
[tests.abc084-d]
13+
name = "ABC084: D - 2017-like Number"
14+
matching = "Words"
15+
16+
[tests.abc118-b]
17+
name = "ABC118: B - Foods Loved by Everyone"
18+
matching = "Words"
19+
20+
[tests.abc120-d]
21+
name = "ABC120: D - Decayed Bridges"
22+
matching = "Words"
23+
24+
[tests.abc121-b]
25+
name = "ABC121: B - Can you solve this?"
26+
matching = "Words"
27+
28+
[tests.abc129-f]
29+
name = "ABC129: F - Takahashi's Basics in Education and Learning"
30+
matching = "Words"
31+
32+
[tests.abc142-d]
33+
name = "ABC142: D - Disjoint Set of Common Divisors"
34+
matching = "Words"
35+
36+
[tests.abc144-d]
37+
name = "ABC144: D - Water Bottle"
38+
matching = { FloatOr = { abs = 1e-6, rel = 1e-6 } }
39+
40+
[tests.apg4b-a]
41+
name = "APG4b: A - 1.00.はじめに"
42+
matching = "Exact"
43+
44+
[tests.apg4b-ex25]
45+
name = "APG4b: EX25 - 集合の操作 / 3.05"
46+
matching = "Words"
47+
48+
[tests.apg4b-ex26]
49+
name = "APG4b: EX26 - 電卓を作ろう3 / 3.06"
50+
matching = "Exact"
51+
52+
[tests.arc065-c]
53+
name = "ABC049 / ARC065: C - 白昼夢 / Daydream"
54+
matching = "Words"
55+
56+
[tests.arc084-c]
57+
name = "ABC077 / ARC084: C - Snuke Festival"
58+
matching = "Words"
59+
60+
[tests.atc001-b]
61+
name = "ATC001: B - Union Find"
62+
matching = "Words"
63+
64+
[tests.atc002-b]
65+
name = "ATC002: B - n^p mod m"
66+
matching = "Words"
67+
68+
[tests.practice-a]
69+
name = "practice contest: A - Welcome to AtCoder"
70+
matching = "Words"

tools/test-with-generated-opts/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ env_logger = "0.7.1"
1212
indexmap = { version = "1.3.0", features = ["serde-1"] }
1313
itertools = "0.8.2"
1414
log = "0.4.8"
15-
ron = "0.5.1"
1615
serde = { version = "1.0.104", features = ["derive"] }
1716
serde_json = "1.0.44"
1817
shell-escape = "0.1.4"
1918
structopt = "0.3.5"
2019
tempdir = "0.3.7"
20+
toml = "0.5.5"
2121
which = { version = "3.1.0", default-features = false }

tools/test-with-generated-opts/src/main.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@ use structopt::StructOpt;
99
use tempdir::TempDir;
1010

1111
use std::collections::{BTreeMap, HashMap};
12-
use std::env;
13-
use std::f64;
1412
use std::ffi::{OsStr, OsString};
15-
use std::fs::{self, File};
1613
use std::io::{self, Read as _, Write as _};
1714
use std::path::{Path, PathBuf};
1815
use std::process::{Command, Output, Stdio};
1916
use std::time::Instant;
17+
use std::{env, f64, fs};
2018

2119
#[derive(StructOpt, Debug)]
22-
struct Opt {}
20+
struct Opt {
21+
#[structopt(
22+
long,
23+
value_name("PATH"),
24+
default_value("./test-with-generated-opts.toml"),
25+
help("Path to the config")
26+
)]
27+
config: PathBuf,
28+
}
2329

2430
fn main() -> anyhow::Result<()> {
25-
Opt::from_args();
31+
let Opt { config } = Opt::from_args();
2632

2733
env_logger::builder()
2834
.format(|buf, record| {
@@ -48,10 +54,10 @@ fn main() -> anyhow::Result<()> {
4854
.filter_module("test_with_generated_opts", LevelFilter::Info)
4955
.init();
5056

51-
let Tests { tests } = File::open("./examples/tests.ron")
57+
let Tests { tests } = fs::read_to_string(&config)
5258
.map_err(anyhow::Error::from)
53-
.and_then(|h| ron::de::from_reader(h).map_err(Into::into))
54-
.with_context(|| "Failed to read ./examples/tests.ron")?;
59+
.and_then(|s| toml::from_str(&s).map_err(Into::into))
60+
.with_context(|| format!("Failed to read {}", config.display()))?;
5561

5662
let tempdir = TempDir::new("atcoder-rust-base-test-with-generated-opts")?;
5763

0 commit comments

Comments
 (0)