use jayver::{Version, VersionReq};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let v1 = Version::parse("25.10.0")?;
let v2 = Version::parse("25.15.0")?;
let v3 = Version::parse("26.1.0")?;
let req1 = VersionReq::parse(">=25.10.0")?;
let req2 = VersionReq::parse(">25.10.0,<26.0.0")?;
let req3 = VersionReq::parse("~>25.15.0")?;
println!("v1 matches req1: {}", req1.matches(&v1));
println!("v2 matches req1: {}", req1.matches(&v2));
println!("v3 matches req1: {}", req1.matches(&v3));
println!("v1 matches req2: {}", req2.matches(&v1));
println!("v2 matches req2: {}", req2.matches(&v2));
println!("v3 matches req2: {}", req2.matches(&v3));
println!("v1 matches req3: {}", req3.matches(&v1));
println!("v2 matches req3: {}", req3.matches(&v2));
println!("v3 matches req3: {}", req3.matches(&v3));
let mut custom_req = VersionReq::new();
custom_req.with(">=25.10.0")?.with("<26.0.0")?;
println!("Custom req: {custom_req}");
println!("v1 matches custom: {}", custom_req.matches(&v1));
println!("v3 matches custom: {}", custom_req.matches(&v3));
let any_req = VersionReq::any([">25.50.0", "<25.5.0"])?;
println!("v1 matches any: {}", any_req.matches(&v1));
let early = Version::parse("25.3.0")?;
println!("early matches any: {}", any_req.matches(&early));
Ok(())
}