~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__groupcompress.py

Do a lot of renaming.

Change the config from 'max_entries_per_source' to 'max_bytes_to_index'.
I'm not 100% happy, because it is max_bytes_to_delta_index_per_source, but
that is just getting rediculously long.
Internally, change the code to take a 'settings' function, which currently
returns a tuple. I'm thinking to change it to a dict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
282
282
                        for idx, (text_offset, hash_val)
283
283
                         in enumerate(entry_list)
284
284
                         if text_offset != 0 or hash_val != 0]
285
 
        rabin_hash = self._gc_module.rabin_hash
 
285
        rabin_hash = self._gc_module._rabin_hash
286
286
        self.assertEqual([(8, 16, rabin_hash(_text1[1:17])),
287
287
                          (25, 48, rabin_hash(_text1[33:49])),
288
288
                          (34, 32, rabin_hash(_text1[17:33])),
305
305
                        for idx, (text_offset, hash_val)
306
306
                         in enumerate(entry_list)
307
307
                         if text_offset != 0 or hash_val != 0]
308
 
        rabin_hash = self._gc_module.rabin_hash
 
308
        rabin_hash = self._gc_module._rabin_hash
309
309
        self.assertEqual([(8, 16, rabin_hash(_text1[1:17])),
310
310
                          (9, start2+16, rabin_hash(_text2[1:17])),
311
311
                          (25, 48, rabin_hash(_text1[33:49])),
332
332
        self.assertTrue(di._has_index())
333
333
        self.assertEqual('N\x90/\x1fdiffer from\nagainst other text\n', delta)
334
334
 
335
 
    def test_add_source_max_entries(self):
 
335
    def test_add_source_max_bytes_to_index(self):
336
336
        di = self._gc_module.DeltaIndex()
337
 
        di._max_entries_per_source = 3
 
337
        di._max_bytes_to_index = 3*16
338
338
        di.add_source(_text1, 0) # (77 bytes -1) // 3 = 25 byte stride
339
339
        di.add_source(_text3, 3) # (135 bytes -1) // 3 = 44 byte stride
340
340
        start2 = len(_text1) + 3
344
344
        just_entries = sorted([(text_offset, hash_val)
345
345
                               for text_offset, hash_val in entry_list
346
346
                                if text_offset != 0 or hash_val != 0])
347
 
        rabin_hash = self._gc_module.rabin_hash
 
347
        rabin_hash = self._gc_module._rabin_hash
348
348
        self.assertEqual([(25, rabin_hash(_text1[10:26])),
349
349
                          (50, rabin_hash(_text1[35:51])),
350
350
                          (75, rabin_hash(_text1[60:76])),