We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55a04d3 commit 9506205Copy full SHA for 9506205
Maths/test/Determinant.test.js
@@ -1,7 +1,7 @@
1
import { expect } from 'vitest'
2
import { determinant } from '../Determinant'
3
describe('Determinant', () => {
4
- const testCases = [
+ const validTestCases = [
5
[
6
7
[8, 1, 6],
@@ -36,7 +36,10 @@ describe('Determinant', () => {
36
],
37
2476
38
39
- [[[23]], 23],
+ [[[23]], 23]
40
+ ]
41
+
42
+ const errorTestCases = [
43
44
45
[1, 6],
@@ -48,7 +51,7 @@ describe('Determinant', () => {
48
51
[[1, 3, 2, [5, 8, 6], 3], 'Input is not a valid 2D matrix.']
49
52
]
50
53
- test.each(testCases)(
54
+ test.each(validTestCases)(
55
'Should return the determinant of the square matrix.',
56
(matrix, expected) => {
57
try {
@@ -58,4 +61,15 @@ describe('Determinant', () => {
58
61
}
59
62
60
63
)
64
65
+ test.each(errorTestCases)(
66
+ 'Should return the error message.',
67
+ (matrix, expected) => {
68
+ try {
69
+ expect(determinant(matrix)).toEqual(expected)
70
+ } catch (err) {
71
+ expect(err.message).toEqual(expected)
72
+ }
73
74
+ )
75
})
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments