From 1b92f501c40eded57d66946ff717e49a5362f7c3 Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 9 Nov 2023 17:06:48 -0600 Subject: add senses.js --- src/simulation/senses.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/simulation/senses.test.js (limited to 'src/simulation/senses.test.js') diff --git a/src/simulation/senses.test.js b/src/simulation/senses.test.js new file mode 100644 index 0000000..1caed52 --- /dev/null +++ b/src/simulation/senses.test.js @@ -0,0 +1,18 @@ +'use strict'; + +import { senses } from './senses.js'; + +const [ frozen, ...rest ] = senses; + + +test("frozen sense", () => { + const agent = { + id: 0, x: 0, y: 0, + flags: { frozen: true, }, + }; + const lattice = null; + + expect(frozen.read(lattice, agent)).toEqual([1]); + agent.flags.frozen = false; + expect(frozen.read(lattice, agent)).toEqual([0]); +}); -- cgit v1.2.1