deno.land / x / masx200_leetcode_test@10.6.5 / all-ancestors-of-a-node-in-a-directed-acyclic-graph / test.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { assertEquals } from "https://deno.land/std@0.157.0/testing/asserts.ts";
import getAncestors from "./index.ts";
Deno.test("all-ancestors-of-a-node-in-a-directed-acyclic-graph", () => { const outputs = [ [[], [], [], [0, 1], [0, 2], [0, 1, 3], [0, 1, 2, 3, 4], [0, 1, 2, 3]], [[], [0], [0, 1], [0, 1, 2], [0, 1, 2, 3]], ]; const inputs = [ [ 8, [ [0, 3], [0, 4], [1, 3], [2, 4], [2, 7], [3, 5], [3, 6], [3, 7], [4, 6], ], ], [ 5, [ [0, 1], [0, 2], [0, 3], [0, 4], [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4], ], ], ] as Array<Parameters<typeof getAncestors>>; assertEquals(outputs, inputs.map(([n, edges]) => getAncestors(n, edges)));});
masx200_leetcode_test

Version Info

Tagged at
a year ago