Skip to content

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
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
11 changes: 10 additions & 1 deletion Data-Structures/Array/test/LocalMaximomPoint.test.js
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,14 @@ describe('LocalMaximumPoint tests', () => {
const Array2 = [13, 16, 5, 41, 3, 2, 1]
expect(LocalMaximomPoint(Array2)).toEqual(3)
})

it('test with positive and negative numbers', () => {
const Array2 = [-4, -3, -2, -1, -5, 4, -1]
expect(LocalMaximomPoint(Array2)).toEqual(3)
})

it('test with floating-point numbers', () => {
const Array2 = [1.5, 3.5, 2.5, 0.5, -1.5, -3.5, -2.5]
expect(LocalMaximomPoint(Array2)).toEqual(1)
})
})
4 changes: 2 additions & 2 deletions Data-Structures/Queue/QueueUsing2Stacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Queue {
}

// display elements of the inputstack
listIn(output = (value) => console.log(value)) {
listInput(output = (value) => console.log(value)) {
let i = 0
while (i < this.inputStack.length) {
output(this.inputStack[i])
Expand All @@ -40,7 +40,7 @@ class Queue {
}

// display element of the outputstack
listOut(output = (value) => console.log(value)) {
listOutput(output = (value) => console.log(value)) {
let i = 0
while (i < this.outputStack.length) {
output(this.outputStack[i])
Expand Down
Loading