From 7899778b90a962f15240e15897b34420e2d8209c Mon Sep 17 00:00:00 2001 From: Ankush263 Date: Sat, 4 Jun 2022 15:05:10 +0530 Subject: [PATCH] Add test case to Find Second Largest Element Algorithm --- Sorts/test/FindSecondLargestElement.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Sorts/test/FindSecondLargestElement.test.js diff --git a/Sorts/test/FindSecondLargestElement.test.js b/Sorts/test/FindSecondLargestElement.test.js new file mode 100644 index 0000000000..6e37275b61 --- /dev/null +++ b/Sorts/test/FindSecondLargestElement.test.js @@ -0,0 +1,13 @@ +import { secondLargestElement } from '../FindSecondLargestElement' + +test('The second largest element of the array [1, 2, 3, 4, 5] is 4', () => { + const array = [1, 2, 3, 4, 5] + const res = secondLargestElement(array) + expect(res).toEqual(4) +}) + +test('The second largest element of the array [-1, -2, -3, -4, -5] is -2', () => { + const array = [-1, -2, -3, -4, -5] + const res = secondLargestElement(array) + expect(res).toEqual(-2) +}) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy