forked from TheAlgorithms/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFermatsLastTheoremTest.test.js
More file actions
30 lines (25 loc) · 1.01 KB
/
FermatsLastTheoremTest.test.js
File metadata and controls
30 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import checkFermatLastTheorem from '../FermatsLastTheoremTest.js'
describe("Fermat's Last Theorem Checker (BigInt version)", () => {
test('throws an error if exponent is less than 3', () => {
expect(() => checkFermatLastTheorem(10, 2)).toThrow(
"Fermat's Last Theorem only applies for n >= 3"
)
expect(() => checkFermatLastTheorem(10, 1)).toThrow()
})
test('small range test: returns empty array for n = 3, max 20', () => {
const results = checkFermatLastTheorem(20, 3)
expect(results).toEqual([])
})
test('moderate range test: returns empty array for n = 3, max 1000', () => {
const results = checkFermatLastTheorem(1000, 3)
expect(results).toEqual([])
})
test('small range test: returns empty array for n = 4, max 20', () => {
const results = checkFermatLastTheorem(20, 4)
expect(results).toEqual([])
})
test('moderate range test: returns empty array for n = 4, max 500', () => {
const results = checkFermatLastTheorem(500, 4)
expect(results).toEqual([])
})
})