Reland the ULONG -> SIZE_T change from 317177
[chromium-blink-merge.git] / tools / auto_bisect / bisect_state_test.py
blob0630fab5eb749ace83d464e3d6eb13d20c053f6f
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import unittest
7 from bisect_state import BisectState
10 class BisectStateTest(unittest.TestCase):
12 def testCreatesRevisionsStateAfterAReferenceRevision(self):
13 bisect_state = BisectState('chromium', ['a', 'b', 'c', 'd'])
14 bisect_state.CreateRevisionStatesAfter('webkit', [1, 2, 3], 'chromium', 'b')
15 bisect_state.CreateRevisionStatesAfter('v8', [100, 200], 'webkit', 2)
17 actual_revisions = bisect_state.GetRevisionStates()
18 expected_revisions = [('chromium', 'a'), ('chromium', 'b'), ('webkit', 1),
19 ('webkit', 2), ('v8', 100), ('v8', 200),
20 ('webkit', 3), ('chromium', 'c'), ('chromium', 'd')]
21 self.assertEqual(len(expected_revisions), len(actual_revisions))
22 for i in xrange(len(actual_revisions)):
23 self.assertEqual(i, actual_revisions[i].index)
24 self.assertEqual(expected_revisions[i][0], actual_revisions[i].depot)
25 self.assertEqual(expected_revisions[i][1], actual_revisions[i].revision)
27 # TODO(sergiyb): More tests for the remaining functions.
30 if __name__ == '__main__':
31 unittest.main()