Beispiel #1
0
 def test_common_prefix(self):
     fakelog = FakeLog()
     compressor = jl.PrefixCompressor(1)
     # nothing to compress yet!
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','hello')])
     assert result == b"\xff\x05\x00\x00\x00hello"
     assert fakelog.values == []
     #
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','hello')])
     assert result == b"\xef"
     assert fakelog.values == [(jl.MARK_COMMON_PREFIX) + "\x00\x05\x00\x00\x00hello"]
     #
     fakelog.values = []
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','heiter')])
     assert result == b"\x00\x04\x00\x00\x00iter"
     assert fakelog.values == [(jl.MARK_COMMON_PREFIX) + "\x00\x02\x00\x00\x00he"]
     #
     fakelog.values = []
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','heute')])
     assert result == b"\x00\x03\x00\x00\x00ute"
     assert fakelog.values == []
     #
     fakelog.values = []
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','welt')])
     assert result == b"\xff\x04\x00\x00\x00welt"
     assert fakelog.values == []
     #
     fakelog.values = []
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','welle')])
     assert result == b"\x00\x02\x00\x00\x00le"
     assert fakelog.values == [(jl.MARK_COMMON_PREFIX) + "\x00\x03\x00\x00\x00wel"]
Beispiel #2
0
 def test_common_prefix(self):
     fakelog = FakeLog()
     compressor = jl.PrefixCompressor(1)
     # nothing to compress yet!
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','hello')])
     assert result == b"\xff\x05\x00\x00\x00hello"
     assert fakelog.values == []
     #
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','hello')])
     assert result == b"\xef"
     assert fakelog.values == [(jl.MARK_COMMON_PREFIX) + "\x00\x05\x00\x00\x00hello"]
     #
     fakelog.values = []
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','heiter')])
     assert result == b"\x00\x04\x00\x00\x00iter"
     assert fakelog.values == [(jl.MARK_COMMON_PREFIX) + "\x00\x02\x00\x00\x00he"]
     #
     fakelog.values = []
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','heute')])
     assert result == b"\x00\x03\x00\x00\x00ute"
     assert fakelog.values == []
     #
     fakelog.values = []
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','welt')])
     assert result == b"\xff\x04\x00\x00\x00welt"
     assert fakelog.values == []
     #
     fakelog.values = []
     result = jl.encode_merge_point(fakelog, compressor, [jl.StringValue(0x0,'s','welle')])
     assert result == b"\x00\x02\x00\x00\x00le"
     assert fakelog.values == [(jl.MARK_COMMON_PREFIX) + "\x00\x03\x00\x00\x00wel"]