Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anchpop committed Dec 26, 2024
1 parent 01bd615 commit f88b611
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/native_filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ async fn main() {
victor.clear_db().await.unwrap();

victor
.write(
.add_embedding(
"Test Vector 1",
vec![1.0, 0.0, 0.0],
vec!["Test".to_string()],
)
.await;
victor
.write(
.add_embedding(
"Test Vector 2",
vec![0.0, 1.0, 0.0],
vec!["Test".to_string()],
Expand Down
20 changes: 13 additions & 7 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ async fn store_and_retrieve() {

let mut victor = Db::new(DirectoryHandle::new());

victor.write("hello", embedding.clone(), vec![]).await;
victor
.add_embedding("hello", embedding.clone(), vec![])
.await;

let result = victor
.search_embedding(embedding, vec![], 1)
Expand All @@ -26,8 +28,12 @@ async fn store_two_and_retrieve() {

let mut victor = Db::new(DirectoryHandle::new());

victor.write("hello", embedding_1.clone(), vec![]).await;
victor.write("goodbye", embedding_2.clone(), vec![]).await;
victor
.add_embedding("hello", embedding_1.clone(), vec![])
.await;
victor
.add_embedding("goodbye", embedding_2.clone(), vec![])
.await;

{
let result = victor
Expand Down Expand Up @@ -61,10 +67,10 @@ async fn store_two_and_retrieve_with_tags() {
let mut victor = Db::new(DirectoryHandle::new());

victor
.write("hello", embedding_1.clone(), vec!["greetings".to_string()])
.add_embedding("hello", embedding_1.clone(), vec!["greetings".to_string()])
.await;
victor
.write("goodbye", embedding_2.clone(), vec!["goodbyes".to_string()])
.add_embedding("goodbye", embedding_2.clone(), vec!["goodbyes".to_string()])
.await;

{
Expand Down Expand Up @@ -128,8 +134,8 @@ async fn incompatible_size_panic() {

let mut victor = Db::new(DirectoryHandle::new());

victor.write("hello", embedding_1, vec![]).await;
victor.write("hello", embedding_2, vec![]).await;
victor.add_embedding("hello", embedding_1, vec![]).await;
victor.add_embedding("hello", embedding_2, vec![]).await;
}

#[tokio::test]
Expand Down

0 comments on commit f88b611

Please sign in to comment.