Skip to content

Commit

Permalink
fix: ignore pre-release for version comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarlin-zama committed Jul 19, 2024
1 parent a47cf44 commit cfa8d14
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
};

#[cfg(feature = "load")]
use semver::{Version, VersionReq};
use semver::{Prerelease, Version, VersionReq};
#[cfg(feature = "load")]
use std::fmt::Display;
use strum::Display;
Expand Down Expand Up @@ -394,7 +394,10 @@ pub struct Testcase {
#[cfg(feature = "load")]
impl Testcase {
pub fn is_valid_for_version(&self, version: &str) -> bool {
let tfhe_version = Version::parse(version).unwrap();
let mut tfhe_version = Version::parse(version).unwrap();

// Removes the pre-release tag because matches will always return
tfhe_version.pre = Prerelease::EMPTY;

let req = format!(">={}", self.tfhe_version_min);
let min_version = VersionReq::parse(&req).unwrap();
Expand Down

0 comments on commit cfa8d14

Please sign in to comment.