Skip to content

Commit 58991a7

Browse files
committed
add test for Vector.Reset()
1 parent e56f85f commit 58991a7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

vector_test.go

+19
Original file line numberDiff line numberDiff line change
@@ -766,3 +766,22 @@ func TestMulMatSparseVec(t *testing.T) {
766766
}
767767
}
768768
}
769+
770+
func TestReset(t *testing.T) {
771+
tests := []struct {
772+
a *Vector
773+
}{
774+
{
775+
a: NewVector(6, []int{1, 2, 4}, []float64{1, 3, 2}),
776+
},
777+
}
778+
779+
for ti, test := range tests {
780+
test.a.Reset()
781+
b := NewVector(test.a.Len(), []int{}, []float64{})
782+
783+
if !mat.Equal(test.a, b) {
784+
t.Errorf("Test %d: Incorrect result for Reset - expected:\n%v\nbut received:\n%v\n", ti+1, b, test.a)
785+
}
786+
}
787+
}

0 commit comments

Comments
 (0)