Example #1
0
    def test_iota(self):
        a = StateArray(initialstate)

        #iota should NOT affect any lane beyond 0,0
        at = iota(a, 0)
        for x, y in itertools.product(range(5), range(5)):
            if x != 0 or y != 0:
                self.assertEqual(at.lane(x, y), a.lane(x, y))

        for ir in range(24):
            at = iota(a, ir)
            truncRC = BitArray(RC[ir])
            truncRC.reverse()
            truncRC = truncRC[:a.w]
            self.assertEqual(at.lane(0, 0), a.lane(0, 0) ^ truncRC)
Example #2
0
    def test_iota(self):
        a = StateArray(initialstate)
        
        #iota should NOT affect any lane beyond 0,0
        at = iota(a,0)
        for x, y in itertools.product(range(5), range(5)):
            if x != 0 or y != 0:
                self.assertEqual(at.lane(x,y), a.lane(x,y))

        for ir in range(24):
            at = iota(a, ir)
            truncRC = BitArray(RC[ir])
            truncRC.reverse()
            truncRC = truncRC[:a.w]
            self.assertEqual(at.lane(0,0), a.lane(0,0) ^ truncRC)
Example #3
0
 def test_pi(self):
     a = StateArray(initialstate)
     at = pi(a)
     for x, y in itertools.product(range(5), range(5)):
         self.assertEqual(at.lane(x,y), a.lane((x+3*y)%5, x))
Example #4
0
 def test_pi(self):
     a = StateArray(initialstate)
     at = pi(a)
     for x, y in itertools.product(range(5), range(5)):
         self.assertEqual(at.lane(x, y), a.lane((x + 3 * y) % 5, x))