~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-07-13 07:00:24 UTC
  • mto: (2592.5.3 pack-repository)
  • mto: This revision was merged to the branch mainline in revision 2624.
  • Revision ID: robertc@robertcollins.net-20070713070024-ji0p81rkb5aviq9p
Multi node sort order is defined.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        self.assertEqual("Bazaar Graph Index 1\nnode_ref_lists=0\n"
50
50
            "akey\0\0data\n\n", contents)
51
51
 
 
52
    def test_build_index_two_nodes_sorted_reverse(self):
 
53
        # the highest sorted node comes first.
 
54
        builder = GraphIndexBuilder()
 
55
        # use three to have a good chance of glitching dictionary hash
 
56
        # lookups etc. Insert in randomish order that is not correct
 
57
        # and not the reverse of the correct order.
 
58
        builder.add_node('2001', (), 'data')
 
59
        builder.add_node('2000', (), 'data')
 
60
        builder.add_node('2002', (), 'data')
 
61
        stream = builder.finish()
 
62
        contents = stream.read()
 
63
        self.assertEqual("Bazaar Graph Index 1\nnode_ref_lists=0\n"
 
64
            "2002\0\0data\n"
 
65
            "2001\0\0data\n"
 
66
            "2000\0\0data\n"
 
67
            "\n", contents)
 
68
 
52
69
    def test_add_node_bad_key(self):
53
70
        builder = GraphIndexBuilder()
54
71
        for bad_char in '\t\n\x0b\x0c\r\x00 ':