Skip to content

Commit

Permalink
Fix: JS Rust test
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Nov 17, 2024
1 parent e09c611 commit 6850c9a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rust/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,19 +877,19 @@ mod tests {
// Adding new tests for probability similarities
#[test]
fn test_js_f32() {
let a = &[0.1, 0.9, 0.0];
let b = &[0.2, 0.8, 0.0];
let a: &[f32; 3] = &[0.1, 0.9, 0.0];
let b: &[f32; 3] = &[0.2, 0.8, 0.0];

if let Some(result) = ProbabilitySimilarity::jensenshannon(a, b) {
println!("The result of js_f32 is {:.8}", result);
assert_almost_equal(0.01, result, 0.01); // Example value
assert_almost_equal(0.099, result, 0.01); // Example value
}
}

#[test]
fn test_kl_f32() {
let a = &[0.1, 0.9, 0.0];
let b = &[0.2, 0.8, 0.0];
let a: &[f32; 3] = &[0.1, 0.9, 0.0];
let b: &[f32; 3] = &[0.2, 0.8, 0.0];

if let Some(result) = ProbabilitySimilarity::kullbackleibler(a, b) {
println!("The result of kl_f32 is {:.8}", result);
Expand Down

0 comments on commit 6850c9a

Please sign in to comment.