feat: quick update to limgachine.
This commit is contained in:
parent
60d75e1996
commit
29ba2cd3ab
11 changed files with 28 additions and 15 deletions
|
|
@ -3,14 +3,23 @@ import MyMap from "@code/Map";
|
|||
test("Map", function() {
|
||||
const map = new MyMap<string, number>();
|
||||
map.set("foo", 55);
|
||||
expect(map.size()).toEqual(1);
|
||||
map.set("fool", 75);
|
||||
expect(map.size()).toEqual(2);
|
||||
map.set("foolish", 105);
|
||||
expect(map.size()).toEqual(3);
|
||||
map.set("bar", 69);
|
||||
expect(map.size()).toEqual(4);
|
||||
|
||||
console.log(map.size());
|
||||
|
||||
expect(map.get("bar")).toEqual(69);
|
||||
expect(map.get("blaz")).toEqual(undefined);
|
||||
|
||||
map.delete("bar")
|
||||
expect(map.size()).toEqual(3);
|
||||
map.delete("barblabr")
|
||||
expect(map.size()).toEqual(2);
|
||||
expect(map.get("bar")).toEqual(undefined);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ test("maze solver", function () {
|
|||
];
|
||||
|
||||
// there is only one path through
|
||||
expect(maze_solver(maze, "x", " ", {x: 10, y: 0}, {x: 1, y: 5})).toEqual([
|
||||
expect(maze_solver(maze, "x", {x: 10, y: 0}, {x: 1, y: 5})).toEqual([
|
||||
{x: 10, y: 0},
|
||||
{x: 10, y: 1},
|
||||
{x: 10, y: 2},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ test("queue", function () {
|
|||
list.enqueue(7);
|
||||
list.enqueue(9);
|
||||
|
||||
expect(list.dequeue()).toEqual(5);
|
||||
expect(list.deque()).toEqual(5);
|
||||
expect(list.length).toEqual(2);
|
||||
|
||||
// this must be wrong..?
|
||||
|
|
@ -16,11 +16,11 @@ test("queue", function () {
|
|||
// i hate using debuggers
|
||||
list.enqueue(11);
|
||||
debugger;
|
||||
expect(list.dequeue()).toEqual(7);
|
||||
expect(list.dequeue()).toEqual(9);
|
||||
expect(list.deque()).toEqual(7);
|
||||
expect(list.deque()).toEqual(9);
|
||||
expect(list.peek()).toEqual(11);
|
||||
expect(list.dequeue()).toEqual(11);
|
||||
expect(list.dequeue()).toEqual(undefined);
|
||||
expect(list.deque()).toEqual(11);
|
||||
expect(list.deque()).toEqual(undefined);
|
||||
expect(list.length).toEqual(0);
|
||||
|
||||
// just wanted to make sure that I could not blow up myself when i remove
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ test("Trie", function() {
|
|||
"foolish",
|
||||
]);
|
||||
|
||||
trie.remove("fool");
|
||||
trie.delete("fool");
|
||||
|
||||
expect(trie.find("fo").sort()).toEqual([
|
||||
"foo",
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@ test("two crystal balls", function () {
|
|||
}
|
||||
|
||||
expect(two_crystal_balls(data)).toEqual(idx);
|
||||
expect(two_crystal_balls(new Array(821).fill(false))).toEqual(-1);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue