Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove track layouts from track names #29

Merged
merged 1 commit into from
Jan 25, 2022
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
8 changes: 4 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ mod tests {
let track_ids = &config.track_ids;
assert_eq!(
track_ids.get_longest_common_prefix("charlotte_2018_2019_roval"),
Some("charlotte_2018_2019_roval".as_bytes()),
Some("charlotte_2018".as_bytes()),
);
assert_eq!(
track_ids.get_longest_common_prefix("charlotte_fullroadcourse"),
Expand All @@ -539,12 +539,12 @@ mod tests {

// Expectations for track name mapping.
assert_eq!(
config.tracks.get("charlotte_2018_2019_roval"),
Some(&"Charlotte Motor Speedway - Road Course".to_string())
config.tracks.get("charlotte_2018"),
Some(&"Charlotte Motor Speedway".to_string())
);
assert_eq!(
config.tracks.get("charlotte"),
Some(&"[Legacy] Charlotte Motor Speedway - 2008".to_string())
Some(&"[Legacy] Charlotte Motor Speedway".to_string())
);

// Expectations for car name mapping.
Expand Down
118 changes: 33 additions & 85 deletions src/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,127 +37,75 @@ update_check = "never"

# These are the mappings for unique track identifiers to full names.
[tracks]
barber_shorta = "Barber Motorsports Park - Short A"
barber_shortb = "Barber Motorsports Park - Short B"
barber_full = "Barber Motorsports Park - Full Course"
barcelona_gp = "Circuit de Barcelona-Catalunya - Grand Prix"
barcelona_rallycross = "Circuit de Barcelona-Catalunya - Rallycross"
barcelona_national = "Circuit de Barcelona-Catalunya - National"
barcelona_club = "Circuit de Barcelona-Catalunya - Club"
barcelona_moto = "Circuit de Barcelona-Catalunya - Moto"
barcelona_historic = "Circuit de Barcelona-Catalunya - Historic"
barber = "Barber Motorsports Park"
barcelona = "Circuit de Barcelona-Catalunya"
barkriver = "Bark River International Raceway"
bathurst = "Mount Panorama Circuit"
belleisle = "Detroit Grand Prix at Belle Isle"
brandshatch_grandprix = "Brands Hatch Circuit - Grand Prix"
brandshatch_indy = "Brands Hatch Circuit - Indy"
brandshatch_rallycross = "Brands Hatch Circuit - Rallycross"
charlotte = "[Legacy] Charlotte Motor Speedway - 2008"
charlotte_2018_oval = "Charlotte Motor Speedway - Oval"
charlotte_2018_2019_rallycrosslong = "Charlotte Motor Speedway - Rallycross"
charlotte_2018_2019_roval = "Charlotte Motor Speedway - Road Course"
charlotte_2018_roval = "Charlotte Motor Speedway - Road Course"
charlotte_2018_rovallong = "Charlotte Motor Speedway - Roval Long"
charlotte_2018_legendsoval = "Charlotte Motor Speedway - Legends Oval"
charlotte_2018_legendsrcshort = "Charlotte Motor Speedway - Legends RC Short"
charlotte_2018_legendsrcmed = "Charlotte Motor Speedway - Legends RC Medium"
charlotte_2018_legendsrclong = "Charlotte Motor Speedway - Legends RC Long"
brandshatch = "Brands Hatch Circuit"
charlotte = "[Legacy] Charlotte Motor Speedway"
charlotte_2018 = "Charlotte Motor Speedway"
chicago = "Chicago Street Circuit"
concordhalf = "Concord Speedway"
cota_gp = "Circuit of the Americas - Grand Prix"
cota_east = "Circuit of the Americas - East"
cota_west = "Circuit of the Americas - West"
crandon_full = "Crandon International Raceway - Full"
crandon_short = "Crandon International Raceway - Short"
cota = "Circuit of the Americas"
crandon = "Crandon International Raceway"
daytona = "[Legacy] Daytona International Speedway - 2008"
daytona_2011_roadnascar2020 = "Daytona International Speedway - NASCAR Road"
daytona_2011_short = "Daytona International Speedway - Short"
daytona_2011_bike = "Daytona International Speedway - Moto"
daytona_2011_oval = "Daytona International Speedway - Oval"
daytona_2011_road = "Daytona International Speedway - Road Course"
donington_gp = "Donington Park Racing Circuit - Grand Prix"
donington_national = "Donington Park Racing Circuit - National"
hockenheim_gp = "Hockenheimring Baden-Württemberg - Grand Prix"
hockenheim_nationala = "Hockenheimring Baden-Württemberg - National A"
hockenheim_nationalb = "Hockenheimring Baden-Württemberg - National B"
hockenheim_shorta = "Hockenheimring Baden-Württemberg - Short A"
hockenheim_shortb = "Hockenheimring Baden-Württemberg - Short B"
hockenheim_outer = "Hockenheimring Baden-Württemberg - Outer"
daytona_2011 = "Daytona International Speedway"
donington = "Donington Park Racing Circuit"
hockenheim = "Hockenheimring Baden-Württemberg"
hockenheim_pec = "Hockenheimring Baden-Württemberg - Porsche Experience Center"
hungaroring = "Hungaroring Circuit - Grand Prix"
imola_gp = "Autódromo Internazionale Enzo e Dino Ferrari - Grand Prix"
imola_moto = "Autódromo Internazionale Enzo e Dino Ferrari - Moto"
indianapolis_ovalindypit = "Indianapolis Motor Speedway - Indycar Oval"
indianapolis_oval = "Indianapolis Motor Speedway - Oval"
indianapolis_road = "Indianapolis Motor Speedway - Road Course"
indianapolis_motogp = "Indianapolis Motor Speedway - Bike"
interlagos_moto = "Autódromo José Carlos Pace - Moto"
interlagos_gp = "Autódromo José Carlos Pace - Grand Prix"
knockhill_international = "Knockhill Racing Circuit - International"
knockhill_internationalrev = "Knockhill Racing Circuit - International Reverse"
knockhill_national = "Knockhill Racing Circuit - National"
knockhill_nationalrev = "Knockhill Racing Circuit - National Reverse"
knockhill_rallycross = "Knockhill Racing Circuit - Rallycross"
knockhill_trioval = "Knockhill Racing Circuit - Tri-Oval"
imola = "Autódromo Internazionale Enzo e Dino Ferrari"
indianapolis = "Indianapolis Motor Speedway"
interlagos = "Autódromo José Carlos Pace"
knockhill = "Knockhill Racing Circuit"
lagunaseca = "WeatherTech Raceway at Laguna Seca"
lakeland = "USA International Speedway"
langley = "Langley Speedway"
lanier = "Lanier National Speedway"
lemans_full = "Circuit des 24 Heures du Mans - 24 Heures du Mans"
lemans_nochicane = "Circuit des 24 Heures du Mans - Historic"
lankebanen = "Lånkebanen (HellRX)"
lemans = "Circuit des 24 Heures du Mans - 24 Heures du Mans"
limaland = "Limaland Motorsports Park"
limerock = "[Legacy] Lime Rock Park - 2008"
limerock_2019 = "Lime Rock Park"
longbeach = "Long Beach Street Circuit"
midohio = "Mid-Ohio Sports Car Course"
montreal = "Circuit Gilles-Villeneuve"
monza_ovalleft = "Autódromo Nazionale Monza - Oval - Left turning"
monza_oval = "Autódromo Nazionale Monza - Oval - Right turning"
monza_junior = "Autódromo Nazionale Monza - Junior"
monza_historic = "Autódromo Nazionale Monza - Combined without chicanes"
monza_historicsecondchicane = "Autódromo Nazionale Monza - Combined without first chicane"
monza_combinedchicanes = "Autódromo Nazionale Monza - Combined"
monza_nochicane = "Autódromo Nazionale Monza - GP without chicanes"
monza_gpsecondchicane = "Autódromo Nazionale Monza - GP without first chicane"
monza_full = "Autódromo Nazionale Monza"
monza = "Autódromo Nazionale Monza"
mosport = "Canadian Tire Motorsport Park"
mtwashington_climb = "Mt. Washington Auto Road - Hillclimb"
mtwashington_reverse = "Mt. Washington Auto Road - Descent"
mtwashington = "Mt. Washington Auto Road"
newhampshire = "New Hampshire Motor Speedway"
newjersey = "New Jersey Motorsports Park"
nurburgring_combined = "Nürburgring Combined"
nurburgring_gp = "Nürburgring Grand-Prix-Strecke"
nurburgring_nordschleife = "Nürburgring Nordschleife"
okayama = "Okayama International Raceway"
okayama = "Okayama International Circuit"
oran = "Oran Park Raceway"
oulton = "Oulton Park Circuit"
oxford = "Oxford Plains Speedway"
phoenix = "[Legacy] Phoenix Raceway - 2008"
phillipisland = "Philip Island Circuit"
roadamerica = "Road America"
roadatlanta = "Michelin Raceway Road Atlanta"
roadatlanta = "Road Atlanta"
sebring = "Sebring International Raceway"
silverstone = "[Legacy] Silverstone Circuit - 2008"
silverstone_2019 = "Silverstone Circuit"
skidpad = "Centripetal Circuit"
sonoma_indycar = "Sonoma Raceway - IndyCar 2012-2018"
snetterton = "Snetterton Circuit"
sonoma = "Sonoma Raceway"
southboston = "South Boston Speedway"
southernnational = "Southern Nation Motorsports Park"
spa_combined = "Circuit de Spa-Francorchamps - Endurance"
spa_low = "Circuit de Spa-Francorchamps - Classic Pits"
spa_up = "Circuit de Spa-Francorchamps - Grand Prix Pits"
spielberg = "Red Bull Ring – Spielberg"
spa = "Circuit de Spa-Francorchamps"
spielberg = "Red Bull Ring"
summit = "Summit Point Raceway"
suzuka = "Suzuka International Racing Course"
thompson = "Thompson Speedway Motorsports Park"
tsukuba = "Tsukuba Circuit"
twinring = "Twin Ring Motegi"
zandvoort_grandprix = "Circuit Park Zandvoort - Grand Prix"
zandvoort_national = "Circuit Park Zandvoort - National"
zandvoort_chicane = "Circuit Park Zandvoort - Chicane"
zandvoort_club = "Circuit Park Zandvoort - Club"
zandvoort_oostelijk = "Circuit Park Zandvoort - Oostelijk"
zolder_gp = "Circuit Zolder - Grand Prix"
zolder_alt = "Circuit Zolder - Alternate"
watkinsglen_2021_classic = "Watkins Glen International - Classic"
watkinsglen_2021_cupcircuit = "Watkins Glen International - Cup"
watkinsglen_2021_fullcourse = "Watkins Glen International - Boot"
watkinsglen_2021_fullnoloop = "Watkins Glen International - Classic Boot"
virginia = "Virginia International Raceway"
watkinsglen_2021 = "Watkins Glen International"
zandvoort = "Circuit Park Zandvoort"
zolder = "Circuit Zolder - Grand Prix"

# Unique IDs for cars are constructed by taking directory names from the `{setups_path}/setups/`
# directory and replacing spaces with underscores.
Expand Down
19 changes: 8 additions & 11 deletions src/setup/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn test_load_dir() {
assert_eq!(file_name, "skip_barber_centripetal");
assert_eq!(skip_barber.keys().len(), 6);

let cars = &tracks["Charlotte Motor Speedway - Legends Oval"]["Global Mazda MX-5 Cup"];
let cars = &tracks["Charlotte Motor Speedway"]["Global Mazda MX-5 Cup"];
assert_eq!(cars.len(), 1);
let SetupInfo {
setup: mx5,
Expand Down Expand Up @@ -57,7 +57,7 @@ fn test_load_dir() {
assert_eq!(file_name, "baseline");
assert_eq!(porche911.keys().len(), 12);

let cars = &tracks["Watkins Glen International - Boot"]["Mercedes-AMG W12 E Performance"];
let cars = &tracks["Watkins Glen International"]["Mercedes-AMG W12 E Performance"];
assert_eq!(cars.len(), 1);
let SetupInfo {
setup: mercedes,
Expand Down Expand Up @@ -169,10 +169,7 @@ fn test_setup_mx5() {
let (track_name, car_name, setup) =
setup_from_html("./fixtures/mx5_charlotte_legends_oval.htm", &config).unwrap();

assert_eq!(
track_name,
"Charlotte Motor Speedway - Legends Oval".to_string()
);
assert_eq!(track_name, "Charlotte Motor Speedway".to_string());
assert_eq!(car_name, "Global Mazda MX-5 Cup".to_string());
assert_eq!(setup.keys().len(), 6);

Expand Down Expand Up @@ -725,7 +722,7 @@ fn test_setup_mercedes_amg_w12() {
let (track_name, car_name, setup) =
setup_from_html("./fixtures/iracing_w12_baseline_glenboot.htm", &config).unwrap();

assert_eq!(track_name, "Watkins Glen International - Boot".to_string());
assert_eq!(track_name, "Watkins Glen International".to_string());
assert_eq!(car_name, "Mercedes-AMG W12 E Performance".to_string());
assert_eq!(setup.keys().len(), 16);

Expand Down Expand Up @@ -952,9 +949,9 @@ fn test_remove_setup() {
let tracks = setups.tracks();
assert_eq!(tracks.len(), 4);
assert!(tracks.contains_key("Centripetal Circuit"));
assert!(tracks.contains_key("Charlotte Motor Speedway - Legends Oval"));
assert!(tracks.contains_key("Charlotte Motor Speedway"));
assert!(tracks.contains_key("Circuit des 24 Heures du Mans - 24 Heures du Mans"));
assert!(tracks.contains_key("Watkins Glen International - Boot"));
assert!(tracks.contains_key("Watkins Glen International"));
}

let mut config = Config::new("/tmp/some/path.toml", PhysicalSize::new(0, 0));
Expand All @@ -965,10 +962,10 @@ fn test_remove_setup() {
let tracks = setups.tracks();
assert_eq!(tracks.len(), 5);
assert!(tracks.contains_key("Centripetal Circuit"));
assert!(tracks.contains_key("Charlotte Motor Speedway - Legends Oval"));
assert!(tracks.contains_key("Charlotte Motor Speedway"));
assert!(tracks.contains_key("Circuit des 24 Heures du Mans - 24 Heures du Mans"));
assert!(tracks.contains_key("Nürburgring Combined"));
assert!(tracks.contains_key("Watkins Glen International - Boot"));
assert!(tracks.contains_key("Watkins Glen International"));

let mut result = Vec::new();
let path = Path::new("./fixtures/baseline.htm")
Expand Down