Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e3394e2

Browse files
committedDec 20, 2019
Move ./examples/tests.ron to ./test-with-generated-opts.toml
1 parent b51a09e commit e3394e2

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+
matching = "Words"
6+
name = "ABC054: C - One-stroke Path"
7+
8+
[tests.abc057-b]
9+
matching = "Words"
10+
name = "ABC057: B - Checkpoints"
11+
12+
[tests.abc084-d]
13+
matching = "Words"
14+
name = "ABC084: D - 2017-like Number"
15+
16+
[tests.abc118-b]
17+
matching = "Words"
18+
name = "ABC118: B - Foods Loved by Everyone"
19+
20+
[tests.abc120-d]
21+
matching = "Words"
22+
name = "ABC120: D - Decayed Bridges"
23+
24+
[tests.abc121-b]
25+
matching = "Words"
26+
name = "ABC121: B - Can you solve this?"
27+
28+
[tests.abc129-f]
29+
matching = "Words"
30+
name = "ABC129: F - Takahashi's Basics in Education and Learning"
31+
32+
[tests.abc142-d]
33+
matching = "Words"
34+
name = "ABC142: D - Disjoint Set of Common Divisors"
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+
matching = "Exact"
42+
name = "APG4b: A - 1.00.はじめに"
43+
44+
[tests.apg4b-ex25]
45+
matching = "Words"
46+
name = "APG4b: EX25 - 集合の操作 / 3.05"
47+
48+
[tests.apg4b-ex26]
49+
matching = "Exact"
50+
name = "APG4b: EX26 - 電卓を作ろう3 / 3.06"
51+
52+
[tests.arc065-c]
53+
matching = "Words"
54+
name = "ABC049 / ARC065: C - 白昼夢 / Daydream"
55+
56+
[tests.arc084-c]
57+
matching = "Words"
58+
name = "ABC077 / ARC084: C - Snuke Festival"
59+
60+
[tests.atc001-b]
61+
matching = "Words"
62+
name = "ATC001: B - Union Find"
63+
64+
[tests.atc002-b]
65+
matching = "Words"
66+
name = "ATC002: B - n^p mod m"
67+
68+
[tests.practice-a]
69+
matching = "Words"
70+
name = "practice contest: A - Welcome to AtCoder"

‎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)
Please sign in to comment.