extern crate dia_semver;
use {
core::str::FromStr,
std::collections::BTreeSet,
dia_semver::Semver,
};
#[test]
fn ordering() {
assert_eq!(Semver::from_str("1.0.0").unwrap(), Semver::from_str("1.0.0").unwrap());
assert!(Semver::from_str("1.0.0").unwrap() < Semver::from_str("1.0.1").unwrap());
assert!(Semver::from_str("1.1.0").unwrap() > Semver::from_str("1.0.1").unwrap());
assert_eq!(Semver::from_str("2.0.0-abc").unwrap(), Semver::from_str("2.0.0-abc").unwrap());
assert!(Semver::from_str("2.0.0-abc").unwrap() < Semver::from_str("2.0.0-xyz").unwrap());
assert_eq!(Semver::from_str("3.0-abc+2313").unwrap(), Semver::from_str("3.0.0-abc").unwrap());
assert_eq!(Semver::from_str("3.1.0-abc+2313").unwrap(), Semver::from_str("3.1-abc+xyz-123").unwrap());
assert_eq!(Semver::from_str("4-abc.123").unwrap(), Semver::from_str("4-abc.123").unwrap());
assert!(Semver::from_str("4-abc.123").unwrap() > Semver::from_str("4-123.abc").unwrap());
assert!(Semver::from_str("4-123").unwrap() < Semver::from_str("4-123.abc").unwrap());
assert!(Semver::from_str("5-123").unwrap() < Semver::from_str("5-321").unwrap());
assert!(Semver::from_str("5-123.abc").unwrap() < Semver::from_str("5-321").unwrap());
assert!(Semver::from_str("5-123").unwrap() < Semver::from_str("5-321.xyz").unwrap());
assert!(Semver::from_str("6").unwrap() > Semver::from_str("6-ABC").unwrap());
assert_eq!(Semver::from_str("6").unwrap(), Semver::from_str("6+ABC").unwrap());
assert_eq!(Semver::from_str("6+XYZ").unwrap(), Semver::from_str("6+ABC").unwrap());
assert!(Semver::from_str("7.0.0-123").unwrap() > Semver::from_str("7.0.0-9").unwrap());
assert!(Semver::from_str("7.0.0-123").unwrap() > Semver::from_str("7.0.0-99").unwrap());
assert!(Semver::from_str("7.0.0-123").unwrap() < Semver::from_str("7.0.0-321").unwrap());
assert!(Semver::from_str("7.0.0-123").unwrap() < Semver::from_str("7.0.0-999").unwrap());
assert_eq!(Semver::from_str("7.0.0-123456").unwrap(), Semver::from_str("7.0.0-123456").unwrap());
assert!(Semver::from_str("1.0.0-alpha").unwrap() < Semver::from_str("1.0.0-alpha.1").unwrap());
assert!(Semver::from_str("1.0.0-alpha.1").unwrap() < Semver::from_str("1.0.0-alpha.beta").unwrap());
assert!(Semver::from_str("1.0.0-alpha.beta").unwrap() < Semver::from_str("1.0.0-beta").unwrap());
assert!(Semver::from_str("1.0.0-beta").unwrap() < Semver::from_str("1.0.0-beta.2").unwrap());
assert!(Semver::from_str("1.0.0-beta.2").unwrap() < Semver::from_str("1.0.0-beta.11").unwrap());
assert!(Semver::from_str("1.0.0-beta.11").unwrap() < Semver::from_str("1.0.0-rc.1").unwrap());
assert!(Semver::from_str("1.0.0-rc.1").unwrap() < Semver::from_str("1.0.0").unwrap());
let mut set = BTreeSet::new();
set.insert(Semver::from_str("1.0.0+a.b.c").unwrap());
set.insert(Semver::from_str("1.0.0").unwrap());
assert_eq!(set.len(), 1);
}