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 ConvexHullGraham Algorithm (#938) · ex1234/JavaScript@9d2a7f1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Geometry/Test
    • ConvexHullGraham.test.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Geometry/Test/ConvexHullGraham.test.js‎

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

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.