Skip to content

Commit 9c17fb0

Browse files
👌 IMPROVE: code improvements
1 parent bc3e1fe commit 9c17fb0

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Project-Euler/test/Problem014.test.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
import { expect } from 'vitest'
12
import { findLongestCollatzSequence } from '../Problem014.js'
23

34
describe('Longest Collatz Sequence', () => {
4-
test('if limit is 2', () => {
5-
expect(findLongestCollatzSequence(2)).toBe(1)
6-
})
7-
test('if limit is 13', () => {
8-
expect(findLongestCollatzSequence(13)).toBe(9)
9-
})
10-
// Project Euler Condition Check
11-
test('if limit is 1000000', () => {
12-
expect(findLongestCollatzSequence(1000000)).toBe(837799)
13-
})
5+
test.each([
6+
[2, 1],
7+
[13, 9],
8+
[1000000, 837799]
9+
])(
10+
'if limit is %i, then the Longest Collatz Sequence will be %i',
11+
(a, expected) => {
12+
expect(findLongestCollatzSequence(a)).toBe(expected)
13+
}
14+
)
1415
})

0 commit comments

Comments
 (0)