Skip to content

Commit

Permalink
test: add testing case
Browse files Browse the repository at this point in the history
close: #4
  • Loading branch information
EscapedGibbon committed May 10, 2024
1 parent d85a924 commit 1454e56
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/__tests__/PolynomialRegression2D.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,23 @@ describe('2D polinomial fit', () => {
}
});
});
it('Other function test', () => {
const len = 4;

const x = new Array(len);
let val = 5.0;
const y = new Array(len);
const z = new Array(len);
for (let i = 0; i < len; ++i, val += 0.5) {
x[i] = val;
y[i] = val;
z[i] = val * val + val * val;
}

expect(() => {
const polynomialRegression2D = new PolynomialRegression2D({ x, y }, z, {
order: 2,
});
return polynomialRegression2D;
}).toThrow('Insufficient number of points to create regression model.');
});

0 comments on commit 1454e56

Please sign in to comment.