FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScript/Recursive/test/BinarySearch.test.js at master · MMABSOUT/JavaScript · GitHub
MMABSOUT
/
JavaScript
Public
forked from
TheAlgorithms/JavaScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScript
/
Recursive
/
test
/
BinarySearch.test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (26 loc) · 960 Bytes
Breadcrumbs
JavaScript
/
Recursive
/
test
/
BinarySearch.test.js
Copy path
File metadata and controls
32 lines (26 loc) · 960 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
31
32
import
{
binarySearch
}
from
'../BinarySearch'
describe
(
'BinarySearch'
,
(
)
=>
{
const
arr
=
[
2
,
3
,
4
,
10
,
25
,
40
,
45
,
60
,
100
,
501
,
700
,
755
,
800
,
999
]
const
low
=
0
const
high
=
arr
.
length
-
1
it
(
'should return index 3 for searchValue 10'
,
(
)
=>
{
const
searchValue
=
10
expect
(
binarySearch
(
arr
,
searchValue
,
low
,
high
)
)
.
toBe
(
3
)
}
)
it
(
'should return index 0 for searchValue 2'
,
(
)
=>
{
const
searchValue
=
2
expect
(
binarySearch
(
arr
,
searchValue
,
low
,
high
)
)
.
toBe
(
0
)
}
)
it
(
'should return index 13 for searchValue 999'
,
(
)
=>
{
const
searchValue
=
999
expect
(
binarySearch
(
arr
,
searchValue
,
low
,
high
)
)
.
toBe
(
13
)
}
)
it
(
'should return -1 for searchValue 1'
,
(
)
=>
{
const
searchValue
=
1
expect
(
binarySearch
(
arr
,
searchValue
,
low
,
high
)
)
.
toBe
(
-
1
)
}
)
it
(
'should return -1 for searchValue 1000'
,
(
)
=>
{
const
searchValue
=
1000
expect
(
binarySearch
(
arr
,
searchValue
,
low
,
high
)
)
.
toBe
(
-
1
)
}
)
}
)
Back
|
FazBrowse Home
|
New Git URL