Skip to content

Commit

Permalink
v4.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fraterenz committed Apr 2, 2024
1 parent 70898df commit cc98365
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
The semantic versioning is kind of random.

## 4.2.1
### BugFix
- `is_asymmetric` was actually symmetric

## 4.2.0
- Add two mus: one for the exp. phase and the other for the Moran phase.
### BugFix
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hsc"
version = "4.2.0"
version = "4.2.1"
edition = "2021"

[dependencies]
Expand Down
29 changes: 28 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct Probs {

impl Probs {
pub fn is_asymmetric(&self) -> bool {
(self.asymmetric - 0.).abs() < f32::EPSILON
(self.asymmetric - 0.).abs() > f32::EPSILON
}
}

Expand Down Expand Up @@ -288,3 +288,30 @@ fn main() {
0
});
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn is_symmetric_test() {
let probs = Probs {
mu_background: 1.,
mu_division: 1.,
mu: 1.,
asymmetric: 0.,
};
assert!(!probs.is_asymmetric());
}

#[test]
fn is_asymmetric_test() {
let probs = Probs {
mu_background: 1.,
mu_division: 1.,
mu: 1.,
asymmetric: 1.,
};
assert!(probs.is_asymmetric());
}
}

0 comments on commit cc98365

Please sign in to comment.