コード例 #1
0
ファイル: codectest.py プロジェクト: nhomble/hiccup
 def test_accidental_combine(self):
     rle = [
         codec.RunLength(value=0, length=14),
         codec.RunLength(value=31, length=0)
     ]
     invert = codec.decode_run_length(rle, 15)
     rle_2 = codec.run_length_coding(invert, max_len=0xF)
     self.assertEqual(rle, rle_2)
コード例 #2
0
ファイル: codectest.py プロジェクト: nhomble/hiccup
 def test_rle_max_double(self):
     arr = [-1, 0, 0, 0, 0, 1, 2]
     rle = codec.run_length_coding(np.array(arr), max_len=4)
     invert = codec.decode_run_length(rle, len(arr))
     self.assertEqual(arr, invert)
コード例 #3
0
ファイル: codectest.py プロジェクト: nhomble/hiccup
 def test_rle_break_plus_1(self):
     arr = [0, 0, 0, 0, 0, 1]
     rle = codec.run_length_coding(np.array(arr), max_len=4)
     invert = codec.decode_run_length(rle, len(arr))
     self.assertEqual(invert, arr)
コード例 #4
0
ファイル: codectest.py プロジェクト: nhomble/hiccup
 def test_rle_random(self):
     arr = [np.random.randint(-5, 5) for _ in range(10000)]
     rle = codec.run_length_coding(np.array(arr))
     invert = codec.decode_run_length(rle, 10000)
     self.assertEqual(invert, arr)
コード例 #5
0
ファイル: codectest.py プロジェクト: nhomble/hiccup
 def test_rle_consecutives(self):
     arr = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0]
     rle = codec.run_length_coding(np.array(arr))
     invert = codec.decode_run_length(rle, len(arr))
     self.assertEqual(invert, arr)
コード例 #6
0
ファイル: codectest.py プロジェクト: nhomble/hiccup
 def test_rle_max_len(self):
     arr = [0, 0, 0, 0, 0, 1]
     rle = codec.run_length_coding(np.array(arr))
     invert = codec.decode_run_length(rle, len(arr))
     self.assertEqual(arr, invert)
コード例 #7
0
ファイル: codectest.py プロジェクト: nhomble/hiccup
 def test_zero_block_reconstruct(self):
     matrix = np.array([[0, 0, 11, 0], [0, 0, 0, 0]])
     lin = transform.zigzag(matrix)
     out = codec.run_length_coding(lin)
     invert = codec.decode_run_length(out, 8)
     self.assertEqual(lin, invert)