From f9fc4d26ec5fca9ee175c8a6fbcdd0fa36f10947 Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 16 Nov 2023 14:50:00 -0600 Subject: clear out js files --- src/simulation/game.test.js | 59 --------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/simulation/game.test.js (limited to 'src/simulation/game.test.js') diff --git a/src/simulation/game.test.js b/src/simulation/game.test.js deleted file mode 100644 index 219dce6..0000000 --- a/src/simulation/game.test.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; - -import { apply } from '../util.js'; -import { setup_board, create_world } from './game.js'; - - -test("set up boards correctly", () => { - const _ = { type: 'empty', flags: {} }; - const a = { type: 'empty', flags: { team: 0 } }; - const b = { type: 'empty', flags: { team: 1 } }; - const c = { type: 'empty', flags: { team: 2 } }; - const d = { type: 'empty', flags: { team: 3 } }; - const W = { type: 'immutable', flags: {} }; - - expect(setup_board(6)).toEqual([ - [ W, W, W, W, W, W, ], - [ W, W, a, a, W, W, ], - [ W, d, _, _, b, W, ], - [ W, d, _, _, b, W, ], - [ W, W, c, c, W, W, ], - [ W, W, W, W, W, W, ], - ]); - expect(setup_board(9)).toEqual([ - [ W, W, W, W, W, W, W, W, W, ], - [ W, W, W, a, a, a, W, W, W, ], - [ W, W, W, a, a, a, W, W, W, ], - [ W, d, d, _, _, _, b, b, W, ], - [ W, d, d, _, _, _, b, b, W, ], - [ W, d, d, _, _, _, b, b, W, ], - [ W, W, W, c, c, c, W, W, W, ], - [ W, W, W, c, c, c, W, W, W, ], - [ W, W, W, W, W, W, W, W, W, ], - ]); -}); - - -test("creating a world works correctly", () => { - const id = 0; - const agent = (id) => ({ id, net: `${id}`, state: `s${id}` }); - const team1 = [agent(0), agent(1)]; - const team2 = [agent(2), agent(3)]; - const team3 = [agent(4), agent(5)]; - const team4 = [agent(6), agent(7)]; - - const world = create_world(6, [team1, team2, team3, team4]); - const agent_cell = (agent) => { - const { x, y } = agent; - return world.lattice[y][x]; - }; - - expect(agent_cell(world.agents[0])).toEqual({ type: 'empty', flags: { team: 0 } }); - expect(agent_cell(world.agents[1])).toEqual({ type: 'empty', flags: { team: 0 } }); - expect(agent_cell(world.agents[2])).toEqual({ type: 'empty', flags: { team: 1 } }); - expect(agent_cell(world.agents[3])).toEqual({ type: 'empty', flags: { team: 1 } }); - expect(agent_cell(world.agents[4])).toEqual({ type: 'empty', flags: { team: 2 } }); - expect(agent_cell(world.agents[5])).toEqual({ type: 'empty', flags: { team: 2 } }); - expect(agent_cell(world.agents[6])).toEqual({ type: 'empty', flags: { team: 3 } }); - expect(agent_cell(world.agents[7])).toEqual({ type: 'empty', flags: { team: 3 } }); -}); -- cgit v1.2.1