From 26d8774e5bb354b479b887b73710382c703956fb Mon Sep 17 00:00:00 2001 From: Ankush263 Date: Sun, 3 Apr 2022 15:49:48 +0530 Subject: [PATCH] Add test case to shellSort algorithm --- Sorts/test/ShellSort.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Sorts/test/ShellSort.test.js diff --git a/Sorts/test/ShellSort.test.js b/Sorts/test/ShellSort.test.js new file mode 100644 index 0000000000..6872d523a5 --- /dev/null +++ b/Sorts/test/ShellSort.test.js @@ -0,0 +1,25 @@ +import { shellSort } from '../ShellSort' + +test('The ShellSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { + const arr = [5, 4, 3, 2, 1] + const res = shellSort(arr) + expect(res).toEqual([1, 2, 3, 4, 5]) +}) + +test('The ShellSort of the array [] is []', () => { + const arr = [] + const res = shellSort(arr) + expect(res).toEqual([]) +}) + +test('The ShellSort of the array [15, 24, 31, 42, 11] is [11, 15, 24, 31, 42]', () => { + const arr = [15, 24, 31, 42, 11] + const res = shellSort(arr) + expect(res).toEqual([11, 15, 24, 31, 42]) +}) + +test('The ShellSort of the array [121, 190, 169] is [121, 169, 190]', () => { + const arr = [121, 190, 169] + const res = shellSort(arr) + expect(res).toEqual([121, 169, 190]) +}) 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