~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_index.py

  • Committer: Robert Collins
  • Date: 2007-10-05 04:47:47 UTC
  • mto: (2592.3.168 repository)
  • mto: This revision was merged to the branch mainline in revision 2908.
  • Revision ID: robertc@robertcollins.net-20071005044747-lgtgu13o87egfupg
* ``bzrlib.index.GraphIndex`` now requires a size parameter to the
  constructor, for enabling bisection searches. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
358
358
            builder.add_node(key, value, references)
359
359
        stream = builder.finish()
360
360
        trans = self.get_transport()
361
 
        trans.put_file('index', stream)
362
 
        return GraphIndex(trans, 'index')
 
361
        size = trans.put_file('index', stream)
 
362
        return GraphIndex(trans, 'index', size)
363
363
 
364
364
    def test_open_bad_index_no_error(self):
365
365
        trans = self.get_transport()
366
366
        trans.put_bytes('name', "not an index\n")
367
 
        index = GraphIndex(trans, 'name')
 
367
        index = GraphIndex(trans, 'name', 13)
368
368
 
369
369
    def test_iter_all_entries_empty(self):
370
370
        index = self.make_index()
494
494
    def test_validate_bad_index_errors(self):
495
495
        trans = self.get_transport()
496
496
        trans.put_bytes('name', "not an index\n")
497
 
        index = GraphIndex(trans, 'name')
 
497
        index = GraphIndex(trans, 'name', 13)
498
498
        self.assertRaises(errors.BadIndexFormatSignature, index.validate)
499
499
 
500
500
    def test_validate_bad_node_refs(self):
539
539
            builder.add_node(key, value, references)
540
540
        stream = builder.finish()
541
541
        trans = self.get_transport()
542
 
        trans.put_file(name, stream)
543
 
        return GraphIndex(trans, name)
 
542
        size = trans.put_file(name, stream)
 
543
        return GraphIndex(trans, name, size)
544
544
 
545
545
    def test_open_missing_index_no_error(self):
546
546
        trans = self.get_transport()
547
 
        index1 = GraphIndex(trans, 'missing')
 
547
        index1 = GraphIndex(trans, 'missing', 100)
548
548
        index = CombinedGraphIndex([index1])
549
549
 
550
550
    def test_add_index(self):
677
677
    def test_validate_bad_child_index_errors(self):
678
678
        trans = self.get_transport()
679
679
        trans.put_bytes('name', "not an index\n")
680
 
        index1 = GraphIndex(trans, 'name')
 
680
        index1 = GraphIndex(trans, 'name', 13)
681
681
        index = CombinedGraphIndex([index1])
682
682
        self.assertRaises(errors.BadIndexFormatSignature, index.validate)
683
683