use ahfail_ui::update::is_newer;

#[test]
fn newer_version_detected() {
    assert!(is_newer("v0.2.0", "v0.1.0"));
    assert!(!is_newer("v0.1.0", "v0.1.0"));
    assert!(!is_newer("v0.1.0", "v0.2.0"));
    assert!(!is_newer("garbage", "v0.1.0"));
}

#[test]
fn strips_v_prefix() {
    assert!(is_newer("0.2.0", "0.1.0"));
}

#[test]
fn multi_digit_minor_version() {
    assert!(is_newer("v0.10.0", "v0.9.0"));
    assert!(!is_newer("v0.9.0", "v0.10.0"));
}
