Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
* [BinaryExponentiationRecursive](Maths/BinaryExponentiationRecursive.js)
* [BisectionMethod](Maths/BisectionMethod.js)
* [CheckKishnamurthyNumber](Maths/CheckKishnamurthyNumber.js)
* [CollatzSequence](Maths/CollatzSequence.js)
* [Coordinate](Maths/Coordinate.js)
* [CoPrimeCheck](Maths/CoPrimeCheck.js)
* [DecimalExpansion](Maths/DecimalExpansion.js)
Expand All @@ -159,13 +160,15 @@
* [FigurateNumber](Maths/FigurateNumber.js)
* [FindHcf](Maths/FindHcf.js)
* [FindLcm](Maths/FindLcm.js)
* [FindMaxRecursion](Maths/FindMaxRecursion.js)
* [FindMin](Maths/FindMin.js)
* [FindMinIterator](Maths/FindMinIterator.js)
* [GetEuclidGCD](Maths/GetEuclidGCD.js)
* [GridGet](Maths/GridGet.js)
* [IsDivisible](Maths/IsDivisible.js)
* [IsEven](Maths/IsEven.js)
* [IsOdd](Maths/IsOdd.js)
* [IsPronic](Maths/IsPronic.js)
* [LeapYear](Maths/LeapYear.js)
* [LinearSieve](Maths/LinearSieve.js)
* [LucasSeries](Maths/LucasSeries.js)
Expand Down Expand Up @@ -197,6 +200,7 @@
* [SquareRoot](Maths/SquareRoot.js)
* [SumOfDigits](Maths/SumOfDigits.js)
* [SumOfGeometricProgression](Maths/SumOfGeometricProgression.js)
* [TwinPrime](Maths/TwinPrime.js)
* [Volume](Maths/Volume.js)
* [WhileLoopFactorial](Maths/WhileLoopFactorial.js)
* [ZellersCongruenceAlgorithm](Maths/ZellersCongruenceAlgorithm.js)
Expand Down
22 changes: 22 additions & 0 deletions Search/test/FibonacciSearch.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { fibonacciSearch } from '../FibonacciSearch'

test('fibonacciSearch([10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100], 90, arr.length) => 9', () => {
const arr = [10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100]
const target = 90
const res = fibonacciSearch(arr, target, arr.length)
expect(res).toEqual(9)
})

test('fibonacciSearch([1, 11, 55, 56, 78, 82, 104], 104, arr.length) => 6', () => {
const arr = [1, 11, 55, 56, 78, 82, 104]
const target = 104
const res = fibonacciSearch(arr, target, arr.length)
expect(res).toEqual(6)
})

test('fibonacciSearch([40, 45, 50, 80, 82, 85, 90, 100]. 190, arr.length) => -1', () => {
const arr = [40, 45, 50, 80, 82, 85, 90, 100]
const target = 190
const res = fibonacciSearch(arr, target, arr.length)
expect(res).toEqual(-1)
})