コード例 #1
0
 def test1_delete_fixed_long(self):
     y = sec.QaryString(q=2, val=[0, 1] * 1000)
     symbol = 0
     pos = 4
     yp = y._delete(pos, idx_of_pos=0)
     code = sec.SVTCode()
     y_pred = code.decode_deletion(yp,
                                   y.syndrome,
                                   pos + 1,
                                   3,
                                   symbol,
                                   verbose=False)
     self.assertEqual(y_pred, y)
コード例 #2
0
 def test1_delete_random_short(self):
     for i in range(1000):
         y = sec.QaryString(2, np.random.randint(0, 2, 10))
         code = sec.SVTCode()
         yp, _, pos, symbol = y.mutate(mtype="delete")
         u = np.random.randint(low=1, high=pos + 2)
         y_pred = code.decode_deletion(yp,
                                       y.syndrome,
                                       u,
                                       10,
                                       symbol,
                                       verbose=False)
         self.assertTrue(y_pred == y)
コード例 #3
0
 def test1_insert_fixed_short(self):
     y = sec.QaryString(q=2, val=[0, 1, 0, 1, 0, 1, 0, 1])
     symbol = 0
     pos = 4
     yp = y._insert(pos, symbol, idx_of_pos=0)
     code = sec.SVTCode()
     y_pred = code.decode_insertion(yp,
                                    y.syndrome,
                                    pos + 1,
                                    3,
                                    symbol,
                                    verbose=False)
     self.assertEqual(y_pred, y)