Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"ml-xsadd": "^3.0.1"
},
"devDependencies": {
"@types/node": "^24.3.1",
"@types/node": "^24.5.2",
"@vitest/coverage-v8": "^3.2.4",
"@zakodium/tsconfig": "^1.0.2",
"cheminfo-build": "^1.3.1",
"eslint": "^9.35.0",
"eslint": "^9.36.0",
"eslint-config-cheminfo-typescript": "^20.0.0",
"jest-matcher-deep-close-to": "^3.0.2",
"ml-spectra-fitting": "^5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`test existence of exported functions 1`] = `
exports[`existence of exported functions 1`] = `
[
"reimAbsolute",
"reimAutoPhaseCorrection",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from 'vitest';

import * as SpectraProcessing from '../index.ts';

test('test existence of exported functions', () => {
test('existence of exported functions', () => {
const exports = Object.keys(SpectraProcessing);

expect(exports).toMatchSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion src/matrix/__tests__/matrixAutoCorrelation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test('simple', () => {
expect(result[1]).toBeCloseTo(-1, 10);
});

test('test matrixAutoCorrelation too small', () => {
test('matrixAutoCorrelation too small', () => {
const matrix = [[0]];

expect(() => matrixAutoCorrelation(matrix)).toThrow(
Expand Down
10 changes: 5 additions & 5 deletions src/matrix/__tests__/matrixBoxPlot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from 'vitest';

import { matrixBoxPlot } from '../matrixBoxPlot.ts';

test('test matrixBoxPlot even', () => {
test('matrixBoxPlot even', () => {
const matrix = [
[0, 0],
[1, 10],
Expand All @@ -27,7 +27,7 @@ test('test matrixBoxPlot even', () => {
});
});

test('test matrixBoxPlot even small', () => {
test('matrixBoxPlot even small', () => {
const matrix = [[0], [1], [2], [3], [4], [5]];

expect(matrixBoxPlot(matrix)).toStrictEqual({
Expand All @@ -39,7 +39,7 @@ test('test matrixBoxPlot even small', () => {
});
});

test('test matrixBoxPlot odd', () => {
test('matrixBoxPlot odd', () => {
const matrix = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10]];

expect(matrixBoxPlot(matrix)).toStrictEqual({
Expand All @@ -51,7 +51,7 @@ test('test matrixBoxPlot odd', () => {
});
});

test('test matrixBoxPlot odd small', () => {
test('matrixBoxPlot odd small', () => {
const matrix = [[0], [1], [2], [3], [4]];

expect(matrixBoxPlot(matrix)).toStrictEqual({
Expand All @@ -63,7 +63,7 @@ test('test matrixBoxPlot odd small', () => {
});
});

test('test matrixBoxPlot too small', () => {
test('matrixBoxPlot too small', () => {
const matrix = [[0], [1], [2], [4]];

expect(() => matrixBoxPlot(matrix)).toThrow(
Expand Down
2 changes: 1 addition & 1 deletion src/reim/__tests__/reimAbsolute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from 'vitest';

import { reimAbsolute } from '../reimAbsolute.ts';

test('test reimAbsolute', () => {
test('reimAbsolute', () => {
const re = [0, 3, 6];
const im = [0, 4, 8];
const result = reimAbsolute({ re, im });
Expand Down
2 changes: 1 addition & 1 deletion src/reim/__tests__/reimFFT.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from 'vitest';

import { reimFFT } from '../reimFFT.ts';

test('test reimFFT', () => {
test('reimFFT', () => {
const re = Float64Array.from([0, 3, 6, 5]);
const im = Float64Array.from([0, 4, 8, 3]);
const transformed = reimFFT({ re, im }, { applyZeroShift: true });
Expand Down
2 changes: 1 addition & 1 deletion src/reim/__tests__/reimPhaseCorrection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const data = {
],
};

test('test reimPhaseCorrection even', () => {
test('reimPhaseCorrection even', () => {
const re = [0, 1, 2, 3];
const im = [0, 1, 2, 3];
const result = reimPhaseCorrection({ re, im }, 0, 0);
Expand Down
6 changes: 3 additions & 3 deletions src/reim/__tests__/reimZeroFilling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from 'vitest';

import { reimZeroFilling } from '../reimZeroFilling.ts';

test('test xreimZeroFilling over', () => {
test('xreimZeroFilling over', () => {
const re = [0, 1, 2, 3];
const im = [4, 5, 6, 7];
const result = reimZeroFilling({ re, im }, 6);
Expand All @@ -16,7 +16,7 @@ test('test xreimZeroFilling over', () => {
});
});

test('test xreimZeroFilling equal', () => {
test('xreimZeroFilling equal', () => {
const re = [0, 1, 2, 3];
const im = [4, 5, 6, 7];
const result = reimZeroFilling({ re, im }, 4);
Expand All @@ -29,7 +29,7 @@ test('test xreimZeroFilling equal', () => {
});
});

test('test xreimZeroFilling under', () => {
test('xreimZeroFilling under', () => {
const re = [0, 1, 2, 3];
const im = [4, 5, 6, 7];
const result = reimZeroFilling({ re, im }, 2);
Expand Down
6 changes: 3 additions & 3 deletions src/x/__tests__/xAdd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from 'vitest';

import { xAdd } from '../xAdd.ts';

test('test xAdd of 2 vectors', () => {
test('xAdd of 2 vectors', () => {
const array1 = [10, 11, 12, 13, 14];
const array2 = [5, 4, 3, 2, 1];

Expand All @@ -11,15 +11,15 @@ test('test xAdd of 2 vectors', () => {
);
});

test('test xAdd of 2 a constant', () => {
test('xAdd of 2 a constant', () => {
const array1 = [10, 11, 12, 13, 14];

expect(xAdd(array1, 5)).toStrictEqual(
Float64Array.from([15, 16, 17, 18, 19]),
);
});

test('test xAdd of array and floatarray', () => {
test('xAdd of array and floatarray', () => {
const array1 = [10, 11, 12, 13, 14];
const array2 = new Float64Array([5, 4, 3, 2, 1]);

Expand Down
16 changes: 8 additions & 8 deletions src/x/__tests__/xBoxPlot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test('basic even', () => {
});
});

test('test xBoxPlot even', () => {
test('xBoxPlot even', () => {
const array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];

expect(xBoxPlot(array)).toStrictEqual({
Expand All @@ -53,7 +53,7 @@ test('test xBoxPlot even', () => {
});
});

test('test xBoxPlot even small', () => {
test('xBoxPlot even small', () => {
const array = [0, 1, 2, 3, 4, 5];

expect(xBoxPlot(array)).toStrictEqual({
Expand All @@ -65,7 +65,7 @@ test('test xBoxPlot even small', () => {
});
});

test('test xBoxPlot odd', () => {
test('xBoxPlot odd', () => {
const array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

expect(xBoxPlot(array)).toStrictEqual({
Expand All @@ -77,7 +77,7 @@ test('test xBoxPlot odd', () => {
});
});

test('test xBoxPlot odd small', () => {
test('xBoxPlot odd small', () => {
const array = [0, 1, 2, 3, 4];

expect(xBoxPlot(array)).toStrictEqual({
Expand All @@ -89,13 +89,13 @@ test('test xBoxPlot odd small', () => {
});
});

test('test xBoxPlot too small', () => {
test('xBoxPlot too small', () => {
const array: number[] = [];

expect(() => xBoxPlot(array)).toThrow('input must not be empty');
});

test('test xBoxPlot with one element', () => {
test('xBoxPlot with one element', () => {
const array = [42];

expect(xBoxPlot(array)).toStrictEqual({
Expand All @@ -107,7 +107,7 @@ test('test xBoxPlot with one element', () => {
});
});

test('test xBoxPlot with 2 elements', () => {
test('xBoxPlot with 2 elements', () => {
const array = [40, 44];
const result = xBoxPlot(array);

Expand All @@ -120,7 +120,7 @@ test('test xBoxPlot with 2 elements', () => {
});
});

test('test xBoxPlot with 3 elements', () => {
test('xBoxPlot with 3 elements', () => {
const array = [44, 40, 42];
const result = xBoxPlot(array);

Expand Down
2 changes: 1 addition & 1 deletion src/x/__tests__/xBoxPlotWithOutliers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from 'vitest';

import { xBoxPlotWithOutliers } from '../xBoxPlotWithOutliers.ts';

test('test xBoxPlotWithOutliers even', () => {
test('xBoxPlotWithOutliers even', () => {
const array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
const result = xBoxPlotWithOutliers(array);

Expand Down
6 changes: 3 additions & 3 deletions src/x/__tests__/xDivide.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from 'vitest';

import { xDivide } from '../xDivide.ts';

test('test divide of 2 vectors', () => {
test('divide of 2 vectors', () => {
const array1 = [10, 15, 20, 25, 30];
const array2 = [2, 3, 4, 5, 6];

Expand All @@ -11,7 +11,7 @@ test('test divide of 2 vectors', () => {
);
});

test('test divide of Array and FloatArray', () => {
test('divide of Array and FloatArray', () => {
const array1 = [10, 15, 20, 25, 30];
const array2 = new Float64Array([2, 3, 4, 5, 6]);

Expand All @@ -20,7 +20,7 @@ test('test divide of Array and FloatArray', () => {
);
});

test('test mul of 2 a constant', () => {
test('mul of 2 a constant', () => {
const array1 = [10, 15, 20, 25, 30];

expect(xDivide(array1, 5)).toStrictEqual(Float64Array.from([2, 3, 4, 5, 6]));
Expand Down
10 changes: 5 additions & 5 deletions src/x/__tests__/xHilbertTransform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect, test } from 'vitest';
import { xHilbertTransform } from '../xHilbertTransform.ts';
import { xMaxValue } from '../xMaxValue.ts';

test('test discrete hilbert transform', () => {
test('discrete hilbert transform', () => {
const length = 50;
const cos = new Float64Array(length);
const sin = new Float64Array(length);
Expand All @@ -26,7 +26,7 @@ test('test discrete hilbert transform', () => {
}
});

test('test fast hilbert transform', () => {
test('fast hilbert transform', () => {
const length = 64;
const cos = new Float64Array(length);
const sin = new Float64Array(length);
Expand All @@ -49,7 +49,7 @@ test('test fast hilbert transform', () => {
}
});

test('test fast hilbert transform of squareWave function', () => {
test('fast hilbert transform of squareWave function', () => {
const length = 64;
const p = 16;
const squareWave = new Float64Array(length);
Expand All @@ -66,7 +66,7 @@ test('test fast hilbert transform of squareWave function', () => {
}
});

test('test fast hilbert transform with forceFFT (array length greater than a power of 2)', () => {
test('fast hilbert transform with forceFFT (array length greater than a power of 2)', () => {
const length = 74;
const cos = new Float64Array(length);
const sin = new Float64Array(length);
Expand All @@ -88,7 +88,7 @@ test('test fast hilbert transform with forceFFT (array length greater than a pow
}
});

test('test fast hilbert transform with forceFFT (array length less than a power of 2)', () => {
test('fast hilbert transform with forceFFT (array length less than a power of 2)', () => {
const length = 54;
const x = new Float64Array(length);
const cos = new Float64Array(length);
Expand Down
18 changes: 9 additions & 9 deletions src/x/__tests__/xIsMonotonic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,55 @@ import { expect, test } from 'vitest';

import { xIsMonotonic } from '../xIsMonotonic.ts';

test('test xIsMonotonic increasing', () => {
test('xIsMonotonic increasing', () => {
const array = [1, 2, 3, 4, 5];

expect(xIsMonotonic(array)).toBe(1);
});

test('test xIsMonotonic increasing but duplicate value', () => {
test('xIsMonotonic increasing but duplicate value', () => {
const array = [1, 2, 4, 4, 5];

expect(xIsMonotonic(array)).toBe(0);
});

test('test xIsMonotonic increasing but duplicate starting value', () => {
test('xIsMonotonic increasing but duplicate starting value', () => {
const array = [1, 1, 2, 4, 4, 5];

expect(xIsMonotonic(array)).toBe(0);
});

test('test xIsMonotonic increasing with mistake', () => {
test('xIsMonotonic increasing with mistake', () => {
const array = [1, 2, 3, 5, 4];

expect(xIsMonotonic(array)).toBe(0);
});

test('test xIsMonotonic decreasing', () => {
test('xIsMonotonic decreasing', () => {
const array = [5, 4, 3, 2, 1];

expect(xIsMonotonic(array)).toBe(-1);
});

test('test xIsMonotonic decreasing but duplicate value', () => {
test('xIsMonotonic decreasing but duplicate value', () => {
const array = [5, 4, 4, 2, 1];

expect(xIsMonotonic(array)).toBe(0);
});

test('test xIsMonotonic decreasing but duplicate starting value', () => {
test('xIsMonotonic decreasing but duplicate starting value', () => {
const array = [5, 5, 4, 4, 2, 1];

expect(xIsMonotonic(array)).toBe(0);
});

test('test xIsMonotonic decreasing with mistake', () => {
test('xIsMonotonic decreasing with mistake', () => {
const array = [4, 5, 3, 2, 1];

expect(xIsMonotonic(array)).toBe(0);
});

test('test xIsMonotonic constant series', () => {
test('xIsMonotonic constant series', () => {
const array = [1, 1, 1, 1];

expect(xIsMonotonic(array)).toBe(1);
Expand Down
Loading
Loading