Skip to content

Commit bca778f

Browse files
committed
Added tests for PGvector class
1 parent 1ace93f commit bca778f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.pgvector;
2+
3+
import java.sql.SQLException;
4+
import com.pgvector.PGvector;
5+
import org.junit.jupiter.api.Test;
6+
7+
import static org.junit.jupiter.api.Assertions.*;
8+
9+
public class PGvectorTest {
10+
@Test
11+
void testArrayConstructor() {
12+
PGvector vec = new PGvector(new float[] {1, 2, 3});
13+
assertArrayEquals(new float[] {1, 2, 3}, vec.toArray());
14+
}
15+
16+
@Test
17+
void testStringConstructor() throws SQLException {
18+
PGvector vec = new PGvector("[1,2,3]");
19+
assertArrayEquals(new float[] {1, 2, 3}, vec.toArray());
20+
}
21+
22+
@Test
23+
void testGetValue() throws SQLException {
24+
PGvector vec = new PGvector(new float[] {1, 2, 3});
25+
assertEquals("[1.0,2.0,3.0]", vec.getValue());
26+
}
27+
}

0 commit comments

Comments
 (0)