Skip to content

Commit

Permalink
Vector.fromList: constructor speed up
Browse files Browse the repository at this point in the history
  • Loading branch information
gyrdym committed Jun 4, 2024
1 parent 2b6c476 commit 11f455c
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,25 @@ void vectorFromListConstructorTestGroupFactory(DType dtype) =>
expect(vector.length, 0);
expect(vector.dtype, dtype);
});

test('should provide correct size of vectors when summing up, length is 3', () {
final vector1 = Vector.fromList([1, 2, 3], dtype: dtype);
final vector2 = Vector.fromList([3, 4, 5], dtype: dtype);
final vector = vector1 + vector2;

expect(vector, equals(<double>[4, 6, 8]));
expect(vector.length, 3);
expect(vector.dtype, dtype);
});

test('should provide correct size of vectors when summing up, length is 5', () {
final vector1 = Vector.fromList([1, 2, 3, 4, 5], dtype: dtype);
final vector2 = Vector.fromList([3, 4, 5, 6, 7], dtype: dtype);
final vector = vector1 + vector2;

expect(vector, equals(<double>[4, 6, 8, 10, 12]));
expect(vector.length, 5);
expect(vector.dtype, dtype);
});
});
});

0 comments on commit 11f455c

Please sign in to comment.