|
| 1 | +import { NumberOfLocalMaximumPoints } from '../NumberOfLocalMaximumPoints' |
| 2 | + |
| 3 | +describe('LocalMaximomPoint tests', () => { |
| 4 | + it('test boundry maximom points - last element', () => { |
| 5 | + const Array = [1, 2, 3, 4, 5, 6, 12] |
| 6 | + expect(NumberOfLocalMaximumPoints(Array)).toEqual(1) |
| 7 | + }) |
| 8 | + |
| 9 | + it('test boundry maximom points - first element', () => { |
| 10 | + const Array = [13, 6, 5, 4, 3, 2, 1] |
| 11 | + expect(NumberOfLocalMaximumPoints(Array)).toEqual(1) |
| 12 | + }) |
| 13 | + |
| 14 | + it('test boundry maximom points - both boundries have maximum points', () => { |
| 15 | + // Test a mix of number types (i.e., positive/negative, numbers with decimals, fractions) |
| 16 | + const Array = [13, 2, 3, 4, 5, 6, 12] |
| 17 | + expect(NumberOfLocalMaximumPoints(Array)).toEqual(2) |
| 18 | + }) |
| 19 | + |
| 20 | + it('multiple maximom points in the middle', () => { |
| 21 | + // Test a mix of number types (i.e., positive/negative, numbers with decimals, fractions) |
| 22 | + const Array = [1, 3, 2, 5, 6, 9, 2, 7, 12, 1, 0] |
| 23 | + expect(NumberOfLocalMaximumPoints(Array)).toEqual(3) |
| 24 | + }) |
| 25 | + |
| 26 | + it('multiple maximom points in the middle with one at end', () => { |
| 27 | + // Test a mix of number types (i.e., positive/negative, numbers with decimals, fractions) |
| 28 | + const Array = [1, 3, 2, 5, 6, 9, 2, 7, 12, 1, 10] |
| 29 | + expect(NumberOfLocalMaximumPoints(Array)).toEqual(4) |
| 30 | + }) |
| 31 | + |
| 32 | + it('multiple maximom points in the middle with one at start', () => { |
| 33 | + // Test a mix of number types (i.e., positive/negative, numbers with decimals, fractions) |
| 34 | + const Array = [10, 3, 2, 5, 6, 9, 2, 7, 12, 1, 0] |
| 35 | + expect(NumberOfLocalMaximumPoints(Array)).toEqual(3) |
| 36 | + }) |
| 37 | + |
| 38 | + it('multiple maximom points in the middle with two more at both ends', () => { |
| 39 | + // Test a mix of number types (i.e., positive/negative, numbers with decimals, fractions) |
| 40 | + const Array = [10, 3, 11, 5, 6, 9, 2, 7, 12, 1, 10] |
| 41 | + expect(NumberOfLocalMaximumPoints(Array)).toEqual(5) |
| 42 | + }) |
| 43 | +}) |
0 commit comments