Skip to content

Commit

Permalink
Merge pull request #404 from h0rv/main
Browse files Browse the repository at this point in the history
Add Normalized Vector Tests for `TestVectorString32`/`64`
  • Loading branch information
rueian authored Nov 11, 2023
2 parents 98aa541 + 4972fdc commit e6b78ec
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions binary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ func TestJSONPanic(t *testing.T) {
JSON(a)
}


func TestVectorString32(t *testing.T) {
for _, test := range [][]float32{
{},
{0, 0, 0, 0},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{.9, .9, .9, .9, .9, .9, .9, .9, .9, .9, .9},
{-.1, -.1, -.1, -.1, -.1, -.1, -.1, -.1, -.1, -.1},
{.1, -.1, .1, -.1, .1, -.1, .1, -.1, .1, -.1},
} {
if !reflect.DeepEqual(test, ToVector32(VectorString32(test))) {
t.Fatalf("fail to convert %v", test)
Expand All @@ -49,6 +53,9 @@ func TestVectorString64(t *testing.T) {
{0, 0, 0, 0},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{.9, .9, .9, .9, .9, .9, .9, .9, .9, .9, .9},
{-.1, -.1, -.1, -.1, -.1, -.1, -.1, -.1, -.1, -.1},
{.1, -.1, .1, -.1, .1, -.1, .1, -.1, .1, -.1},
} {
if !reflect.DeepEqual(test, ToVector64(VectorString64(test))) {
t.Fatalf("fail to convert %v", test)
Expand Down

0 comments on commit e6b78ec

Please sign in to comment.