Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions data/5!station_station_types.csv
Original file line number Diff line number Diff line change
Expand Up @@ -34609,15 +34609,6 @@ DEFAULT,2100323,304,957,1,明神
DEFAULT,2100324,304,957,0,下今市
DEFAULT,2100325,304,957,1,上今市
DEFAULT,2100326,304,957,0,東武日光
DEFAULT,9921704,102,958,0,仙台空港
DEFAULT,9921703,102,958,1,美田園
DEFAULT,9921702,102,958,1,杜せきのした
DEFAULT,9921701,102,958,0,名取
DEFAULT,1123139,102,958,0,名取
DEFAULT,1123140,102,958,1,南仙台
DEFAULT,1123141,102,958,1,太子堂
DEFAULT,1123142,102,958,1,長町
DEFAULT,1123143,102,958,0,仙台
DEFAULT,1122801,100,959,0,いわき
DEFAULT,1122802,100,959,0,赤井
DEFAULT,1122803,100,959,0,小川郷
Expand Down
53 changes: 53 additions & 0 deletions data_validator/tests/sendai_airport_access.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use std::path::Path;

use csv::StringRecord;

fn records(filename: &str) -> Vec<StringRecord> {
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../data")
.join(filename);
csv::Reader::from_path(path)
.unwrap()
.records()
.collect::<Result<_, _>>()
.unwrap()
}

// All Sendai Airport Access rapid trains became local on 2026-03-14.
// https://www.senat.co.jp/2025/12/12/4483
#[test]
fn abolished_sendai_airport_rapid_is_not_selectable() {
let rows = records("5!station_station_types.csv");
assert!(rows.iter().all(|r| &r[3] != "958"));

// Also catch a reintroduced rapid under a different group ID. These are
// the airport line's own station IDs, not the shared Tohoku Main Line.
let airport_stations = ["9921701", "9921702", "9921703", "9921704"];
assert!(rows
.iter()
.filter(|r| airport_stations.contains(&&r[1]))
.all(|r| &r[2] != "102"));
}

#[test]
fn sendai_airport_local_keeps_all_stops_and_both_natori_ids() {
let rows = records("5!station_station_types.csv");
let local: Vec<_> = rows.iter().filter(|r| &r[3] == "526").collect();
let station_ids: Vec<_> = local.iter().map(|r| &r[1]).collect();
assert_eq!(
station_ids,
[
"9921704", "9921703", "9921702", "9921701", "1123139", "1123140", "1123141", "1123142",
"1123143",
]
);
assert!(local.iter().all(|r| &r[2] == "100" && &r[4] == "0"));
}

#[test]
fn shared_rapid_type_remains_available_for_other_lines() {
let types = records("4!types.csv");
assert!(types.iter().any(|r| &r[1] == "102" && &r[2] == "快速"));
let rows = records("5!station_station_types.csv");
assert!(rows.iter().any(|r| &r[2] == "102" && &r[3] != "958"));
}
Loading