Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: add mixed number types for LocalMaximomPoint tests #1668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
taekim-dev wants to merge 6 commits into TheAlgorithms:master
base: master
Choose a base branch
Loading
from taekim-dev:improve-array-testing
Open
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
13 changes: 12 additions & 1 deletion Data-Structures/Array/test/LocalMaximomPoint.test.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ describe('LocalMaximumPoint tests', () => {
})

it('test boundary maximum points - should find first maximom point from the top', () => {
// Test a mix of number types (i.e., positive/negative, numbers with decimals, fractions)
const Array = [13, 2, 3, 4, 5, 6, 12]
expect(LocalMaximomPoint(Array)).toEqual(6)
})
Expand All @@ -26,4 +25,16 @@ describe('LocalMaximumPoint tests', () => {
const Array2 = [13, 16, 5, 41, 3, 2, 1]
expect(LocalMaximomPoint(Array2)).toEqual(3)
})

it('test inner points - repeated local maxima', () => {
const Array2 = [1, 5, 5, 5, 3, 2, 1]
const result = LocalMaximomPoint(Array2)
expect([1, 2, 3]).toContain(result)
})

it('test inner points - alternating peaks and valleys', () => {
const Array2 = [1, 3, 2, 4, 3, 5, 4]
const result = LocalMaximomPoint(Array2)
expect([1, 3, 5]).toContain(result)
})
})

AltStyle によって変換されたページ (->オリジナル) /