solution: Project Euler Problem 28 (#1198)

This commit is contained in:
ddaniel27
2022-10-16 15:24:11 -05:00
committed by GitHub
parent 2a62eabfd7
commit 829d3fd807
2 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { problem28 } from '../Problem028.js'
describe('checking number spiral diagonals', () => {
it('should be invalid input if number is negative', () => {
expect(() => problem28(-3)).toThrowError('Dimension must be positive')
})
it('should be invalid input if number is not odd', () => {
expect(() => problem28(4)).toThrowError('Dimension must be odd')
})
test('if the number is equal to 5 result should be 101', () => {
expect(problem28(5)).toBe(101)
})
// Project Euler Condition Check
test('if the number is equal to 1001 result should be 669171001', () => {
expect(problem28(1001)).toBe(669171001)
})
})