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

Side by Side Diff: tracing/tracing/base/statistics_test.html

Issue 2364243002: Serialize Histograms more efficiently. (Closed)
Patch Set: . Created 4 years, 2 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 | « tracing/tracing/base/statistics.html ('k') | tracing/tracing/value/histogram.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 <link rel="import" href="/tracing/base/statistics.html"> 7 <link rel="import" href="/tracing/base/statistics.html">
8 <script> 8 <script>
9 'use strict'; 9 'use strict';
10 10
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 var durationsC = [1, 2, 1, 2, 1]; 462 var durationsC = [1, 2, 1, 2, 1];
463 463
464 var dA = Statistics.durationsDiscrepancy(durationsA); 464 var dA = Statistics.durationsDiscrepancy(durationsA);
465 var dB = Statistics.durationsDiscrepancy(durationsB); 465 var dB = Statistics.durationsDiscrepancy(durationsB);
466 var dC = Statistics.durationsDiscrepancy(durationsC); 466 var dC = Statistics.durationsDiscrepancy(durationsC);
467 467
468 assert.isBelow(dA, dB); 468 assert.isBelow(dA, dB);
469 assert.isBelow(dB, dC); 469 assert.isBelow(dB, dC);
470 }); 470 });
471 471
472 test('uniformlySampleArray', function() {
473 var samples = ['A', 'B', 'C', 'D', 'E'];
474 for (var i = samples.length; i >= 0; --i) {
475 Statistics.uniformlySampleArray(samples, i);
476 assert.lengthOf(samples, i);
477 }
478 });
479
472 test('uniformlySampleStream', function() { 480 test('uniformlySampleStream', function() {
473 var samples = []; 481 var samples = [];
474 Statistics.uniformlySampleStream(samples, 1, 'A', 5); 482 Statistics.uniformlySampleStream(samples, 1, 'A', 5);
475 assert.deepEqual(['A'], samples); 483 assert.deepEqual(['A'], samples);
476 Statistics.uniformlySampleStream(samples, 2, 'B', 5); 484 Statistics.uniformlySampleStream(samples, 2, 'B', 5);
477 Statistics.uniformlySampleStream(samples, 3, 'C', 5); 485 Statistics.uniformlySampleStream(samples, 3, 'C', 5);
478 Statistics.uniformlySampleStream(samples, 4, 'D', 5); 486 Statistics.uniformlySampleStream(samples, 4, 'D', 5);
479 Statistics.uniformlySampleStream(samples, 5, 'E', 5); 487 Statistics.uniformlySampleStream(samples, 5, 'E', 5);
480 assert.deepEqual(['A', 'B', 'C', 'D', 'E'], samples); 488 assert.deepEqual(['A', 'B', 'C', 'D', 'E'], samples);
481 489
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 // Empty samples should not be comparable. 566 // Empty samples should not be comparable.
559 results = Statistics.mwu(emptySample, emptySample); 567 results = Statistics.mwu(emptySample, emptySample);
560 assert(isNaN(results.p)); 568 assert(isNaN(results.p));
561 569
562 // The result of comparing a sample against an empty sample should not be a 570 // The result of comparing a sample against an empty sample should not be a
563 // valid p value. NOTE: The current implementation returns 0, it is up to 571 // valid p value. NOTE: The current implementation returns 0, it is up to
564 // the caller to interpret this. 572 // the caller to interpret this.
565 results = Statistics.mwu(normallyDistributedSample, emptySample); 573 results = Statistics.mwu(normallyDistributedSample, emptySample);
566 assert(!results.p); 574 assert(!results.p);
567 }); 575 });
568
569 }); 576 });
570 </script> 577 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/base/statistics.html ('k') | tracing/tracing/value/histogram.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698