GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — merge: Add test case to FlashSort algorithm (#946) · Algorithms-Learn/JavaScript@532cf3e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Sorts/test
    • FlashSort.test.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Sorts/test/FlashSort.test.js‎

Copy file name to clipboard
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { flashSort } from '../FlashSort'
2+
3+
test('The flash sort of the array [3, 0, 2, 5, -1, 4, 1, -2] is [-2, -1, 0, 1, 2, 3, 4, 5]', () => {
4+
const array = [3, 0, 2, 5, -1, 4, 1, -2]
5+
const res = flashSort(array)
6+
expect(res).toEqual([-2, -1, 0, 1, 2, 3, 4, 5])
7+
})
8+
9+
test('The flash sort of the array [-3, 0, 2, -5, -1, 4, 1, -2] is [-5, -3, -2, -1, 0, 1, 2, 4]', () => {
10+
const array = [-3, 0, 2, -5, -1, 4, 1, -2]
11+
const res = flashSort(array)
12+
expect(res).toEqual([-5, -3, -2, -1, 0, 1, 2, 4])
13+
})
14+
15+
test('The flash sort of the array [13, 0, 12, 5, -1, 14, 1, -2] is [-2, -1, 0, 1, 5, 12, 13, 14]', () => {
16+
const array = [13, 0, 12, 5, -1, 14, 1, -2]
17+
const res = flashSort(array)
18+
expect(res).toEqual([-2, -1, 0, 1, 5, 12, 13, 14])
19+
})
20+
21+
test('The flash sort of the array [-3, 0, -2, -5, -1, -4, -1, -2] is [-5, -4, -3, -2, -2, -1, -1, 0]', () => {
22+
const array = [-3, 0, -2, -5, -1, -4, -1, -2]
23+
const res = flashSort(array)
24+
expect(res).toEqual([-5, -4, -3, -2, -2, -1, -1, 0])
25+
})

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.