Skip to content

Commit

Permalink
additional testing
Browse files Browse the repository at this point in the history
  • Loading branch information
flexatone committed Mar 17, 2024
1 parent 6ccfc4a commit 0e42129
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Code: https://github.com/flexatone/xensieve-py

# Rust Implementation

The Python implementation is built with PyO3, which wraps the Rust core library `xensieve`.

Code: https://github.com/flexatone/xensieve-rs

Docs: https://docs.rs/xensieve
Expand Down
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Sieve {
self.s.contains(v as i128)
}

fn __neg__(&self) -> Self {
fn __invert__(&self) -> Self {
let new: SieveRS = !self.s.clone();
Self { s: new }
}
Expand Down Expand Up @@ -70,4 +70,12 @@ mod tests {
assert_eq!(s.__contains__(2), true);
assert_eq!(s.__contains__(3), false);
}

#[test]
fn test_sieve_invert_a() {
let s1 = Sieve::new("3@2".to_string());
let s2 = s1.__invert__();
assert_eq!(s2.__repr__(), "Sieve{!(3@2)}");
}

}

0 comments on commit 0e42129

Please sign in to comment.