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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/ignition/bytecode_dispatches_report.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ignition/bytecode_dispatches_report_test.py
diff --git a/tools/ignition/bytecode_dispatches_report_test.py b/tools/ignition/bytecode_dispatches_report_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..c31bb862cba88d59b63958927dce25f17174bcd4
--- /dev/null
+++ b/tools/ignition/bytecode_dispatches_report_test.py
@@ -0,0 +1,31 @@
+# Copyright 2016 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import bytecode_dispatches_report as bdr
+import unittest
+
+
+class BytecodeDispatchesReportTest(unittest.TestCase):
+ def test_find_top_counters(self):
+ top_counters = bdr.find_top_counters({
+ "a": {"a": 10, "b": 8, "c": 99},
+ "b": {"a": 1, "b": 4, "c": 1},
+ "c": {"a": 42, "b": 3, "c": 7}}, 5)
+ self.assertListEqual(top_counters, [
+ ('a', 'c', 99),
+ ('c', 'a', 42),
+ ('a', 'a', 10),
+ ('a', 'b', 8),
+ ('c', 'c', 7)])
+
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.
+ def test_build_counters_matrix(self):
+ counters_matrix, xlabels, ylabels = bdr.build_counters_matrix({
+ "a": {"a": 10, "b": 8, "c": 7},
+ "b": {"a": 1, "c": 4},
+ "c": {"a": 42, "b": 12, "c": 99}})
+ self.assertTrue((counters_matrix == [[42, 12, 99],
+ [ 1, 0, 4],
+ [10, 8, 7]]).all())
+ self.assertListEqual(xlabels, ['a', 'b', 'c'])
+ self.assertListEqual(ylabels, ['c', 'b', 'a'])
« 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