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

Side by Side Diff: tools/ignition/bytecode_dispatches_report_test.py

Issue 1869423002: [Interpreter] Add visualization tool for Ignition dispatch counters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Extracting code to test, adding unit tests. Created 4 years, 8 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/ignition/bytecode_dispatches_report.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 the V8 project 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.
4
5 import bytecode_dispatches_report as bdr
6 import unittest
7
8
9 class BytecodeDispatchesReportTest(unittest.TestCase):
10 def test_find_top_counters(self):
11 top_counters = bdr.find_top_counters({
12 "a": {"a": 10, "b": 8, "c": 99},
13 "b": {"a": 1, "b": 4, "c": 1},
14 "c": {"a": 42, "b": 3, "c": 7}}, 5)
15 self.assertListEqual(top_counters, [
16 ('a', 'c', 99),
17 ('c', 'a', 42),
18 ('a', 'a', 10),
19 ('a', 'b', 8),
20 ('c', 'c', 7)])
21
rmcilroy 2016/04/12 16:25:52 two newlines
Stefano Sanfilippo 2016/04/12 16:56:32 These are methods of the test class, am I wrong in
rmcilroy 2016/04/13 08:36:05 Sorry you are right.
22 def test_build_counters_matrix(self):
23 counters_matrix, xlabels, ylabels = bdr.build_counters_matrix({
24 "a": {"a": 10, "b": 8, "c": 7},
25 "b": {"a": 1, "c": 4},
26 "c": {"a": 42, "b": 12, "c": 99}})
27 self.assertTrue((counters_matrix == [[42, 12, 99],
28 [ 1, 0, 4],
29 [10, 8, 7]]).all())
30 self.assertListEqual(xlabels, ['a', 'b', 'c'])
31 self.assertListEqual(ylabels, ['c', 'b', 'a'])
OLDNEW
« no previous file with comments | « tools/ignition/bytecode_dispatches_report.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698