feat: small fixes
This commit is contained in:
parent
b35341ac1a
commit
60d75e1996
3 changed files with 3 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import dfs from "@code/BTDFS";
|
import dfs from "@code/DFSOnBST";
|
||||||
import { tree } from "./tree";
|
import { tree } from "./tree";
|
||||||
|
|
||||||
test("bt dfs", function () {
|
test("DFS on BST", function () {
|
||||||
expect(dfs(tree, 45)).toEqual(true);
|
expect(dfs(tree, 45)).toEqual(true);
|
||||||
expect(dfs(tree, 7)).toEqual(true);
|
expect(dfs(tree, 7)).toEqual(true);
|
||||||
expect(dfs(tree, 69)).toEqual(false);
|
expect(dfs(tree, 69)).toEqual(false);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ import LinkedList from "@code/DoublyLinkedList";
|
||||||
import { test_list } from "./ListTest";
|
import { test_list } from "./ListTest";
|
||||||
|
|
||||||
test("DoublyLinkedList", function () {
|
test("DoublyLinkedList", function () {
|
||||||
const list = new LinkedList<number>(3);
|
const list = new LinkedList<number>();
|
||||||
test_list(list);
|
test_list(list);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,11 @@ export function test_list(list: List<number>): void {
|
||||||
list.append(7);
|
list.append(7);
|
||||||
list.append(9);
|
list.append(9);
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
console.log(list.data);
|
|
||||||
|
|
||||||
expect(list.get(2)).toEqual(9);
|
expect(list.get(2)).toEqual(9);
|
||||||
expect(list.removeAt(1)).toEqual(7);
|
expect(list.removeAt(1)).toEqual(7);
|
||||||
// @ts-ignore
|
|
||||||
console.log(list.data);
|
|
||||||
expect(list.length).toEqual(2);
|
expect(list.length).toEqual(2);
|
||||||
|
|
||||||
list.append(11);
|
list.append(11);
|
||||||
// @ts-ignore
|
|
||||||
console.log(list.data);
|
|
||||||
expect(list.removeAt(1)).toEqual(9);
|
expect(list.removeAt(1)).toEqual(9);
|
||||||
expect(list.remove(9)).toEqual(undefined);
|
expect(list.remove(9)).toEqual(undefined);
|
||||||
expect(list.removeAt(0)).toEqual(5);
|
expect(list.removeAt(0)).toEqual(5);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue