def test_reca_pin(self): """ Test the pin argument """ reca = RewiredECA(30, wiring=[ [-1, 4, 1, 2, -1], [0, 1, 2, 3, 4], [0, 2, 3, 4, 5] ]) xs = [0, 0, 1, 0, 0] self.assertEqual([0, 0, 1, 1, 0], reca.update(xs, pin=[1])) self.assertEqual([0, 1, 1, 1, 0], reca.update(xs, pin=[3])) self.assertEqual([0, 1, 1, 1, 0], reca.update(xs, pin=[3, 2])) self.assertEqual([0, 1, 0, 1, 0], reca.update(xs, pin=[-2])) reca.boundary = (1, 1) xs = [0, 0, 1, 0, 0] self.assertEqual([1, 0, 1, 0, 0], reca.update(xs, pin=[1, 3])) self.assertEqual([1, 1, 1, 0, 0], reca.update(xs, pin=[-2, -5])) self.assertEqual([1, 1, 1, 1, 0], reca.update(xs, pin=[0, 2]))
def test_reca_values(self): """ Test the values argument """ reca = RewiredECA(30, wiring=[ [-1, 4, 1, 2, -1], [0, 1, 2, 3, 4], [0, 2, 3, 4, 5] ]) xs = [0, 0, 1, 0, 0] self.assertEqual([1, 1, 1, 1, 0], reca.update(xs, values={0: 1})) self.assertEqual([1, 1, 0, 0, 0], reca.update(xs, values={-1: 0})) self.assertEqual([1, 1, 1, 1, 1], reca.update(xs, values={-2: 1})) self.assertEqual([1, 0, 1, 0, 0], reca.update( xs, values={2: 1, -5: 1})) reca.boundary = (1, 1) xs = [0, 0, 1, 0, 0] self.assertEqual([0, 1, 1, 1, 0], reca.update(xs, values={0: 0})) self.assertEqual([1, 1, 0, 0, 1], reca.update(xs, values={-1: 1})) self.assertEqual([0, 0, 1, 0, 0], reca.update(xs, values={-2: 0})) self.assertEqual([0, 1, 0, 1, 0], reca.update( xs, values={2: 0, -5: 0}))