diff options
author | sanine <sanine.not@pm.me> | 2023-11-10 19:51:02 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-11-10 19:51:02 -0600 |
commit | 984f07a24d3d377c13358fc5533c0eda383858f5 (patch) | |
tree | f5031a2abc9b5382c3c1f585481a82a4da7553da /src/simulation/actions.test.js | |
parent | 57172b8c3c851497b55b5d4c90ddb0cb5f9b202c (diff) |
refactor: actions take an additional world parameter
Diffstat (limited to 'src/simulation/actions.test.js')
-rw-r--r-- | src/simulation/actions.test.js | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/simulation/actions.test.js b/src/simulation/actions.test.js index d039f8a..04111f1 100644 --- a/src/simulation/actions.test.js +++ b/src/simulation/actions.test.js @@ -16,23 +16,23 @@ test("move forward", () => { const e = { id: 0, x: 0, y: 0, flags: { orientation: 'e' } }; const w = { id: 0, x: 0, y: 0, flags: { orientation: 'w' } }; - expect(move_forward.propose(n, [1])).toEqual([ + expect(move_forward.propose(null, n, [1])).toEqual([ { agent_changes: [{ agent_id: 0, x: 0, y: -1 }] }, ]); - expect(move_forward.propose(s, [1])).toEqual([ + expect(move_forward.propose(null, s, [1])).toEqual([ { agent_changes: [{ agent_id: 0, x: 0, y: 1 }] }, ]); - expect(move_forward.propose(e, [1])).toEqual([ + expect(move_forward.propose(null, e, [1])).toEqual([ { agent_changes: [{ agent_id: 0, x: 1, y: 0 }] }, ]); - expect(move_forward.propose(w, [1])).toEqual([ + expect(move_forward.propose(null, w, [1])).toEqual([ { agent_changes: [{ agent_id: 0, x: -1, y: 0 }] }, ]); - expect(move_forward.propose(n, [0])).toEqual([]); - expect(move_forward.propose(s, [-1])).toEqual([]); - expect(move_forward.propose(e, [0])).toEqual([]); - expect(move_forward.propose(w, [-1])).toEqual([]); + expect(move_forward.propose(null, n, [0])).toEqual([]); + expect(move_forward.propose(null, s, [-1])).toEqual([]); + expect(move_forward.propose(null, e, [0])).toEqual([]); + expect(move_forward.propose(null, w, [-1])).toEqual([]); }); @@ -42,23 +42,23 @@ test("move backward", () => { const e = { id: 0, x: 0, y: 0, flags: { orientation: 'e' } }; const w = { id: 0, x: 0, y: 0, flags: { orientation: 'w' } }; - expect(move_backward.propose(n, [1])).toEqual([ + expect(move_backward.propose(null, n, [1])).toEqual([ { agent_changes: [{ agent_id: 0, x: 0, y: 1 }] }, ]); - expect(move_backward.propose(s, [1])).toEqual([ + expect(move_backward.propose(null, s, [1])).toEqual([ { agent_changes: [{ agent_id: 0, x: 0, y: -1 }] }, ]); - expect(move_backward.propose(e, [1])).toEqual([ + expect(move_backward.propose(null, e, [1])).toEqual([ { agent_changes: [{ agent_id: 0, x: -1, y: 0 }] }, ]); - expect(move_backward.propose(w, [1])).toEqual([ + expect(move_backward.propose(null, w, [1])).toEqual([ { agent_changes: [{ agent_id: 0, x: 1, y: 0 }] }, ]); - expect(move_backward.propose(n, [0])).toEqual([]); - expect(move_backward.propose(s, [-1])).toEqual([]); - expect(move_backward.propose(e, [0])).toEqual([]); - expect(move_backward.propose(w, [-1])).toEqual([]); + expect(move_backward.propose(null, n, [0])).toEqual([]); + expect(move_backward.propose(null, s, [-1])).toEqual([]); + expect(move_backward.propose(null, e, [0])).toEqual([]); + expect(move_backward.propose(null, w, [-1])).toEqual([]); }); @@ -68,23 +68,23 @@ test("turn_left", () => { const e = { id: 0, x: 0, y: 0, flags: { orientation: 'e' } }; const w = { id: 0, x: 0, y: 0, flags: { orientation: 'w' } }; - expect(turn_left.propose(n, [1])).toEqual([ + expect(turn_left.propose(null, n, [1])).toEqual([ { agent_changes: [{ agent_id: 0, flags: { orientation: 'w' } }] }, ]); - expect(turn_left.propose(s, [1])).toEqual([ + expect(turn_left.propose(null, s, [1])).toEqual([ { agent_changes: [{ agent_id: 0, flags: { orientation: 'e' } }] }, ]); - expect(turn_left.propose(e, [1])).toEqual([ + expect(turn_left.propose(null, e, [1])).toEqual([ { agent_changes: [{ agent_id: 0, flags: { orientation: 'n' } }] }, ]); - expect(turn_left.propose(w, [1])).toEqual([ + expect(turn_left.propose(null, w, [1])).toEqual([ { agent_changes: [{ agent_id: 0, flags: { orientation: 's' } }] }, ]); - expect(turn_left.propose(n, [0])).toEqual([]); - expect(turn_left.propose(s, [-1])).toEqual([]); - expect(turn_left.propose(e, [0])).toEqual([]); - expect(turn_left.propose(w, [-1])).toEqual([]); + expect(turn_left.propose(null, n, [0])).toEqual([]); + expect(turn_left.propose(null, s, [-1])).toEqual([]); + expect(turn_left.propose(null, e, [0])).toEqual([]); + expect(turn_left.propose(null, w, [-1])).toEqual([]); }); @@ -94,23 +94,23 @@ test("turn_right", () => { const e = { id: 0, x: 0, y: 0, flags: { orientation: 'e' } }; const w = { id: 0, x: 0, y: 0, flags: { orientation: 'w' } }; - expect(turn_right.propose(n, [1])).toEqual([ + expect(turn_right.propose(null, n, [1])).toEqual([ { agent_changes: [{ agent_id: 0, flags: { orientation: 'e' } }] }, ]); - expect(turn_right.propose(s, [1])).toEqual([ + expect(turn_right.propose(null, s, [1])).toEqual([ { agent_changes: [{ agent_id: 0, flags: { orientation: 'w' } }] }, ]); - expect(turn_right.propose(e, [1])).toEqual([ + expect(turn_right.propose(null, e, [1])).toEqual([ { agent_changes: [{ agent_id: 0, flags: { orientation: 's' } }] }, ]); - expect(turn_right.propose(w, [1])).toEqual([ + expect(turn_right.propose(null, w, [1])).toEqual([ { agent_changes: [{ agent_id: 0, flags: { orientation: 'n' } }] }, ]); - expect(turn_right.propose(n, [0])).toEqual([]); - expect(turn_right.propose(s, [-1])).toEqual([]); - expect(turn_right.propose(e, [0])).toEqual([]); - expect(turn_right.propose(w, [-1])).toEqual([]); + expect(turn_right.propose(null, n, [0])).toEqual([]); + expect(turn_right.propose(null, s, [-1])).toEqual([]); + expect(turn_right.propose(null, e, [0])).toEqual([]); + expect(turn_right.propose(null, w, [-1])).toEqual([]); }); |