|
| 1 | +import { Input, Output, numberOfBoomerangs } from "../number-of-boomerangs"; |
| 2 | + |
| 3 | +type Cases = [Input, Output][]; |
| 4 | + |
| 5 | +describe("Number Of Boomerangs", () => { |
| 6 | + const cases: Cases = [ |
| 7 | + [[9, 5, 9, 5, 1, 1, 1], 2], |
| 8 | + [[5, 6, 6, 7, 6, 3, 9], 1], |
| 9 | + [[4, 4, 4, 9, 9, 9, 9], 0], |
| 10 | + [[5, 9, 5, 9, 5], 3], |
| 11 | + [[4, 4, 4, 8, 4, 8, 4], 3], |
| 12 | + [[2, 2, 2, 2, 2, 2, 3], 0], |
| 13 | + [[2, 2, 2, 2, 3, 2, 3], 2], |
| 14 | + [[1, 2, 1, 1, 1, 2, 1], 2], |
| 15 | + [[5, 1, 1, 1, 1, 4, 1], 1], |
| 16 | + [[3, 7, 3, 2, 1, 5, 1, 2, 2, -2, 2], 3], |
| 17 | + [[1, 7, 1, 7, 1, 7, 1], 5], |
| 18 | + [[5, 5, 5], 0], |
| 19 | + ]; |
| 20 | + |
| 21 | + test.each(cases)( |
| 22 | + "for inputArray = %j output should be %d", |
| 23 | + (firstArg, expectedResult) => { |
| 24 | + const result = numberOfBoomerangs(firstArg); |
| 25 | + expect(result).toEqual(expectedResult); |
| 26 | + } |
| 27 | + ); |
| 28 | +}); |
0 commit comments