merge: Added Sum of GP (#807)

This commit is contained in:
Dumby
2021-10-23 23:14:01 +05:30
committed by GitHub
parent e83b570d44
commit cd3974c457
2 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { sumOfGeometricProgression } from '../SumOfGeometricProgression'
describe('Sum Of Geometric Progression', () => {
it('should return the sum of a finite GP', () => {
expect(sumOfGeometricProgression(100, 1.5, 4)).toBe(812.5)
})
it('should return the sum of an infinite GP', () => {
expect(sumOfGeometricProgression(2, 0.5, Infinity)).toBe(4)
})
})