<commit_before><!DOCTYPE HTML>
<html>
<!--
Copyright (c) 2012 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<head>
<title>Selection Analysis Tests</title>
<script src="/src/base.js"></script>
</head>
<body>
  <script>
    base.require('unittest');
    base.require('test_utils');
    base.require('timeline');
    base.require('analysis.selection_analysis');
    base.require('analysis.analysis_test_support');
    base.requireStylesheet('analysis.analysis_test_support');
  </script>
  <script>
    'use strict';

    function testSelectionAnalysisWithSingleSlice() {
      var data = tracing.createReferenceData(true);

      var selection = new tracing.TimelineSelection();
      data.t1track.selectByTitle('f', selection);

      var analysis = new tracing.SelectionAnalysis();
      analysis.selection = selection;

      var selectionEl = analysis;
      var sliceSelectionEl = selectionEl.children[0];
      var singleSliceEl = sliceSelectionEl.children[0];

      assertEquals(true, analysis instanceof tracing.SelectionAnalysis);
      assertEquals(true, sliceSelectionEl instanceof
          tracing.SliceSelectionAnalysis);
      assertEquals(1, sliceSelectionEl.children.length);
      assertEquals(4, singleSliceEl.children.length);

      this.addHTMLOutput(undefined, analysis);
    }

    function testSelectionAnalysisWithSingleSliceArgsAndCategory() {
      var data = tracing.createReferenceData(true);

      var selection = new tracing.TimelineSelection();
      data.t1track.selectByTitle('D', selection);

      var analysis = new tracing.SelectionAnalysis();
      analysis.selection = selection;

      var selectionEl = analysis;
      var sliceSelectionEl = selectionEl.children[0];
      var singleSliceEl = sliceSelectionEl.children[0];
      var categoryEl = singleSliceEl.children[1];
      var argEl1 = singleSliceEl.children[5];
      var argEl2 = singleSliceEl.children[6];

      assertEquals(true, analysis instanceof tracing.SelectionAnalysis);
      assertEquals(true, sliceSelectionEl instanceof
          tracing.SliceSelectionAnalysis);
      assertEquals(true, singleSliceEl instanceof
          tracing.SingleSliceSelectionAnalysis);
      assertEquals(1, sliceSelectionEl.children.length);
      assertEquals(7, singleSliceEl.children.length);

      this.addHTMLOutput(undefined, analysis);
    }

    function testSelectionAnalysisWithSlicesAndCounters() {

      var data = tracing.createReferenceData(true);

      var selection = new tracing.TimelineSelection();
      data.t1track.selectByTitle('b', selection);
      selection.addCounterSample(data.ctr1track, data.ctr1track.counter, 0);

      var analysis = new tracing.SelectionAnalysis();
      analysis.selection = selection;

      var selectionEl = analysis;
      var sliceSelectionEl = selectionEl.children[0];
      var counterSelectionEl = selectionEl.children[1];

      assertEquals(true, sliceSelectionEl instanceof
          tracing.SliceSelectionAnalysis);
      assertEquals(true, counterSelectionEl instanceof
          tracing.CounterSelectionAnalysis);
      assertEquals(2, selectionEl.children.length);
      assertEquals(6, sliceSelectionEl.children.length);
      assertEquals(2, counterSelectionEl.children.length);

      this.addHTMLOutput(undefined, analysis);

    }
<commit_msg>Correct selection_analysis_test after groups-totals-summary structure update<commit_after><!DOCTYPE HTML>
<html>
<!--
Copyright (c) 2012 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<head>
<title>Selection Analysis Tests</title>
<script src="/src/base.js"></script>
</head>
<body>
  <script>
    base.require('unittest');
    base.require('test_utils');
    base.require('timeline');
    base.require('analysis.selection_analysis');
    base.require('analysis.analysis_test_support');
    base.requireStylesheet('analysis.analysis_test_support');
  </script>
  <script>
    'use strict';

    function testSelectionAnalysisWithSingleSlice() {
      var data = tracing.createReferenceData(true);

      var selection = new tracing.TimelineSelection();
      data.t1track.selectByTitle('f', selection);

      var analysis = new tracing.SelectionAnalysis();
      analysis.selection = selection;

      var selectionEl = analysis;
      var sliceSelectionEl = selectionEl.children[0];
      var singleSliceEl = sliceSelectionEl.children[0];

      assertEquals(true, analysis instanceof tracing.SelectionAnalysis);
      assertEquals(true, sliceSelectionEl instanceof
          tracing.SliceSelectionAnalysis);
      assertEquals(1, sliceSelectionEl.children.length);
      assertEquals(4, singleSliceEl.children.length);

      this.addHTMLOutput(undefined, analysis);
    }

    function testSelectionAnalysisWithSingleSliceArgsAndCategory() {
      var data = tracing.createReferenceData(true);

      var selection = new tracing.TimelineSelection();
      data.t1track.selectByTitle('D', selection);

      var analysis = new tracing.SelectionAnalysis();
      analysis.selection = selection;

      var selectionEl = analysis;
      var sliceSelectionEl = selectionEl.children[0];
      var singleSliceEl = sliceSelectionEl.children[0];
      var categoryEl = singleSliceEl.children[1];
      var argEl1 = singleSliceEl.children[5];
      var argEl2 = singleSliceEl.children[6];

      assertEquals(true, analysis instanceof tracing.SelectionAnalysis);
      assertEquals(true, sliceSelectionEl instanceof
          tracing.SliceSelectionAnalysis);
      assertEquals(true, singleSliceEl instanceof
          tracing.SingleSliceSelectionAnalysis);
      assertEquals(1, sliceSelectionEl.children.length);
      assertEquals(7, singleSliceEl.children.length);

      this.addHTMLOutput(undefined, analysis);
    }

    function testSelectionAnalysisWithSlicesAndCounters() {

      var data = tracing.createReferenceData(true);

      var selection = new tracing.TimelineSelection();
      data.t1track.selectByTitle('b', selection);
      selection.addCounterSample(data.ctr1track, data.ctr1track.counter, 0);

      var analysis = new tracing.SelectionAnalysis();
      analysis.selection = selection;

      var selectionEl = analysis;
      var sliceSelectionEl = selectionEl.children[0];
      var counterSelectionEl = selectionEl.children[1];

      assertEquals(true, sliceSelectionEl instanceof
          tracing.SliceSelectionAnalysis);
      assertEquals(true, counterSelectionEl instanceof
          tracing.CounterSelectionAnalysis);
      assertEquals(2, selectionEl.children.length);
      assertEquals(3, sliceSelectionEl.children.length);
      assertEquals(2, counterSelectionEl.children.length);

      this.addHTMLOutput(undefined, analysis);

    }

{'fraction_non_alphanumeric': 0.09768861753161796, 'fraction_numerical': 0.008140718127634831, 'mean_word_length': 3.907275320970043, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4542812', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1716, 'n_words': 381}