Skip to content

Commit

Permalink
Fixed failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
RRArny committed Sep 12, 2024
1 parent 1654942 commit 6e31dd0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/metar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ mod tests {
let config = Config {
position: Position::Airfield("EDRK".to_string()),
};
let metar = Metar::from_json(json, &config);
let metar = Metar::from_json(&json, &config);
assert!(metar.is_some_and(|m| m.icao_code == "EDRK"));
}

Expand All @@ -389,7 +389,7 @@ mod tests {
position: Position::Airfield("EDRK".to_string()),
};
let expected = DateTime::parse_from_rfc3339("2024-06-21T05:50:00Z").unwrap();
let metar = Metar::from_json(json, &config);
let metar = Metar::from_json(&json, &config);
assert!(metar.is_some_and(|m| m.fields.contains(&MetarField::TimeStamp(expected))));
}

Expand Down Expand Up @@ -427,19 +427,19 @@ mod tests {

#[test]
fn test_colourise_visibility_good() {
let vis_str: ColoredString = colourise_visibility(&9999);
let vis_str: ColoredString = colourise_visibility(9999);
assert_eq!(vis_str.fgcolor(), Some(Color::Green));
}

#[test]
fn test_colourise_visibility_medium() {
let vis_str: ColoredString = colourise_visibility(&2000);
let vis_str: ColoredString = colourise_visibility(2000);
assert_eq!(vis_str.fgcolor(), Some(Color::Yellow));
}

#[test]
fn test_colourise_visibility_bad() {
let vis_str: ColoredString = colourise_visibility(&1000);
let vis_str: ColoredString = colourise_visibility(1000);
assert_eq!(vis_str.fgcolor(), Some(Color::Red));
}

Expand All @@ -452,7 +452,7 @@ mod tests {
gusts: 15,
unit: SpeedUnit::Kt,
};
let actual = get_winds(&json, &Units::default());
let actual = get_winds(&json, Units::default());
assert!(actual.is_some_and(|w| w == expected));
}

Expand All @@ -467,15 +467,15 @@ mod tests {
gusts: 0,
unit: SpeedUnit::Kt,
};
let actual = get_winds(&json, &Units::default());
let actual = get_winds(&json, Units::default());
assert!(actual.is_some_and(|w| w == expected));
}

#[test]
fn test_get_qnh() {
let json: Value = Value::from_str("{\"altimeter\":{\"value\": 1013}}").unwrap();
let expected = MetarField::Qnh(1013, PressureUnit::Hpa);
let actual = get_qnh(&json, &Units::default());
let actual = get_qnh(&json, Units::default());
assert!(actual.is_some_and(|q| q == expected));
}

Expand All @@ -490,7 +490,7 @@ mod tests {
temperature: TemperatureUnit::C,
distance: DistanceUnit::M,
};
let actual = get_qnh(&json, &units);
let actual = get_qnh(&json, units);
println!("{:?}", actual);
assert!(actual.is_some_and(|q| q == expected));
}
Expand All @@ -513,7 +513,7 @@ mod tests {
dewpoint: 9,
unit: TemperatureUnit::C,
};
let actual = get_temp(&json, &Units::default());
let actual = get_temp(&json, Units::default());
assert!(actual.is_some_and(|t| t == expected));
}

Expand All @@ -534,7 +534,7 @@ mod tests {
fn test_get_visibility() {
let json: Value = Value::from_str("{\"visibility\":{\"value\":9999}}").unwrap();
let expected: MetarField = MetarField::Visibility(9999);
let actual = get_visibility(&json, &Units::default());
let actual = get_visibility(&json, Units::default());
assert!(actual.is_some_and(|v| v == expected));
}
}

0 comments on commit 6e31dd0

Please sign in to comment.