pyfastcdc 0.2.1__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyfastcdc-0.2.1/pyfastcdc.egg-info → pyfastcdc-0.3.0}/PKG-INFO +1 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/__init__.py +1 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/cy/fastcdc.pyx +1 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/py/fastcdc.py +1 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/utils.py +10 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0/pyfastcdc.egg-info}/PKG-INFO +1 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc.egg-info/SOURCES.txt +2 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/tests/test_arguments.py +1 -1
- pyfastcdc-0.3.0/tests/test_correctness.py +679 -0
- pyfastcdc-0.3.0/tests/test_utils.py +61 -0
- pyfastcdc-0.2.1/tests/test_correctness.py +0 -454
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/LICENSE +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/MANIFEST.in +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/README.md +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/__init__.pyi +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/common.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/cy/__init__.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/cy/chunk.pxd +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/cy/chunk.pyx +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/cy/constants.pxd +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/cy/constants.pyx +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/py/__init__.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/py/chunk.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/py/constants.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc/py.typed +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc.egg-info/dependency_links.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc.egg-info/requires.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyfastcdc.egg-info/top_level.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/pyproject.toml +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/requirements.dev.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/requirements.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/setup.cfg +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.0}/setup.py +0 -0
|
@@ -66,7 +66,7 @@ cdef class FastCDC:
|
|
|
66
66
|
self.config.min_size = min_size
|
|
67
67
|
self.config.max_size = max_size
|
|
68
68
|
|
|
69
|
-
bits =
|
|
69
|
+
bits = utils.logarithm2(avg_size)
|
|
70
70
|
self.config.mask_s = MASKS[bits + normalized_chunking]
|
|
71
71
|
self.config.mask_l = MASKS[bits - normalized_chunking]
|
|
72
72
|
self.config.mask_s_ls = self.config.mask_s << 1
|
|
@@ -81,7 +81,7 @@ class FastCDC:
|
|
|
81
81
|
if not (0 <= normalized_chunking <= 3):
|
|
82
82
|
raise ValueError(f'normalized_chunking {normalized_chunking} is out of range [0, 3]')
|
|
83
83
|
|
|
84
|
-
bits =
|
|
84
|
+
bits = utils.logarithm2(avg_size)
|
|
85
85
|
mask_s = MASKS[bits + normalized_chunking]
|
|
86
86
|
mask_l = MASKS[bits - normalized_chunking]
|
|
87
87
|
mask_s_ls = (mask_s << 1) & _UINT64_MASK
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import math
|
|
1
2
|
import mmap
|
|
2
3
|
import os
|
|
3
4
|
from pathlib import Path
|
|
@@ -8,6 +9,15 @@ from pyfastcdc.common import BinaryStreamReader
|
|
|
8
9
|
ReadintoFunc = Callable[[memoryview], int]
|
|
9
10
|
|
|
10
11
|
|
|
12
|
+
def logarithm2(value: int) -> int:
|
|
13
|
+
# The same as the nlfiedler/fastcdc-rs v4.0.1 Rust implementation: (value as f64).log2().round() as u32
|
|
14
|
+
if value < 0:
|
|
15
|
+
raise ValueError(f'value must be non-negative, got {value}')
|
|
16
|
+
if value == 0:
|
|
17
|
+
return 0
|
|
18
|
+
return math.floor(math.log2(value) + 0.5)
|
|
19
|
+
|
|
20
|
+
|
|
11
21
|
def create_memoryview_from_buffer(buf: Union[bytes, bytearray, memoryview]) -> memoryview:
|
|
12
22
|
if isinstance(buf, (bytes, bytearray, memoryview)):
|
|
13
23
|
return memoryview(buf)
|
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
import io
|
|
3
|
+
import random
|
|
4
|
+
from io import BytesIO
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Dict, Tuple, List, NamedTuple
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
|
|
10
|
+
from pyfastcdc.common import NormalizedChunking
|
|
11
|
+
from pyfastcdc.cy import FastCDC as FastCDC_cy
|
|
12
|
+
from pyfastcdc.py import FastCDC as FastCDC_py
|
|
13
|
+
from tests.utils import FastCDCType
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TestSekienAkashitaImage:
|
|
17
|
+
class Param(NamedTuple):
|
|
18
|
+
avg_size: int
|
|
19
|
+
seed: int = 0
|
|
20
|
+
nc: NormalizedChunking = 1
|
|
21
|
+
|
|
22
|
+
def pytest_id(self) -> str:
|
|
23
|
+
return f'avg{self.avg_size}_seed{self.seed}_nc{self.nc}'
|
|
24
|
+
|
|
25
|
+
# Param -> [(gear_hash, length), ...]
|
|
26
|
+
EXPECTED_RESULT: Dict[Param, List[Tuple[int, int]]] = {}
|
|
27
|
+
|
|
28
|
+
@pytest.mark.parametrize('cut_func', ['buf', 'stream'])
|
|
29
|
+
@pytest.mark.parametrize('case_param', EXPECTED_RESULT.keys(), ids=Param.pytest_id)
|
|
30
|
+
def test_sekien_akashita(self, fastcdc_impl: FastCDCType, sekien_akashita_bytes: bytes, case_param: Param, cut_func: str):
|
|
31
|
+
expected = self.EXPECTED_RESULT[case_param]
|
|
32
|
+
|
|
33
|
+
cdc = fastcdc_impl(avg_size=case_param.avg_size, seed=case_param.seed, normalized_chunking=case_param.nc)
|
|
34
|
+
|
|
35
|
+
if cut_func == 'buf':
|
|
36
|
+
chunk_gen = cdc.cut_stream(BytesIO(sekien_akashita_bytes))
|
|
37
|
+
elif cut_func == 'stream':
|
|
38
|
+
chunk_gen = cdc.cut_buf(sekien_akashita_bytes)
|
|
39
|
+
else:
|
|
40
|
+
raise ValueError(cut_func)
|
|
41
|
+
|
|
42
|
+
h = hashlib.sha256()
|
|
43
|
+
chunk_cnt = 0
|
|
44
|
+
for i, chunk in enumerate(chunk_gen):
|
|
45
|
+
assert i < len(expected)
|
|
46
|
+
assert chunk.gear_hash == expected[i][0]
|
|
47
|
+
assert chunk.length == expected[i][1]
|
|
48
|
+
h.update(chunk.data)
|
|
49
|
+
chunk_cnt += 1
|
|
50
|
+
assert chunk_cnt == len(expected)
|
|
51
|
+
assert h.hexdigest() == hashlib.sha256(sekien_akashita_bytes).hexdigest()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class TestPyCyConsistency:
|
|
55
|
+
DATA_SIZES = [
|
|
56
|
+
*range(100),
|
|
57
|
+
*[i * 100 for i in range(1, 10)],
|
|
58
|
+
*[i * 1024 for i in range(1, 10)],
|
|
59
|
+
*[i * 10 * 1024 for i in range(1, 5)],
|
|
60
|
+
*[i * 100 * 1024 for i in range(1, 4)],
|
|
61
|
+
*[i * 1024 * 1024 for i in range(1, 3)],
|
|
62
|
+
]
|
|
63
|
+
AVG_SIZES = [1024, 4096, 8192, 12345, 16384, 65536]
|
|
64
|
+
|
|
65
|
+
@pytest.fixture(scope="class")
|
|
66
|
+
def random_data_by_size(self) -> Dict[int, bytes]:
|
|
67
|
+
data_cache = {}
|
|
68
|
+
for size in self.DATA_SIZES:
|
|
69
|
+
rnd = random.Random(size)
|
|
70
|
+
data_cache[size] = bytes(rnd.getrandbits(8) for _ in range(size))
|
|
71
|
+
return data_cache
|
|
72
|
+
|
|
73
|
+
@pytest.mark.parametrize('avg_size', AVG_SIZES)
|
|
74
|
+
@pytest.mark.parametrize('data_size', DATA_SIZES)
|
|
75
|
+
@pytest.mark.parametrize('normalized_chunking', [0, 1, 2, 3])
|
|
76
|
+
@pytest.mark.parametrize('seed', [0, 1])
|
|
77
|
+
def test_py_cy_consistency(self, avg_size: int, data_size: int, normalized_chunking: NormalizedChunking, seed: int, random_data_by_size: Dict[int, bytes]):
|
|
78
|
+
data = random_data_by_size[data_size]
|
|
79
|
+
|
|
80
|
+
cdc_py = FastCDC_py(avg_size=avg_size, normalized_chunking=normalized_chunking, seed=seed)
|
|
81
|
+
cdc_cy = FastCDC_cy(avg_size=avg_size, normalized_chunking=normalized_chunking, seed=seed)
|
|
82
|
+
assert cdc_py.avg_size == cdc_cy.avg_size
|
|
83
|
+
assert cdc_py.min_size == cdc_cy.min_size
|
|
84
|
+
assert cdc_py.max_size == cdc_cy.max_size
|
|
85
|
+
|
|
86
|
+
chunks_py = list(cdc_py.cut_buf(data))
|
|
87
|
+
chunks_cy = list(cdc_cy.cut_buf(data))
|
|
88
|
+
|
|
89
|
+
assert len(chunks_py) == len(chunks_cy)
|
|
90
|
+
|
|
91
|
+
for py_chunk, cy_chunk in zip(chunks_py, chunks_cy):
|
|
92
|
+
assert py_chunk.offset == cy_chunk.offset
|
|
93
|
+
assert py_chunk.length == cy_chunk.length
|
|
94
|
+
assert py_chunk.gear_hash == cy_chunk.gear_hash
|
|
95
|
+
assert bytes(py_chunk.data) == bytes(cy_chunk.data)
|
|
96
|
+
|
|
97
|
+
reconstructed_py = b''.join(bytes(chunk.data) for chunk in chunks_py)
|
|
98
|
+
reconstructed_cy = b''.join(bytes(chunk.data) for chunk in chunks_cy)
|
|
99
|
+
assert reconstructed_py == data
|
|
100
|
+
assert reconstructed_cy == data
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class TestCutMethods:
|
|
104
|
+
def test_chunk_properties(self, fastcdc_instance, random_data_1m: bytes):
|
|
105
|
+
prev_offset = None
|
|
106
|
+
prev_size = None
|
|
107
|
+
for chunk in fastcdc_instance.cut_buf(random_data_1m):
|
|
108
|
+
assert isinstance(chunk.gear_hash, int)
|
|
109
|
+
assert isinstance(chunk.offset, int)
|
|
110
|
+
assert isinstance(chunk.length, int)
|
|
111
|
+
assert isinstance(chunk.data, memoryview)
|
|
112
|
+
|
|
113
|
+
assert len(chunk.data) == chunk.length
|
|
114
|
+
|
|
115
|
+
if prev_offset is not None:
|
|
116
|
+
assert chunk.offset == prev_offset + prev_size
|
|
117
|
+
prev_offset = chunk.offset
|
|
118
|
+
prev_size = chunk.length
|
|
119
|
+
|
|
120
|
+
def test_cut_buf_vs_cut_file_consistency(self, fastcdc_impl: FastCDCType, random_data_1m: bytes, tmp_path: Path):
|
|
121
|
+
cdc = fastcdc_impl(avg_size=8192)
|
|
122
|
+
chunks_memory = list(cdc.cut_buf(random_data_1m))
|
|
123
|
+
|
|
124
|
+
temp_file = tmp_path / 'test.bin'
|
|
125
|
+
temp_file.write_bytes(random_data_1m)
|
|
126
|
+
|
|
127
|
+
chunk_cnt = 0
|
|
128
|
+
for i, chunk in enumerate(cdc.cut_file(temp_file)):
|
|
129
|
+
chunk_cnt += 1
|
|
130
|
+
assert chunk_cnt <= len(chunks_memory)
|
|
131
|
+
assert chunk.offset == chunks_memory[i].offset
|
|
132
|
+
assert chunk.length == chunks_memory[i].length
|
|
133
|
+
assert chunk.gear_hash == chunks_memory[i].gear_hash
|
|
134
|
+
assert bytes(chunk.data) == bytes(chunks_memory[i].data)
|
|
135
|
+
assert len(chunks_memory) == chunk_cnt
|
|
136
|
+
|
|
137
|
+
def test_cut_buf_vs_cut_stream_consistency_read(self, fastcdc_impl: FastCDCType, random_data_1m: bytes):
|
|
138
|
+
cdc = fastcdc_impl(avg_size=8192)
|
|
139
|
+
chunks_memory = list(cdc.cut_buf(random_data_1m))
|
|
140
|
+
bytes_io = io.BytesIO(random_data_1m)
|
|
141
|
+
|
|
142
|
+
class MyStream:
|
|
143
|
+
def read(self, n: int) -> bytes:
|
|
144
|
+
return bytes_io.read(n)
|
|
145
|
+
|
|
146
|
+
chunk_cnt = 0
|
|
147
|
+
for i, chunk in enumerate(cdc.cut_stream(MyStream())):
|
|
148
|
+
chunk_cnt += 1
|
|
149
|
+
assert chunk_cnt <= len(chunks_memory)
|
|
150
|
+
assert chunk.offset == chunks_memory[i].offset
|
|
151
|
+
assert chunk.length == chunks_memory[i].length
|
|
152
|
+
assert chunk.gear_hash == chunks_memory[i].gear_hash
|
|
153
|
+
assert bytes(chunk.data) == bytes(chunks_memory[i].data)
|
|
154
|
+
assert len(chunks_memory) == chunk_cnt
|
|
155
|
+
|
|
156
|
+
def test_cut_buf_vs_cut_stream_consistency_readinto(self, fastcdc_impl: FastCDCType, random_data_1m: bytes):
|
|
157
|
+
cdc = fastcdc_impl(avg_size=8192)
|
|
158
|
+
chunks_memory = list(cdc.cut_buf(random_data_1m))
|
|
159
|
+
bytes_io = io.BytesIO(random_data_1m)
|
|
160
|
+
|
|
161
|
+
class MyStream:
|
|
162
|
+
def readinto(self, buf) -> int:
|
|
163
|
+
return bytes_io.readinto(buf)
|
|
164
|
+
|
|
165
|
+
chunk_cnt = 0
|
|
166
|
+
for i, chunk in enumerate(cdc.cut_stream(MyStream())):
|
|
167
|
+
chunk_cnt += 1
|
|
168
|
+
assert chunk_cnt <= len(chunks_memory)
|
|
169
|
+
assert chunk.offset == chunks_memory[i].offset
|
|
170
|
+
assert chunk.length == chunks_memory[i].length
|
|
171
|
+
assert chunk.gear_hash == chunks_memory[i].gear_hash
|
|
172
|
+
assert bytes(chunk.data) == bytes(chunks_memory[i].data)
|
|
173
|
+
assert len(chunks_memory) == chunk_cnt
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class TestSeed:
|
|
177
|
+
def test_different_seeds_produce_different_chunks(self, random_data_1m: bytes):
|
|
178
|
+
cdc1 = FastCDC_cy(avg_size=8192, seed=1)
|
|
179
|
+
cdc2 = FastCDC_cy(avg_size=8192, seed=2)
|
|
180
|
+
|
|
181
|
+
chunks1 = list(cdc1.cut_buf(random_data_1m))
|
|
182
|
+
chunks2 = list(cdc2.cut_buf(random_data_1m))
|
|
183
|
+
|
|
184
|
+
hashes1 = [chunk.gear_hash for chunk in chunks1]
|
|
185
|
+
hashes2 = [chunk.gear_hash for chunk in chunks2]
|
|
186
|
+
|
|
187
|
+
assert hashes1 != hashes2 or len(chunks1) == 0
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class TestChunkProperties:
|
|
191
|
+
def test_chunk_data_integrity(self, fastcdc_instance, random_data_1m: bytes):
|
|
192
|
+
data_list = []
|
|
193
|
+
for chunk in fastcdc_instance.cut_buf(random_data_1m):
|
|
194
|
+
data_list.append(bytes(chunk.data))
|
|
195
|
+
assert b''.join(data_list) == random_data_1m
|
|
196
|
+
|
|
197
|
+
def test_chunk_size_constraints(self, fastcdc_impl: FastCDCType, random_data_1m: bytes):
|
|
198
|
+
avg_size = 16384
|
|
199
|
+
min_size = avg_size // 4 # 4096
|
|
200
|
+
max_size = avg_size * 4 # 65536
|
|
201
|
+
|
|
202
|
+
cdc = fastcdc_impl(avg_size=avg_size)
|
|
203
|
+
chunks = list(cdc.cut_buf(random_data_1m))
|
|
204
|
+
|
|
205
|
+
for chunk in chunks:
|
|
206
|
+
if chunk != chunks[-1]:
|
|
207
|
+
assert min_size <= chunk.length <= max_size
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def __build_test_data():
|
|
212
|
+
cases = TestSekienAkashitaImage.EXPECTED_RESULT
|
|
213
|
+
key = TestSekienAkashitaImage.Param
|
|
214
|
+
cases[key(16384, 0)] = [
|
|
215
|
+
(17968276318003433923, 21325),
|
|
216
|
+
(8197189939299398838, 17140),
|
|
217
|
+
(13019990849178155730, 28084),
|
|
218
|
+
(4509236223063678303, 18217),
|
|
219
|
+
(2504464741100432583, 24700),
|
|
220
|
+
]
|
|
221
|
+
cases[key(16384, 555, 0)] = [
|
|
222
|
+
(11912081672558759016, 65536),
|
|
223
|
+
(4429013657701329409, 15481),
|
|
224
|
+
(4617353815122521848, 25471),
|
|
225
|
+
(0, 2978),
|
|
226
|
+
]
|
|
227
|
+
cases[key(16384, 666, 1)] = [
|
|
228
|
+
(9312357714466240148, 10605),
|
|
229
|
+
(226910853333574584, 55745),
|
|
230
|
+
(12271755243986371352, 11346),
|
|
231
|
+
(14153975939352546047, 5883),
|
|
232
|
+
(5890158701071314778, 11586),
|
|
233
|
+
(8981594897574481255, 14301),
|
|
234
|
+
]
|
|
235
|
+
cases[key(16384, 777, 2)] = [
|
|
236
|
+
(5756766315125948951, 35163),
|
|
237
|
+
(17831515366867633926, 16422),
|
|
238
|
+
(3216207887329694204, 17470),
|
|
239
|
+
(1561632489531769228, 10294),
|
|
240
|
+
(10369060306646295092, 18786),
|
|
241
|
+
(14655496504067886486, 11331),
|
|
242
|
+
]
|
|
243
|
+
cases[key(16384, 888, 3)] = [
|
|
244
|
+
(3158156329559295338, 17507),
|
|
245
|
+
(5701878486563355731, 18589),
|
|
246
|
+
(4529013630687100674, 17996),
|
|
247
|
+
(3219799010358125664, 17281),
|
|
248
|
+
(9266722211030107244, 15987),
|
|
249
|
+
(7683217499559119532, 19292),
|
|
250
|
+
(0, 2814),
|
|
251
|
+
]
|
|
252
|
+
cases[key(32768, 0)] = [
|
|
253
|
+
(15733367461443853673, 66549),
|
|
254
|
+
(6321136627705800457, 42917),
|
|
255
|
+
]
|
|
256
|
+
cases[key(65536, 0)] = [
|
|
257
|
+
(2504464741100432583, 109466),
|
|
258
|
+
]
|
|
259
|
+
cases[key(1000, 0)] = [
|
|
260
|
+
(15141981586395774332, 577),
|
|
261
|
+
(8477613194938993865, 2025),
|
|
262
|
+
(2735959075179562048, 1118),
|
|
263
|
+
(18115765646671285894, 1458),
|
|
264
|
+
(9500110725479242474, 1122),
|
|
265
|
+
(443122261039895162, 334),
|
|
266
|
+
(393511086818658384, 268),
|
|
267
|
+
(16955226389877987730, 2234),
|
|
268
|
+
(2735959075179562048, 1118),
|
|
269
|
+
(18115765646671285894, 1458),
|
|
270
|
+
(13954488060845043336, 616),
|
|
271
|
+
(4626797161746623835, 4000),
|
|
272
|
+
(11465206466110030982, 1108),
|
|
273
|
+
(3877185904066068587, 1457),
|
|
274
|
+
(5881250651602209508, 1321),
|
|
275
|
+
(16925411787380621381, 251),
|
|
276
|
+
(17489808562297316230, 860),
|
|
277
|
+
(18129948957563258366, 1158),
|
|
278
|
+
(13002932706949647172, 1369),
|
|
279
|
+
(3370452418750950046, 258),
|
|
280
|
+
(17998343902007936034, 1641),
|
|
281
|
+
(11508990849237690054, 819),
|
|
282
|
+
(5207468236900142596, 1090),
|
|
283
|
+
(8284690672242526937, 1257),
|
|
284
|
+
(16861457263863958963, 1179),
|
|
285
|
+
(10960864681938687892, 1386),
|
|
286
|
+
(6054483394976617000, 1068),
|
|
287
|
+
(2386775949661439840, 1224),
|
|
288
|
+
(9765031068850768480, 1037),
|
|
289
|
+
(16719281564143894808, 1313),
|
|
290
|
+
(17393396865315244987, 2021),
|
|
291
|
+
(8197189939299398838, 320),
|
|
292
|
+
(6871126333188003048, 885),
|
|
293
|
+
(16972716804835771241, 1179),
|
|
294
|
+
(12808154220016437278, 2139),
|
|
295
|
+
(15385422482022415630, 356),
|
|
296
|
+
(6844292880670166480, 1776),
|
|
297
|
+
(13355204841389267792, 1168),
|
|
298
|
+
(9374847859024726178, 971),
|
|
299
|
+
(17084607867749926034, 1142),
|
|
300
|
+
(10103105113398742526, 1278),
|
|
301
|
+
(6254902090653532395, 2043),
|
|
302
|
+
(7952073558027502250, 1534),
|
|
303
|
+
(9616506964461227050, 1115),
|
|
304
|
+
(12322483109039221194, 636),
|
|
305
|
+
(8958286662040306431, 1341),
|
|
306
|
+
(12554149114625989198, 1740),
|
|
307
|
+
(16207690376253020852, 1006),
|
|
308
|
+
(16248939738969512408, 1468),
|
|
309
|
+
(14270957677345163169, 1299),
|
|
310
|
+
(1551239710381196832, 1429),
|
|
311
|
+
(14312347838531863880, 2478),
|
|
312
|
+
(1335322050285636652, 1786),
|
|
313
|
+
(1944458194743591353, 2275),
|
|
314
|
+
(12039817357202303956, 949),
|
|
315
|
+
(11820880714810263869, 1377),
|
|
316
|
+
(16009206469796846404, 371),
|
|
317
|
+
(14283166369001529626, 337),
|
|
318
|
+
(15911323414792572684, 1076),
|
|
319
|
+
(16417310421356693358, 868),
|
|
320
|
+
(18147769296913861510, 1011),
|
|
321
|
+
(15334853639705628667, 1769),
|
|
322
|
+
(7045320843275616092, 482),
|
|
323
|
+
(3743371431493807673, 665),
|
|
324
|
+
(975175087488798292, 2264),
|
|
325
|
+
(9731900868009236632, 1116),
|
|
326
|
+
(7899942747347358014, 1264),
|
|
327
|
+
(478520673225540621, 1025),
|
|
328
|
+
(4509236223063678303, 683),
|
|
329
|
+
(7911353879014065725, 1033),
|
|
330
|
+
(17211447357795894654, 1597),
|
|
331
|
+
(9814968862893591415, 1711),
|
|
332
|
+
(6643495946427635752, 1356),
|
|
333
|
+
(14635965274794233990, 1456),
|
|
334
|
+
(17951524945264971610, 1006),
|
|
335
|
+
(12407786606147719096, 1663),
|
|
336
|
+
(8379360585841640134, 1234),
|
|
337
|
+
(4798022593009727916, 291),
|
|
338
|
+
(10955710641692053612, 1094),
|
|
339
|
+
(457762767568428136, 344),
|
|
340
|
+
(82832907034692228, 1444),
|
|
341
|
+
(5774103846722045964, 1168),
|
|
342
|
+
(17563493800282002670, 1450),
|
|
343
|
+
(2724044535410791590, 1050),
|
|
344
|
+
(9389354643814908759, 1085),
|
|
345
|
+
(9132161234032204682, 1848),
|
|
346
|
+
(16231621261041204310, 254),
|
|
347
|
+
(261151940358997096, 1069),
|
|
348
|
+
(9613379839789125245, 1323),
|
|
349
|
+
(16119826487342861060, 1088),
|
|
350
|
+
(0, 136),
|
|
351
|
+
]
|
|
352
|
+
cases[key(4096, 123)] = [
|
|
353
|
+
(17640604251071308688, 5626),
|
|
354
|
+
(17640604251071308688, 6534),
|
|
355
|
+
(1164779717113740270, 5375),
|
|
356
|
+
(1630317330713120546, 2204),
|
|
357
|
+
(15925855439796383684, 7352),
|
|
358
|
+
(14038325076263464756, 4459),
|
|
359
|
+
(10372641652373760866, 2757),
|
|
360
|
+
(6632718265737316290, 4345),
|
|
361
|
+
(13547989595704043725, 13255),
|
|
362
|
+
(5085413808508269073, 6871),
|
|
363
|
+
(2088831145520463002, 1867),
|
|
364
|
+
(17282638805110740002, 7908),
|
|
365
|
+
(10392127899000403174, 4664),
|
|
366
|
+
(12682705380171701888, 3262),
|
|
367
|
+
(14163264652508939164, 4595),
|
|
368
|
+
(11317546923098927019, 10371),
|
|
369
|
+
(5442637979354971713, 5365),
|
|
370
|
+
(918741369407724947, 3523),
|
|
371
|
+
(11012502959421423036, 2886),
|
|
372
|
+
(16443206251033749990, 4470),
|
|
373
|
+
(18389377892984539132, 1777),
|
|
374
|
+
]
|
|
375
|
+
cases[key(3333, 456)] = [
|
|
376
|
+
(10244635572917292382, 5352),
|
|
377
|
+
(10244635572917292382, 6534),
|
|
378
|
+
(6506656886334461048, 8428),
|
|
379
|
+
(1568981245086988673, 4055),
|
|
380
|
+
(976165388776206262, 8246),
|
|
381
|
+
(227474149701075941, 1705),
|
|
382
|
+
(15597163692867778936, 8896),
|
|
383
|
+
(8853802354309906299, 1703),
|
|
384
|
+
(7846154730496643533, 2469),
|
|
385
|
+
(12579192060780867954, 876),
|
|
386
|
+
(16367212629893111190, 6710),
|
|
387
|
+
(11084210301959466778, 6617),
|
|
388
|
+
(17216215298576800968, 2290),
|
|
389
|
+
(2745509010730917144, 3990),
|
|
390
|
+
(11949739281024563184, 2157),
|
|
391
|
+
(11802567455667178519, 7639),
|
|
392
|
+
(15836350909598670374, 3458),
|
|
393
|
+
(3598944074651431428, 4450),
|
|
394
|
+
(14136883845736820776, 6320),
|
|
395
|
+
(3381712722571947258, 8934),
|
|
396
|
+
(1258510376350532739, 1315),
|
|
397
|
+
(1125375003867751948, 3341),
|
|
398
|
+
(6560578492574969505, 3981),
|
|
399
|
+
]
|
|
400
|
+
cases[key(7696, 789)] = [
|
|
401
|
+
(11334448432782874778, 8194),
|
|
402
|
+
(12589329716764299352, 20178),
|
|
403
|
+
(9249278391062916766, 8282),
|
|
404
|
+
(17112004270336100794, 7728),
|
|
405
|
+
(10241186054488990483, 11587),
|
|
406
|
+
(13131687877381749692, 7247),
|
|
407
|
+
(4691067104701485054, 13922),
|
|
408
|
+
(14573090550801024034, 10300),
|
|
409
|
+
(4483911677009026884, 3884),
|
|
410
|
+
(16657773305248393930, 2912),
|
|
411
|
+
(11098559764229607138, 8020),
|
|
412
|
+
(15951496705909269620, 7212),
|
|
413
|
+
]
|
|
414
|
+
|
|
415
|
+
cases[key(724, 9)] = [ # logarithm2(724) == 9
|
|
416
|
+
(6210182461912837442, 437),
|
|
417
|
+
(15823412212426401040, 536),
|
|
418
|
+
(7564542701233810453, 1491),
|
|
419
|
+
(11734395491080755364, 758),
|
|
420
|
+
(4652611913553545461, 865),
|
|
421
|
+
(9396519209846734759, 229),
|
|
422
|
+
(14724133904636706898, 776),
|
|
423
|
+
(14179978172047068347, 1585),
|
|
424
|
+
(12420364923825674884, 294),
|
|
425
|
+
(15823412212426401040, 536),
|
|
426
|
+
(7564542701233810453, 1491),
|
|
427
|
+
(11734395491080755364, 758),
|
|
428
|
+
(4652611913553545461, 865),
|
|
429
|
+
(9396519209846734759, 229),
|
|
430
|
+
(14724133904636706898, 776),
|
|
431
|
+
(6679608208662765719, 1009),
|
|
432
|
+
(7970508778836684116, 2896),
|
|
433
|
+
(588782165723983073, 1757),
|
|
434
|
+
(9355144489785944531, 233),
|
|
435
|
+
(7270358463936224191, 319),
|
|
436
|
+
(10753677279385161822, 730),
|
|
437
|
+
(14878908755424596036, 693),
|
|
438
|
+
(17252729894520766000, 199),
|
|
439
|
+
(2557031429687478504, 742),
|
|
440
|
+
(11154471105488776204, 511),
|
|
441
|
+
(6241044147716496561, 479),
|
|
442
|
+
(1528829558651627719, 1119),
|
|
443
|
+
(15819821700176001938, 690),
|
|
444
|
+
(14864412389671971154, 368),
|
|
445
|
+
(16770710277328743660, 805),
|
|
446
|
+
(6677815027125987531, 765),
|
|
447
|
+
(3130290060913031247, 613),
|
|
448
|
+
(7848687156715069461, 931),
|
|
449
|
+
(17047677119083606015, 261),
|
|
450
|
+
(386826127241435034, 286),
|
|
451
|
+
(13186826917161993786, 462),
|
|
452
|
+
(11921066640454513798, 221),
|
|
453
|
+
(17813634603948247098, 776),
|
|
454
|
+
(208283819332894784, 1585),
|
|
455
|
+
(3828817839447427386, 800),
|
|
456
|
+
(4410297577497966787, 509),
|
|
457
|
+
(15915646898486727054, 776),
|
|
458
|
+
(12606911033279791588, 936),
|
|
459
|
+
(2317245335378339546, 279),
|
|
460
|
+
(11899481234140602421, 731),
|
|
461
|
+
(541281491629941110, 336),
|
|
462
|
+
(13930607010442119242, 1012),
|
|
463
|
+
(10043439370713735358, 1443),
|
|
464
|
+
(4351904982129715350, 783),
|
|
465
|
+
(10272470512678469758, 1768),
|
|
466
|
+
(13811592930557436145, 199),
|
|
467
|
+
(3835830484370282898, 1598),
|
|
468
|
+
(16478342864273230318, 738),
|
|
469
|
+
(848712800904677626, 724),
|
|
470
|
+
(7089126568427585890, 1680),
|
|
471
|
+
(11588799795439342024, 748),
|
|
472
|
+
(6517184361581775911, 741),
|
|
473
|
+
(2581329261736055218, 996),
|
|
474
|
+
(1438472251255850114, 797),
|
|
475
|
+
(2040918757124669446, 1050),
|
|
476
|
+
(12710486653819945042, 958),
|
|
477
|
+
(3577694700869568713, 529),
|
|
478
|
+
(5540893603527656618, 885),
|
|
479
|
+
(312595612891107520, 938),
|
|
480
|
+
(2754121658008144322, 726),
|
|
481
|
+
(7308113600980769340, 223),
|
|
482
|
+
(12624207711036016704, 741),
|
|
483
|
+
(18278303734565733423, 1127),
|
|
484
|
+
(3416967846417400033, 887),
|
|
485
|
+
(16597395760763373822, 779),
|
|
486
|
+
(11517746268471340466, 658),
|
|
487
|
+
(330536455930203400, 188),
|
|
488
|
+
(14346035238419306508, 964),
|
|
489
|
+
(11851015761706437850, 652),
|
|
490
|
+
(2207968762155534473, 1067),
|
|
491
|
+
(4300209225473755288, 795),
|
|
492
|
+
(16079828354387167342, 393),
|
|
493
|
+
(11074900721964437734, 1002),
|
|
494
|
+
(15850308162951321652, 812),
|
|
495
|
+
(16189354393452719094, 701),
|
|
496
|
+
(5872528194289029586, 1596),
|
|
497
|
+
(2438982074523730154, 932),
|
|
498
|
+
(7457200155121522294, 676),
|
|
499
|
+
(67373542593277148, 1195),
|
|
500
|
+
(6416504404064643776, 490),
|
|
501
|
+
(13048281498366780615, 741),
|
|
502
|
+
(6491312012001838137, 1031),
|
|
503
|
+
(6403314040556224779, 263),
|
|
504
|
+
(5966668646084264096, 730),
|
|
505
|
+
(7618965489272260256, 581),
|
|
506
|
+
(1698496630771737232, 324),
|
|
507
|
+
(6272792483812909132, 1157),
|
|
508
|
+
(14099154068530824346, 376),
|
|
509
|
+
(8036575980860559560, 780),
|
|
510
|
+
(9922279172859505867, 635),
|
|
511
|
+
(13167110527530567759, 795),
|
|
512
|
+
(11850586376745257027, 1013),
|
|
513
|
+
(7046096067745630262, 1250),
|
|
514
|
+
(17794651536343781444, 1136),
|
|
515
|
+
(8908771862940031268, 1096),
|
|
516
|
+
(5050182300921299158, 794),
|
|
517
|
+
(2020723957054363976, 588),
|
|
518
|
+
(3325484325892565060, 973),
|
|
519
|
+
(17337365858043038764, 1507),
|
|
520
|
+
(753368741273692028, 215),
|
|
521
|
+
(3512003076754004550, 283),
|
|
522
|
+
(2265043035317403640, 526),
|
|
523
|
+
(16793717987136300110, 228),
|
|
524
|
+
(3741116656027469037, 941),
|
|
525
|
+
(16225024565176477711, 729),
|
|
526
|
+
(10008765342384935360, 1112),
|
|
527
|
+
(7891613205322036999, 465),
|
|
528
|
+
(7474923846557769781, 827),
|
|
529
|
+
(9383267966041790494, 1036),
|
|
530
|
+
(5444012540148356076, 438),
|
|
531
|
+
(12123398032021590048, 1110),
|
|
532
|
+
(2966615689224291352, 1347),
|
|
533
|
+
(9979705022142839714, 246),
|
|
534
|
+
(11728505674497348048, 1062),
|
|
535
|
+
(10197500089416620450, 736),
|
|
536
|
+
(17336138819815902386, 847),
|
|
537
|
+
(16442276383220580678, 834),
|
|
538
|
+
(7224900734343987180, 207),
|
|
539
|
+
(3030712618198892048, 432),
|
|
540
|
+
(8091423245119018858, 551),
|
|
541
|
+
(970234113364082694, 834),
|
|
542
|
+
(10080364783653397770, 195),
|
|
543
|
+
(11220676464059947108, 1862),
|
|
544
|
+
(18400029108298858430, 230),
|
|
545
|
+
(11748286201114699520, 260),
|
|
546
|
+
(11023492533541935362, 1238),
|
|
547
|
+
(1979512512097582824, 359),
|
|
548
|
+
(1889718952600535126, 1019),
|
|
549
|
+
(7215615887733475334, 627),
|
|
550
|
+
(4459541957027827716, 742),
|
|
551
|
+
(16447634892420350148, 1046),
|
|
552
|
+
(12384333288239022322, 1522),
|
|
553
|
+
(8742062182533134312, 956),
|
|
554
|
+
]
|
|
555
|
+
cases[key(725, 10)] = [ # logarithm2(725) == 10
|
|
556
|
+
(3880200791445358170, 1171),
|
|
557
|
+
(5658294207238396694, 476),
|
|
558
|
+
(1986145496423499562, 1752),
|
|
559
|
+
(4291161420613030454, 1032),
|
|
560
|
+
(2570315465402502055, 939),
|
|
561
|
+
(13607912940956345208, 333),
|
|
562
|
+
(17847537199891125810, 1504),
|
|
563
|
+
(5932397945798563614, 764),
|
|
564
|
+
(14521897173053881527, 361),
|
|
565
|
+
(10216444785066525589, 1601),
|
|
566
|
+
(4291161420613030454, 1032),
|
|
567
|
+
(2570315465402502055, 939),
|
|
568
|
+
(8050782876685575453, 447),
|
|
569
|
+
(13302770737643351377, 2900),
|
|
570
|
+
(14663859402684139382, 2333),
|
|
571
|
+
(12183996374588754964, 871),
|
|
572
|
+
(12719892389018513871, 231),
|
|
573
|
+
(3891719624479213180, 1565),
|
|
574
|
+
(14651348969435727241, 899),
|
|
575
|
+
(13017162958173657478, 666),
|
|
576
|
+
(355366611350493046, 1024),
|
|
577
|
+
(8975997613858408118, 975),
|
|
578
|
+
(12346944422348624424, 1632),
|
|
579
|
+
(17121775793317715396, 818),
|
|
580
|
+
(8735300905794665892, 288),
|
|
581
|
+
(1593109120621282946, 918),
|
|
582
|
+
(3636164904145165176, 712),
|
|
583
|
+
(4963895604217385630, 876),
|
|
584
|
+
(17063897432159488626, 1824),
|
|
585
|
+
(12722273962190769990, 908),
|
|
586
|
+
(3786605912018387702, 1593),
|
|
587
|
+
(8109461640426192974, 757),
|
|
588
|
+
(3159992682178447490, 2026),
|
|
589
|
+
(4546850680761030892, 1144),
|
|
590
|
+
(6540955558319623319, 1369),
|
|
591
|
+
(339630999250211216, 788),
|
|
592
|
+
(11185666916059514410, 1336),
|
|
593
|
+
(10655877686637416176, 1971),
|
|
594
|
+
(12721905901213615624, 833),
|
|
595
|
+
(14066897360568717938, 754),
|
|
596
|
+
(11212252888158967820, 1036),
|
|
597
|
+
(7159074416532427876, 732),
|
|
598
|
+
(14930792122386848472, 1346),
|
|
599
|
+
(8468966750367534944, 1871),
|
|
600
|
+
(13402150570819703574, 710),
|
|
601
|
+
(15825368515155591746, 820),
|
|
602
|
+
(13417749480250952531, 943),
|
|
603
|
+
(1621894964071905100, 509),
|
|
604
|
+
(7925783383027301942, 706),
|
|
605
|
+
(12559986661817166516, 226),
|
|
606
|
+
(4964616519763020901, 1407),
|
|
607
|
+
(3873577331692030894, 903),
|
|
608
|
+
(17621425153818828532, 1318),
|
|
609
|
+
(16290934634368242021, 311),
|
|
610
|
+
(16958772797381986928, 889),
|
|
611
|
+
(5365141795369192612, 1300),
|
|
612
|
+
(17769023687988720468, 674),
|
|
613
|
+
(2250458466579792345, 1237),
|
|
614
|
+
(14584358719494663026, 346),
|
|
615
|
+
(5717040536230332101, 515),
|
|
616
|
+
(5316380896310853805, 741),
|
|
617
|
+
(9007463591917437538, 983),
|
|
618
|
+
(5518484945376478388, 996),
|
|
619
|
+
(12810471851541676335, 2177),
|
|
620
|
+
(13264222816481349316, 1260),
|
|
621
|
+
(2161345495062028080, 1026),
|
|
622
|
+
(16771665155150908002, 808),
|
|
623
|
+
(4054366689955984488, 472),
|
|
624
|
+
(14487455770406964220, 1289),
|
|
625
|
+
(14550807423624594204, 877),
|
|
626
|
+
(4788670350554726882, 1353),
|
|
627
|
+
(6574134102965381932, 372),
|
|
628
|
+
(16504855675512305190, 405),
|
|
629
|
+
(9088365967746888780, 2900),
|
|
630
|
+
(14596247611905770804, 682),
|
|
631
|
+
(12911613994967767354, 758),
|
|
632
|
+
(12634321617313432304, 1224),
|
|
633
|
+
(15207794529635932600, 1122),
|
|
634
|
+
(7511305357194071387, 1065),
|
|
635
|
+
(12189587028669927526, 1048),
|
|
636
|
+
(4177934069308589140, 319),
|
|
637
|
+
(7569676053598539570, 1646),
|
|
638
|
+
(16173403249582546592, 2602),
|
|
639
|
+
(7088138500417580436, 387),
|
|
640
|
+
(17005641209635772934, 1950),
|
|
641
|
+
(11058910209362914707, 337),
|
|
642
|
+
(11086789351781338680, 735),
|
|
643
|
+
(6039279362010812718, 884),
|
|
644
|
+
(8044605568175964902, 933),
|
|
645
|
+
(14639839282236278972, 2193),
|
|
646
|
+
(13667334481093640681, 593),
|
|
647
|
+
(8229075153661986514, 2038),
|
|
648
|
+
(11671963030460304732, 1250),
|
|
649
|
+
(5431176519429573497, 1323),
|
|
650
|
+
(16007310708128089160, 1365),
|
|
651
|
+
(8155414491064993052, 805),
|
|
652
|
+
(13739322222304365424, 1548),
|
|
653
|
+
(15038706754656408926, 1084),
|
|
654
|
+
(7516815982880017639, 959),
|
|
655
|
+
(6676390934596324937, 871),
|
|
656
|
+
(14873914439199393400, 753),
|
|
657
|
+
(18275621106261248557, 1172),
|
|
658
|
+
]
|
|
659
|
+
cases[key(11585, 13)] = [ # logarithm2(11585) == 13
|
|
660
|
+
(5283862320262956126, 6784),
|
|
661
|
+
(11025388708907034538, 17576),
|
|
662
|
+
(6660909496720783874, 18720),
|
|
663
|
+
(17270784194951261795, 5889),
|
|
664
|
+
(13967635376301421897, 13789),
|
|
665
|
+
(2544012647058660924, 14881),
|
|
666
|
+
(17731551937985281530, 16441),
|
|
667
|
+
(9757367471876633230, 13893),
|
|
668
|
+
(0, 1493),
|
|
669
|
+
]
|
|
670
|
+
cases[key(11586, 14)] = [ # logarithm2(11586) == 14
|
|
671
|
+
(9647594720494668858, 11853),
|
|
672
|
+
(15785684128034222449, 45969),
|
|
673
|
+
(2654885834306702464, 18990),
|
|
674
|
+
(11599035070615737710, 27020),
|
|
675
|
+
(5712156089341372705, 5634),
|
|
676
|
+
]
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
__build_test_data()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from pyfastcdc import utils
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestLogarithm2:
|
|
7
|
+
def test_negative_input(self):
|
|
8
|
+
with pytest.raises(ValueError):
|
|
9
|
+
utils.logarithm2(-1)
|
|
10
|
+
|
|
11
|
+
def test_zero(self):
|
|
12
|
+
assert utils.logarithm2(0) == 0
|
|
13
|
+
|
|
14
|
+
@pytest.mark.parametrize('result, lower, upper', [
|
|
15
|
+
(0, 0, 2),
|
|
16
|
+
(1, 2, 3),
|
|
17
|
+
(2, 3, 6),
|
|
18
|
+
(3, 6, 12),
|
|
19
|
+
(4, 12, 23),
|
|
20
|
+
(5, 23, 46),
|
|
21
|
+
(6, 46, 91),
|
|
22
|
+
(7, 91, 182),
|
|
23
|
+
(8, 182, 363),
|
|
24
|
+
(9, 363, 725),
|
|
25
|
+
(10, 725, 1449),
|
|
26
|
+
(11, 1449, 2897),
|
|
27
|
+
(12, 2897, 5793),
|
|
28
|
+
(13, 5793, 11586),
|
|
29
|
+
(14, 11586, 23171),
|
|
30
|
+
(15, 23171, 46341),
|
|
31
|
+
(16, 46341, 92682),
|
|
32
|
+
(17, 92682, 185364),
|
|
33
|
+
(18, 185364, 370728),
|
|
34
|
+
(19, 370728, 741456),
|
|
35
|
+
(20, 741456, 1482911),
|
|
36
|
+
(21, 1482911, 2965821),
|
|
37
|
+
(22, 2965821, 5931642),
|
|
38
|
+
(23, 5931642, 11863284),
|
|
39
|
+
(24, 11863284, 23726567),
|
|
40
|
+
(25, 23726567, 47453133),
|
|
41
|
+
(26, 47453133, 94906266),
|
|
42
|
+
(27, 94906266, 189812532),
|
|
43
|
+
(28, 189812532, 379625063),
|
|
44
|
+
(29, 379625063, 759250125),
|
|
45
|
+
(30, 759250125, 1518500250),
|
|
46
|
+
(31, 1518500250, 3037000500),
|
|
47
|
+
(32, 3037000500, 6074001000),
|
|
48
|
+
])
|
|
49
|
+
def test_logarithm2_boundaries(self, result: int, lower: int, upper: int):
|
|
50
|
+
if upper - lower < 30000:
|
|
51
|
+
for i in range(lower, upper):
|
|
52
|
+
assert utils.logarithm2(i) == result
|
|
53
|
+
else:
|
|
54
|
+
for i in range(lower, lower + 10000):
|
|
55
|
+
assert utils.logarithm2(i) == result
|
|
56
|
+
for i in range(upper - 10000, upper):
|
|
57
|
+
assert utils.logarithm2(i) == result
|
|
58
|
+
for i in range(100):
|
|
59
|
+
mid = lower + (upper - lower) * i // 100
|
|
60
|
+
assert utils.logarithm2(mid) == result
|
|
61
|
+
assert utils.logarithm2(upper) == result + 1
|
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
import hashlib
|
|
2
|
-
import io
|
|
3
|
-
import random
|
|
4
|
-
from io import BytesIO
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
from typing import Dict, Tuple, List, NamedTuple
|
|
7
|
-
|
|
8
|
-
import pytest
|
|
9
|
-
|
|
10
|
-
from pyfastcdc.common import NormalizedChunking
|
|
11
|
-
from pyfastcdc.cy import FastCDC as FastCDC_cy
|
|
12
|
-
from pyfastcdc.py import FastCDC as FastCDC_py
|
|
13
|
-
from tests.utils import FastCDCType
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class TestSekienAkashitaImage:
|
|
17
|
-
class Param(NamedTuple):
|
|
18
|
-
avg_size: int
|
|
19
|
-
seed: int = 0
|
|
20
|
-
nc: NormalizedChunking = 1
|
|
21
|
-
# Param -> [(gear_hash, length), ...]
|
|
22
|
-
EXPECTED_RESULT: Dict[Param, List[Tuple[int, int]]] = {}
|
|
23
|
-
|
|
24
|
-
@pytest.mark.parametrize('cut_func', ['buf', 'stream'])
|
|
25
|
-
@pytest.mark.parametrize('case_param', EXPECTED_RESULT.keys())
|
|
26
|
-
def test_sekien_akashita(self, fastcdc_impl: FastCDCType, sekien_akashita_bytes: bytes, case_param: Param, cut_func: str):
|
|
27
|
-
expected = self.EXPECTED_RESULT[case_param]
|
|
28
|
-
|
|
29
|
-
cdc = fastcdc_impl(avg_size=case_param.avg_size, seed=case_param.seed, normalized_chunking=case_param.nc)
|
|
30
|
-
|
|
31
|
-
if cut_func == 'buf':
|
|
32
|
-
chunk_gen = cdc.cut_stream(BytesIO(sekien_akashita_bytes))
|
|
33
|
-
elif cut_func == 'stream':
|
|
34
|
-
chunk_gen = cdc.cut_buf(sekien_akashita_bytes)
|
|
35
|
-
else:
|
|
36
|
-
raise ValueError(cut_func)
|
|
37
|
-
|
|
38
|
-
h = hashlib.sha256()
|
|
39
|
-
chunk_cnt = 0
|
|
40
|
-
for i, chunk in enumerate(chunk_gen):
|
|
41
|
-
assert i < len(expected)
|
|
42
|
-
assert chunk.gear_hash == expected[i][0]
|
|
43
|
-
assert chunk.length == expected[i][1]
|
|
44
|
-
h.update(chunk.data)
|
|
45
|
-
chunk_cnt += 1
|
|
46
|
-
assert chunk_cnt == len(expected)
|
|
47
|
-
assert h.hexdigest() == hashlib.sha256(sekien_akashita_bytes).hexdigest()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class TestPyCyConsistency:
|
|
51
|
-
DATA_SIZES = [
|
|
52
|
-
*range(100),
|
|
53
|
-
*[i * 100 for i in range(1, 10)],
|
|
54
|
-
*[i * 1024 for i in range(1, 10)],
|
|
55
|
-
*[i * 10 * 1024 for i in range(1, 5)],
|
|
56
|
-
*[i * 100 * 1024 for i in range(1, 4)],
|
|
57
|
-
*[i * 1024 * 1024 for i in range(1, 3)],
|
|
58
|
-
]
|
|
59
|
-
AVG_SIZES = [1024, 4096, 8192, 12345, 16384, 65536]
|
|
60
|
-
|
|
61
|
-
@pytest.fixture(scope="class")
|
|
62
|
-
def random_data_by_size(self) -> Dict[int, bytes]:
|
|
63
|
-
data_cache = {}
|
|
64
|
-
for size in self.DATA_SIZES:
|
|
65
|
-
rnd = random.Random(size)
|
|
66
|
-
data_cache[size] = bytes(rnd.getrandbits(8) for _ in range(size))
|
|
67
|
-
return data_cache
|
|
68
|
-
|
|
69
|
-
@pytest.mark.parametrize('avg_size', AVG_SIZES)
|
|
70
|
-
@pytest.mark.parametrize('data_size', DATA_SIZES)
|
|
71
|
-
@pytest.mark.parametrize('normalized_chunking', [0, 1, 2, 3])
|
|
72
|
-
@pytest.mark.parametrize('seed', [0, 1])
|
|
73
|
-
def test_py_cy_consistency(self, avg_size: int, data_size: int, normalized_chunking: NormalizedChunking, seed: int, random_data_by_size: Dict[int, bytes]):
|
|
74
|
-
data = random_data_by_size[data_size]
|
|
75
|
-
|
|
76
|
-
cdc_py = FastCDC_py(avg_size=avg_size, normalized_chunking=normalized_chunking, seed=seed)
|
|
77
|
-
cdc_cy = FastCDC_cy(avg_size=avg_size, normalized_chunking=normalized_chunking, seed=seed)
|
|
78
|
-
assert cdc_py.avg_size == cdc_cy.avg_size
|
|
79
|
-
assert cdc_py.min_size == cdc_cy.min_size
|
|
80
|
-
assert cdc_py.max_size == cdc_cy.max_size
|
|
81
|
-
|
|
82
|
-
chunks_py = list(cdc_py.cut_buf(data))
|
|
83
|
-
chunks_cy = list(cdc_cy.cut_buf(data))
|
|
84
|
-
|
|
85
|
-
assert len(chunks_py) == len(chunks_cy)
|
|
86
|
-
|
|
87
|
-
for py_chunk, cy_chunk in zip(chunks_py, chunks_cy):
|
|
88
|
-
assert py_chunk.offset == cy_chunk.offset
|
|
89
|
-
assert py_chunk.length == cy_chunk.length
|
|
90
|
-
assert py_chunk.gear_hash == cy_chunk.gear_hash
|
|
91
|
-
assert bytes(py_chunk.data) == bytes(cy_chunk.data)
|
|
92
|
-
|
|
93
|
-
reconstructed_py = b''.join(bytes(chunk.data) for chunk in chunks_py)
|
|
94
|
-
reconstructed_cy = b''.join(bytes(chunk.data) for chunk in chunks_cy)
|
|
95
|
-
assert reconstructed_py == data
|
|
96
|
-
assert reconstructed_cy == data
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
class TestCutMethods:
|
|
100
|
-
def test_chunk_properties(self, fastcdc_instance, random_data_1m: bytes):
|
|
101
|
-
prev_offset = None
|
|
102
|
-
prev_size = None
|
|
103
|
-
for chunk in fastcdc_instance.cut_buf(random_data_1m):
|
|
104
|
-
assert isinstance(chunk.gear_hash, int)
|
|
105
|
-
assert isinstance(chunk.offset, int)
|
|
106
|
-
assert isinstance(chunk.length, int)
|
|
107
|
-
assert isinstance(chunk.data, memoryview)
|
|
108
|
-
|
|
109
|
-
assert len(chunk.data) == chunk.length
|
|
110
|
-
|
|
111
|
-
if prev_offset is not None:
|
|
112
|
-
assert chunk.offset == prev_offset + prev_size
|
|
113
|
-
prev_offset = chunk.offset
|
|
114
|
-
prev_size = chunk.length
|
|
115
|
-
|
|
116
|
-
def test_cut_buf_vs_cut_file_consistency(self, fastcdc_impl: FastCDCType, random_data_1m: bytes, tmp_path: Path):
|
|
117
|
-
cdc = fastcdc_impl(avg_size=8192)
|
|
118
|
-
chunks_memory = list(cdc.cut_buf(random_data_1m))
|
|
119
|
-
|
|
120
|
-
temp_file = tmp_path / 'test.bin'
|
|
121
|
-
temp_file.write_bytes(random_data_1m)
|
|
122
|
-
|
|
123
|
-
chunk_cnt = 0
|
|
124
|
-
for i, chunk in enumerate(cdc.cut_file(temp_file)):
|
|
125
|
-
chunk_cnt += 1
|
|
126
|
-
assert chunk_cnt <= len(chunks_memory)
|
|
127
|
-
assert chunk.offset == chunks_memory[i].offset
|
|
128
|
-
assert chunk.length == chunks_memory[i].length
|
|
129
|
-
assert chunk.gear_hash == chunks_memory[i].gear_hash
|
|
130
|
-
assert bytes(chunk.data) == bytes(chunks_memory[i].data)
|
|
131
|
-
assert len(chunks_memory) == chunk_cnt
|
|
132
|
-
|
|
133
|
-
def test_cut_buf_vs_cut_stream_consistency_read(self, fastcdc_impl: FastCDCType, random_data_1m: bytes):
|
|
134
|
-
cdc = fastcdc_impl(avg_size=8192)
|
|
135
|
-
chunks_memory = list(cdc.cut_buf(random_data_1m))
|
|
136
|
-
bytes_io = io.BytesIO(random_data_1m)
|
|
137
|
-
|
|
138
|
-
class MyStream:
|
|
139
|
-
def read(self, n: int) -> bytes:
|
|
140
|
-
return bytes_io.read(n)
|
|
141
|
-
|
|
142
|
-
chunk_cnt = 0
|
|
143
|
-
for i, chunk in enumerate(cdc.cut_stream(MyStream())):
|
|
144
|
-
chunk_cnt += 1
|
|
145
|
-
assert chunk_cnt <= len(chunks_memory)
|
|
146
|
-
assert chunk.offset == chunks_memory[i].offset
|
|
147
|
-
assert chunk.length == chunks_memory[i].length
|
|
148
|
-
assert chunk.gear_hash == chunks_memory[i].gear_hash
|
|
149
|
-
assert bytes(chunk.data) == bytes(chunks_memory[i].data)
|
|
150
|
-
assert len(chunks_memory) == chunk_cnt
|
|
151
|
-
|
|
152
|
-
def test_cut_buf_vs_cut_stream_consistency_readinto(self, fastcdc_impl: FastCDCType, random_data_1m: bytes):
|
|
153
|
-
cdc = fastcdc_impl(avg_size=8192)
|
|
154
|
-
chunks_memory = list(cdc.cut_buf(random_data_1m))
|
|
155
|
-
bytes_io = io.BytesIO(random_data_1m)
|
|
156
|
-
|
|
157
|
-
class MyStream:
|
|
158
|
-
def readinto(self, buf) -> int:
|
|
159
|
-
return bytes_io.readinto(buf)
|
|
160
|
-
|
|
161
|
-
chunk_cnt = 0
|
|
162
|
-
for i, chunk in enumerate(cdc.cut_stream(MyStream())):
|
|
163
|
-
chunk_cnt += 1
|
|
164
|
-
assert chunk_cnt <= len(chunks_memory)
|
|
165
|
-
assert chunk.offset == chunks_memory[i].offset
|
|
166
|
-
assert chunk.length == chunks_memory[i].length
|
|
167
|
-
assert chunk.gear_hash == chunks_memory[i].gear_hash
|
|
168
|
-
assert bytes(chunk.data) == bytes(chunks_memory[i].data)
|
|
169
|
-
assert len(chunks_memory) == chunk_cnt
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
class TestSeed:
|
|
173
|
-
def test_different_seeds_produce_different_chunks(self, random_data_1m: bytes):
|
|
174
|
-
cdc1 = FastCDC_cy(avg_size=8192, seed=1)
|
|
175
|
-
cdc2 = FastCDC_cy(avg_size=8192, seed=2)
|
|
176
|
-
|
|
177
|
-
chunks1 = list(cdc1.cut_buf(random_data_1m))
|
|
178
|
-
chunks2 = list(cdc2.cut_buf(random_data_1m))
|
|
179
|
-
|
|
180
|
-
hashes1 = [chunk.gear_hash for chunk in chunks1]
|
|
181
|
-
hashes2 = [chunk.gear_hash for chunk in chunks2]
|
|
182
|
-
|
|
183
|
-
assert hashes1 != hashes2 or len(chunks1) == 0
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
class TestChunkProperties:
|
|
187
|
-
def test_chunk_data_integrity(self, fastcdc_instance, random_data_1m: bytes):
|
|
188
|
-
data_list = []
|
|
189
|
-
for chunk in fastcdc_instance.cut_buf(random_data_1m):
|
|
190
|
-
data_list.append(bytes(chunk.data))
|
|
191
|
-
assert b''.join(data_list) == random_data_1m
|
|
192
|
-
|
|
193
|
-
def test_chunk_size_constraints(self, fastcdc_impl: FastCDCType, random_data_1m: bytes):
|
|
194
|
-
avg_size = 16384
|
|
195
|
-
min_size = avg_size // 4 # 4096
|
|
196
|
-
max_size = avg_size * 4 # 65536
|
|
197
|
-
|
|
198
|
-
cdc = fastcdc_impl(avg_size=avg_size)
|
|
199
|
-
chunks = list(cdc.cut_buf(random_data_1m))
|
|
200
|
-
|
|
201
|
-
for chunk in chunks:
|
|
202
|
-
if chunk != chunks[-1]:
|
|
203
|
-
assert min_size <= chunk.length <= max_size
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
def __build_test_data():
|
|
208
|
-
cases = TestSekienAkashitaImage.EXPECTED_RESULT
|
|
209
|
-
key = TestSekienAkashitaImage.Param
|
|
210
|
-
cases[key(16384, 0)] = [
|
|
211
|
-
(17968276318003433923, 21325),
|
|
212
|
-
(8197189939299398838, 17140),
|
|
213
|
-
(13019990849178155730, 28084),
|
|
214
|
-
(4509236223063678303, 18217),
|
|
215
|
-
(2504464741100432583, 24700),
|
|
216
|
-
]
|
|
217
|
-
cases[key(16384, 555, 0)] = [
|
|
218
|
-
(11912081672558759016, 65536),
|
|
219
|
-
(4429013657701329409, 15481),
|
|
220
|
-
(4617353815122521848, 25471),
|
|
221
|
-
(0, 2978),
|
|
222
|
-
]
|
|
223
|
-
cases[key(16384, 666, 1)] = [
|
|
224
|
-
(9312357714466240148, 10605),
|
|
225
|
-
(226910853333574584, 55745),
|
|
226
|
-
(12271755243986371352, 11346),
|
|
227
|
-
(14153975939352546047, 5883),
|
|
228
|
-
(5890158701071314778, 11586),
|
|
229
|
-
(8981594897574481255, 14301),
|
|
230
|
-
]
|
|
231
|
-
cases[key(16384, 777, 2)] = [
|
|
232
|
-
(5756766315125948951, 35163),
|
|
233
|
-
(17831515366867633926, 16422),
|
|
234
|
-
(3216207887329694204, 17470),
|
|
235
|
-
(1561632489531769228, 10294),
|
|
236
|
-
(10369060306646295092, 18786),
|
|
237
|
-
(14655496504067886486, 11331),
|
|
238
|
-
]
|
|
239
|
-
cases[key(16384, 888, 3)] = [
|
|
240
|
-
(3158156329559295338, 17507),
|
|
241
|
-
(5701878486563355731, 18589),
|
|
242
|
-
(4529013630687100674, 17996),
|
|
243
|
-
(3219799010358125664, 17281),
|
|
244
|
-
(9266722211030107244, 15987),
|
|
245
|
-
(7683217499559119532, 19292),
|
|
246
|
-
(0, 2814),
|
|
247
|
-
]
|
|
248
|
-
cases[key(32768, 0)] = [
|
|
249
|
-
(15733367461443853673, 66549),
|
|
250
|
-
(6321136627705800457, 42917),
|
|
251
|
-
]
|
|
252
|
-
cases[key(65536, 0)] = [
|
|
253
|
-
(2504464741100432583, 109466),
|
|
254
|
-
]
|
|
255
|
-
cases[key(1000, 0)] = [
|
|
256
|
-
(2890614758789387787, 359),
|
|
257
|
-
(4044080065227531274, 1501),
|
|
258
|
-
(9649269133818233035, 1087),
|
|
259
|
-
(2854337592871656094, 589),
|
|
260
|
-
(4465407710123297832, 1307),
|
|
261
|
-
(13038202513543136492, 944),
|
|
262
|
-
(221561130519947581, 847),
|
|
263
|
-
(393511086818658384, 268),
|
|
264
|
-
(8088160130455062548, 1492),
|
|
265
|
-
(9649269133818233035, 1087),
|
|
266
|
-
(2854337592871656094, 589),
|
|
267
|
-
(4465407710123297832, 1307),
|
|
268
|
-
(6977244030422521668, 951),
|
|
269
|
-
(14622491748227350624, 497),
|
|
270
|
-
(3757277802856017243, 4000),
|
|
271
|
-
(14582375164208481996, 525),
|
|
272
|
-
(15870580120602364088, 1122),
|
|
273
|
-
(17583755766661134474, 714),
|
|
274
|
-
(11818998251676538346, 267),
|
|
275
|
-
(4691013873021002775, 1135),
|
|
276
|
-
(17968276318003433923, 737),
|
|
277
|
-
(7923522120571464808, 1245),
|
|
278
|
-
(1606623465266480327, 1033),
|
|
279
|
-
(14432714177272874680, 274),
|
|
280
|
-
(9475721149199180143, 627),
|
|
281
|
-
(13127205120246874280, 1226),
|
|
282
|
-
(4571237624765828492, 840),
|
|
283
|
-
(13107907174429668598, 779),
|
|
284
|
-
(8865631699531232422, 256),
|
|
285
|
-
(12688194934178599784, 521),
|
|
286
|
-
(6160462813037351348, 1038),
|
|
287
|
-
(4590271154362536204, 1774),
|
|
288
|
-
(11432121548796343504, 674),
|
|
289
|
-
(12472017965383948508, 1114),
|
|
290
|
-
(11136788103843283336, 1086),
|
|
291
|
-
(14747293179156137189, 1135),
|
|
292
|
-
(4155943948347508955, 1575),
|
|
293
|
-
(13104072099671895560, 739),
|
|
294
|
-
(12639643500133003296, 978),
|
|
295
|
-
(6291550675693738136, 1014),
|
|
296
|
-
(12146666992319875138, 1754),
|
|
297
|
-
(867790609525255823, 823),
|
|
298
|
-
(7795831017548588040, 1197),
|
|
299
|
-
(6071878725246451920, 1128),
|
|
300
|
-
(9006935664263516606, 1230),
|
|
301
|
-
(10730962063819841566, 1243),
|
|
302
|
-
(13986533877452114082, 311),
|
|
303
|
-
(11213593662057882791, 1563),
|
|
304
|
-
(8419216051635751960, 2535),
|
|
305
|
-
(17824018122213720558, 649),
|
|
306
|
-
(7691821336090384658, 1058),
|
|
307
|
-
(15627606194869835864, 1006),
|
|
308
|
-
(6161241554519610597, 937),
|
|
309
|
-
(6941914075316668026, 399),
|
|
310
|
-
(1182793066038454380, 733),
|
|
311
|
-
(12071179740026769918, 1016),
|
|
312
|
-
(4347472036401076612, 1016),
|
|
313
|
-
(2230176819808087171, 1437),
|
|
314
|
-
(13643730949769321254, 970),
|
|
315
|
-
(11037552763304977452, 1497),
|
|
316
|
-
(5378144661922417606, 887),
|
|
317
|
-
(1077206070806454392, 474),
|
|
318
|
-
(15663206445926121842, 1020),
|
|
319
|
-
(10340633799421599932, 1189),
|
|
320
|
-
(10670100924980276327, 1005),
|
|
321
|
-
(17729339453970921664, 314),
|
|
322
|
-
(16991238872615146150, 790),
|
|
323
|
-
(6422874623524250261, 479),
|
|
324
|
-
(12672356704810770552, 442),
|
|
325
|
-
(11984928221549859605, 395),
|
|
326
|
-
(2097593348099185500, 491),
|
|
327
|
-
(14878246610844549137, 519),
|
|
328
|
-
(5632890640695056296, 698),
|
|
329
|
-
(234053196780936967, 485),
|
|
330
|
-
(6405742965701021702, 1168),
|
|
331
|
-
(10119588664293507636, 432),
|
|
332
|
-
(3677460465457318012, 1892),
|
|
333
|
-
(2929707338101168456, 1200),
|
|
334
|
-
(14759779960424595626, 492),
|
|
335
|
-
(8961005490888315294, 1076),
|
|
336
|
-
(7045320843275616092, 546),
|
|
337
|
-
(14573796348018082636, 613),
|
|
338
|
-
(5720125013745730749, 1003),
|
|
339
|
-
(9959758967528298632, 1240),
|
|
340
|
-
(5498194506803611575, 655),
|
|
341
|
-
(14533574346244646128, 685),
|
|
342
|
-
(2286118599908196562, 1132),
|
|
343
|
-
(12141987400064210298, 706),
|
|
344
|
-
(11697621655555146678, 262),
|
|
345
|
-
(4509236223063678303, 721),
|
|
346
|
-
(9379039799252626497, 1991),
|
|
347
|
-
(14161603951508589000, 1058),
|
|
348
|
-
(3798969362984554894, 1462),
|
|
349
|
-
(2208804812521734162, 1387),
|
|
350
|
-
(743230986619455593, 1117),
|
|
351
|
-
(10460176299449652894, 365),
|
|
352
|
-
(16295441167671743576, 426),
|
|
353
|
-
(12602762712196340732, 256),
|
|
354
|
-
(6892378923297184865, 815),
|
|
355
|
-
(2803535595082170474, 1100),
|
|
356
|
-
(12936956031161931870, 328),
|
|
357
|
-
(18083927691172312036, 703),
|
|
358
|
-
(17523284212269230251, 1225),
|
|
359
|
-
(12395604404862019884, 384),
|
|
360
|
-
(15603180924257441853, 991),
|
|
361
|
-
(10309388002691473494, 438),
|
|
362
|
-
(11759658943204820007, 1203),
|
|
363
|
-
(38352910123852128, 298),
|
|
364
|
-
(839329000209336340, 1032),
|
|
365
|
-
(17995146755519841483, 1323),
|
|
366
|
-
(11992699556916938274, 265),
|
|
367
|
-
(14564955722602338370, 1204),
|
|
368
|
-
(9433076059681066661, 269),
|
|
369
|
-
(4983236323095609658, 1054),
|
|
370
|
-
(3633433896241630446, 1351),
|
|
371
|
-
(1233903317720007796, 1725),
|
|
372
|
-
(15335462755167671769, 633),
|
|
373
|
-
(11585985329590265609, 297),
|
|
374
|
-
]
|
|
375
|
-
cases[key(4096, 123)] = [
|
|
376
|
-
(17640604251071308688, 5626),
|
|
377
|
-
(17640604251071308688, 6534),
|
|
378
|
-
(1164779717113740270, 5375),
|
|
379
|
-
(1630317330713120546, 2204),
|
|
380
|
-
(15925855439796383684, 7352),
|
|
381
|
-
(14038325076263464756, 4459),
|
|
382
|
-
(10372641652373760866, 2757),
|
|
383
|
-
(6632718265737316290, 4345),
|
|
384
|
-
(13547989595704043725, 13255),
|
|
385
|
-
(5085413808508269073, 6871),
|
|
386
|
-
(2088831145520463002, 1867),
|
|
387
|
-
(17282638805110740002, 7908),
|
|
388
|
-
(10392127899000403174, 4664),
|
|
389
|
-
(12682705380171701888, 3262),
|
|
390
|
-
(14163264652508939164, 4595),
|
|
391
|
-
(11317546923098927019, 10371),
|
|
392
|
-
(5442637979354971713, 5365),
|
|
393
|
-
(918741369407724947, 3523),
|
|
394
|
-
(11012502959421423036, 2886),
|
|
395
|
-
(16443206251033749990, 4470),
|
|
396
|
-
(18389377892984539132, 1777),
|
|
397
|
-
]
|
|
398
|
-
cases[key(3333, 456)] = [
|
|
399
|
-
(10244635572917292382, 5352),
|
|
400
|
-
(9863741455868196496, 3576),
|
|
401
|
-
(7958227187487219312, 11348),
|
|
402
|
-
(1568981245086988673, 4093),
|
|
403
|
-
(6960773682648885580, 3339),
|
|
404
|
-
(774338163733218710, 3524),
|
|
405
|
-
(8689733537919960031, 1741),
|
|
406
|
-
(227474149701075941, 1347),
|
|
407
|
-
(10343926834217379667, 2919),
|
|
408
|
-
(16005375745858244513, 3381),
|
|
409
|
-
(15597163692867778936, 2596),
|
|
410
|
-
(10144991532768329190, 1426),
|
|
411
|
-
(15692309460993287066, 2746),
|
|
412
|
-
(12579192060780867954, 876),
|
|
413
|
-
(15819814174051610080, 4398),
|
|
414
|
-
(9470794240134493114, 4224),
|
|
415
|
-
(1527989898970725766, 4315),
|
|
416
|
-
(17216215298576800968, 2680),
|
|
417
|
-
(2745509010730917144, 3990),
|
|
418
|
-
(11949739281024563184, 2157),
|
|
419
|
-
(8728826904842968300, 4092),
|
|
420
|
-
(11802567455667178519, 3547),
|
|
421
|
-
(16911338182963405550, 2591),
|
|
422
|
-
(5388599717664141562, 849),
|
|
423
|
-
(3598944074651431428, 4468),
|
|
424
|
-
(14136883845736820776, 6320),
|
|
425
|
-
(16089431095887575320, 2393),
|
|
426
|
-
(932034647479080538, 4950),
|
|
427
|
-
(1690856361285973629, 1591),
|
|
428
|
-
(1258510376350532739, 1315),
|
|
429
|
-
(12835826922199546104, 1612),
|
|
430
|
-
(1125375003867751948, 1729),
|
|
431
|
-
(6560578492574969505, 3981),
|
|
432
|
-
]
|
|
433
|
-
cases[key(7696, 789)] = [
|
|
434
|
-
(3635570818360047716, 7841),
|
|
435
|
-
(3361977302863881087, 12645),
|
|
436
|
-
(12589329716764299352, 7886),
|
|
437
|
-
(9249278391062916766, 8282),
|
|
438
|
-
(3136269063085371990, 2172),
|
|
439
|
-
(2076160877505623160, 3592),
|
|
440
|
-
(3919332495791756340, 7766),
|
|
441
|
-
(10241186054488990483, 5785),
|
|
442
|
-
(2179260573026396498, 5640),
|
|
443
|
-
(9176127053874656948, 4879),
|
|
444
|
-
(16197834508891865920, 8870),
|
|
445
|
-
(9292621146426491660, 8566),
|
|
446
|
-
(1003212569724862660, 6473),
|
|
447
|
-
(17552258689478972773, 3837),
|
|
448
|
-
(11098559764229607138, 8020),
|
|
449
|
-
(14721988269191742682, 2207),
|
|
450
|
-
(13044652610110219114, 5005),
|
|
451
|
-
]
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
__build_test_data()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|