Skip to content

Commit 9a4b9c3

Browse files
committed
more tests
1 parent a7a2f6a commit 9a4b9c3

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

tests/StackExchange.Redis.Tests/VectorSetIntegrationTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,39 @@ public async Task VectorSetAdd_WithAttributes()
5757
Assert.Equal(attributes, retrievedAttributes);
5858
}
5959

60+
[Theory]
61+
[InlineData(VectorQuantizationType.Int8)]
62+
[InlineData(VectorQuantizationType.None)]
63+
[InlineData(VectorQuantizationType.Binary)]
64+
public async Task VectorSetAdd_WithEverything(VectorQuantizationType quantizationType)
65+
{
66+
using var conn = Create();
67+
var db = conn.GetDatabase();
68+
var key = Me();
69+
70+
await db.KeyDeleteAsync(key);
71+
72+
var vector = new float[] { 1.0f, 2.0f, 3.0f, 4.0f };
73+
var attributes = """{"category":"test","id":123}""";
74+
75+
var result = await db.VectorSetAddAsync(
76+
key,
77+
"element1",
78+
vector.AsMemory(),
79+
attributesJson: attributes,
80+
useCheckAndSet: true,
81+
quantizationType: quantizationType,
82+
reducedDimensions: 64,
83+
buildExplorationFactor: 300,
84+
maxConnections: 32);
85+
86+
Assert.True(result);
87+
88+
// Verify attributes were stored
89+
var retrievedAttributes = await db.VectorSetGetAttributesJsonAsync(key, "element1");
90+
Assert.Equal(attributes, retrievedAttributes);
91+
}
92+
6093
[Fact]
6194
public async Task VectorSetLength_EmptySet()
6295
{

0 commit comments

Comments
 (0)