@@ -424,10 +424,14 @@ public async Task VectorSetGetLinks()
424424 using var links = await db . VectorSetGetLinksAsync ( key , "element1" ) ;
425425
426426 Assert . NotNull ( links ) ;
427+ foreach ( var link in links . Span )
428+ {
429+ Log ( link . ToString ( ) ) ;
430+ }
431+
427432 var linksArray = links . Span . ToArray ( ) ;
428433
429- // Should contain the other elements
430- Assert . Equal ( 2 , linksArray . Length ) ;
434+ // Should contain the other elements (note there can be transient duplicates, so: contains, not exact)
431435 Assert . Contains ( "element2" , linksArray ) ;
432436 Assert . Contains ( "element3" , linksArray ) ;
433437 }
@@ -469,12 +473,11 @@ public async Task VectorSetGetLinksWithScores()
469473 Assert . True ( link . Score >= 0.0 ) ; // Similarity scores should be non-negative
470474 } ) ;
471475
472- // Should contain the other elements
473- Assert . Equal ( 2 , linksArray . Length ) ;
476+ // Should contain the other elements (note there can be transient duplicates, so: contains, not exact)
474477 Assert . Contains ( linksArray , l => l . Member == "element2" ) ;
475478 Assert . Contains ( linksArray , l => l . Member == "element3" ) ;
476479
477- Assert . True ( linksArray . Single ( l => l . Member == "element2" ) . Score > 0.9 ) ; // similar
478- Assert . True ( linksArray . Single ( l => l . Member == "element3" ) . Score < 0.8 ) ; // less-so
480+ Assert . True ( linksArray . First ( l => l . Member == "element2" ) . Score > 0.9 ) ; // similar
481+ Assert . True ( linksArray . First ( l => l . Member == "element3" ) . Score < 0.8 ) ; // less-so
479482 }
480483}
0 commit comments