mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
merge: Added Sum of GP (#807)
This commit is contained in:
11
Maths/test/SumOfGeometricProgression.test.js
Normal file
11
Maths/test/SumOfGeometricProgression.test.js
Normal 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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user