deno.land / x / masx200_leetcode_test@10.6.5 / all-ancestors-of-a-node-in-a-directed-acyclic-graph / test.ts
12345678910111213141516171819202122232425262728293031323334353637383940414243import { 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)));});
Version Info