sapling/tests/test-zstdelta.py
Mark Thomas ae0a81f2c2 rust: move bindings to a single python extension
Summary:
Move all Rust bindings to a single python extension, `bindings`.  This should
improve compilation time and make things simpler.

Reviewed By: quark-zju

Differential Revision: D13923866

fbshipit-source-id: 560592b5a6c0c4f1b836c755ef123666a1059164
2019-02-01 17:53:22 -08:00

25 lines
568 B
Python

from __future__ import absolute_import
import os
import unittest
import silenttestrunner
from edenscm.mercurial.rust.bindings import zstd
class testzstd(unittest.TestCase):
def testdelta(self):
base = os.urandom(100000)
data = base[:1000] + "x" + base[1000:90000] + base[90500:]
delta = zstd.diff(base, data)
# The delta is tiny
self.assertLess(len(delta), 100)
# The delta can be applied
self.assertEqual(zstd.apply(base, delta), data)
if __name__ == "__main__":
silenttestrunner.main(__name__)