Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: tools/cygprofile/check_orderfile_unittest.py

Issue 891713002: Script checking that the observed function order matches an orderfile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/cygprofile/check_orderfile.py ('k') | tools/cygprofile/patch_orderfile.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import unittest
7
8 import check_orderfile
9 import symbol_extractor
10
11
12 class TestCheckOrderFile(unittest.TestCase):
13 _SYMBOL_INFOS = [symbol_extractor.SymbolInfo('first', 0x1, 0, ''),
14 symbol_extractor.SymbolInfo('second', 0x2, 0, ''),
15 symbol_extractor.SymbolInfo('notProfiled', 0x4, 0, ''),
16 symbol_extractor.SymbolInfo('third', 0x3, 0, ''),]
17
18 def testMatchesSymbols(self):
19 symbols = ['first', 'second', 'third']
20 (misordered_pairs_count, matched_count, missing_count) = (
21 check_orderfile._CountMisorderedSymbols(symbols, self._SYMBOL_INFOS))
22 self.assertEquals(
23 (misordered_pairs_count, matched_count, missing_count), (0, 3, 0))
24
25 def testMissingMatches(self):
26 symbols = ['second', 'third', 'other', 'first']
27 (_, matched_count, unmatched_count) = (
28 check_orderfile._CountMisorderedSymbols(symbols, self._SYMBOL_INFOS))
29 self.assertEquals(matched_count, 3)
30 self.assertEquals(unmatched_count, 1)
31
32 def testNoUnorderedSymbols(self):
33 symbols = ['first', 'other', 'second', 'third', 'noMatchEither']
34 (misordered_pairs_count, _, _) = (
35 check_orderfile._CountMisorderedSymbols(symbols, self._SYMBOL_INFOS))
36 self.assertEquals(misordered_pairs_count, 0)
37
38 def testUnorderedSymbols(self):
39 symbols = ['first', 'other', 'third', 'second', 'noMatchEither']
40 (misordered_pairs_count, _, _) = (
41 check_orderfile._CountMisorderedSymbols(symbols, self._SYMBOL_INFOS))
42 self.assertEquals(misordered_pairs_count, 1)
43
44
45 if __name__ == '__main__':
46 unittest.main()
OLDNEW
« no previous file with comments | « tools/cygprofile/check_orderfile.py ('k') | tools/cygprofile/patch_orderfile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698