示例#1
0
 def test_decode_encode_uniform(self):
     for width in range(1, 5):
         for base in range(1, 5):
             space = StateSpace(width, base)
             for i in range(base**width):
                 decoded = space.decode(i)
                 encoded = space.encode(decoded)
                 self.assertEqual(i, encoded)
示例#2
0
 def test_encode_decode_uniform(self):
     for width in range(1, 5):
         for base in range(1, 5):
             space = StateSpace(width, base)
             for state in space:
                 encoded = space.encode(state)
                 decoded = space.decode(encoded)
                 self.assertEqual(state, decoded)
示例#3
0
 def test_decode_encode_nonuniform(self):
     for a in range(1, 5):
         for b in range(1, 5):
             for c in range(1, 5):
                 space = StateSpace([a, b, c])
                 for i in range(a * b * c):
                     decoded = space.decode(i)
                     encoded = space.encode(decoded)
                     self.assertEqual(i, encoded)
示例#4
0
 def test_encode_decode_nonuniform(self):
     for a in range(1, 5):
         for b in range(1, 5):
             for c in range(1, 5):
                 space = StateSpace([a, b, c])
                 for state in space:
                     encoded = space.encode(state)
                     decoded = space.decode(encoded)
                     self.assertEqual(state, decoded)