-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc3e1fe
commit 9c17fb0
Showing
1 changed file
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import { expect } from 'vitest' | ||
import { findLongestCollatzSequence } from '../Problem014.js' | ||
|
||
describe('Longest Collatz Sequence', () => { | ||
test('if limit is 2', () => { | ||
expect(findLongestCollatzSequence(2)).toBe(1) | ||
}) | ||
test('if limit is 13', () => { | ||
expect(findLongestCollatzSequence(13)).toBe(9) | ||
}) | ||
// Project Euler Condition Check | ||
test('if limit is 1000000', () => { | ||
expect(findLongestCollatzSequence(1000000)).toBe(837799) | ||
}) | ||
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) | ||
} | ||
) | ||
}) |