Add test for impl PartialCmp for Version
This commit is contained in:
parent
0fdfecf842
commit
626a5c288f
@ -211,7 +211,7 @@ impl PartialOrd for Version {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::num::NonZeroU16;
|
||||
use std::{num::NonZeroU16, str::FromStr};
|
||||
|
||||
#[test]
|
||||
fn from_str() {
|
||||
@ -262,4 +262,19 @@ mod tests {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmp() {
|
||||
let astr = "3.14.0-x86_64";
|
||||
let bstr = "3.14.0_alpha1-x86_64";
|
||||
let cstr = "3.14_alpha1-amd64";
|
||||
let dstr = "3.14.0_beta3-x86_64";
|
||||
let estr = "3.14.0_git_c3poxxx.1705881493-x86_64";
|
||||
let fstr = "3.14.0_git_r2d2xxx.1705900000-x86_64";
|
||||
assert!(Version::from_str(astr).unwrap() > Version::from_str(bstr).unwrap());
|
||||
assert!(Version::from_str(cstr).unwrap() == Version::from_str(bstr).unwrap());
|
||||
assert!(Version::from_str(cstr).unwrap() < Version::from_str(dstr).unwrap());
|
||||
assert!(Version::from_str(dstr).unwrap() > Version::from_str(estr).unwrap());
|
||||
assert!(Version::from_str(fstr).unwrap() > Version::from_str(estr).unwrap());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user