We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc3e1fe commit 9c17fb0Copy full SHA for 9c17fb0
Project-Euler/test/Problem014.test.js
@@ -1,14 +1,15 @@
1
+import { expect } from 'vitest'
2
import { findLongestCollatzSequence } from '../Problem014.js'
3
4
describe('Longest Collatz Sequence', () => {
- 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
+ test.each([
+ [2, 1],
+ [13, 9],
+ [1000000, 837799]
+ ])(
+ 'if limit is %i, then the Longest Collatz Sequence will be %i',
+ (a, expected) => {
+ expect(findLongestCollatzSequence(a)).toBe(expected)
+ }
14
+ )
15
})
0 commit comments