mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
feat: Combined Min Heap and Max Heap classes (#1494)
* Combined Min Heap and Max Heap classes * Added JSdoc comments and also improved tests for binary heap * Added private methods for BinaryHeap class * JSDoc knows that a class is a class I assume the @class tag is for classes implemented via constructor functions, not using ES6 class syntax --------- Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
This commit is contained in:
@@ -2,11 +2,17 @@ import { EuclideanDistance } from '../EuclideanDistance.js'
|
||||
|
||||
describe('EuclideanDistance', () => {
|
||||
it('should calculate the distance correctly for 2D vectors', () => {
|
||||
expect(EuclideanDistance([0, 0], [2, 2])).toBeCloseTo(2.8284271247461903, 10)
|
||||
expect(EuclideanDistance([0, 0], [2, 2])).toBeCloseTo(
|
||||
2.8284271247461903,
|
||||
10
|
||||
)
|
||||
})
|
||||
|
||||
it('should calculate the distance correctly for 3D vectors', () => {
|
||||
expect(EuclideanDistance([0, 0, 0], [2, 2, 2])).toBeCloseTo(3.4641016151377544, 10)
|
||||
expect(EuclideanDistance([0, 0, 0], [2, 2, 2])).toBeCloseTo(
|
||||
3.4641016151377544,
|
||||
10
|
||||
)
|
||||
})
|
||||
|
||||
it('should calculate the distance correctly for 4D vectors', () => {
|
||||
|
||||
Reference in New Issue
Block a user