mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
Add tests for Project euler problem 14 solution (#1713)
* 📦 NEW: Added solution for ProjectEuler-007 * 🐛 FIX: Spelling mistake fixes * 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input * 👌 IMPROVE: Modified the code * 👌 IMPROVE: Added test case for ProjectEuler Problem001 * 👌 IMPROVE: Added test cases for Project Euler Problem 4 * 👌 IMPROVE: auto prettier fixes * 📦 NEW: Testcases for Project Euler Problem 14 * Updated Documentation in README.md * 👌 IMPROVE: code improvements --------- Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in> Co-authored-by: pomkarnath98 <pomkarnath98@users.noreply.github.com>
This commit is contained in:
15
Project-Euler/test/Problem014.test.js
Normal file
15
Project-Euler/test/Problem014.test.js
Normal file
@ -0,0 +1,15 @@
|
||||
import { expect } from 'vitest'
|
||||
import { findLongestCollatzSequence } from '../Problem014.js'
|
||||
|
||||
describe('Longest Collatz Sequence', () => {
|
||||
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)
|
||||
}
|
||||
)
|
||||
})
|
Reference in New Issue
Block a user