<commit_before>/**
 * TestReport
 *   testCases: [
 *     {
 *        suite: 'Test case suite',
 *        name: 'Test case name',
 *        executions: [
   *        {
   *          build: build,
   *          passing: boolean
   *        }
 *        ]
 *     }
 *   ]
 */

(function (window, angular) {
  'use strict';

  String.prototype.hashCode = function() {
    var hash = 0, i, chr;
    if (this.length === 0) return hash;
    for (i = 0; i < this.length; i++) {
      chr   = this.charCodeAt(i);
      hash  = ((hash << 5) - hash) + chr;
      hash |= 0; // Convert to 32bit integer
    }
    return hash;
  };

  function testUrlName(name) {
    return name.replace(/\s/g, '_').replace(/[^a-zA-Z\d]/g, '_');
  }

  function TestCaseExecution(execution, build) {
    this.name = execution.name;
    this.className = execution.className;
    this.execution = execution;
    this.error = execution.errorDetails || execution.stderr;
    this.errorStackTrace = execution.errorStackTrace;
    this.stderr = execution.stderr;
    this.stdout = execution.stdout;
    this.duration = execution.duration;
    this.build = build;
    //
    this.id = (build.url + this.className + this.name).hashCode();

    var urlComps = this.execution.className.split('.');
    var packageName = urlComps.splice(0, urlComps.length - 1).join('.') || '(root)';
    var className = urlComps[urlComps.length - 1];

    this.url = this.build.url + 'testReport/' + packageName + '/' + className.replace(/\//g, '_').replace(/^$/, '(empty)') + "/" + testUrlName(this.execution.name);
    this.passing = (this.execution.status === 'PASSED' || this.execution.status === 'FIXED');
    this.skipped = this.execution.status === 'SKIPPED';
  }

  function TestCase(testCase, build, job) {
    this.job = job;
    this.name = testCase.name;
    this.className = testCase.className;
    this.urlName = testUrlName(this.name);

    var urlComps = testCase.className.split('.');
    var packageName = urlComps.splice(0, urlComps.length - 1).join('.') || '(root)';
    var className = urlComps[urlComps.length - 1];<commit_msg>Test case id generated based on job,suite,name and duration - not ideal but helps when there are two test cases with the same name reported<commit_after>/**
 * TestReport
 *   testCases: [
 *     {
 *        suite: 'Test case suite',
 *        name: 'Test case name',
 *        executions: [
   *        {
   *          build: build,
   *          passing: boolean
   *        }
 *        ]
 *     }
 *   ]
 */

(function (window, angular) {
  'use strict';

  String.prototype.hashCode = function() {
    var hash = 0, i, chr;
    if (this.length === 0) return hash;
    for (i = 0; i < this.length; i++) {
      chr   = this.charCodeAt(i);
      hash  = ((hash << 5) - hash) + chr;
      hash |= 0; // Convert to 32bit integer
    }
    return hash;
  };

  function testUrlName(name) {
    return name.replace(/\s/g, '_').replace(/[^a-zA-Z\d]/g, '_');
  }

  function TestCaseExecution(execution, build) {
    this.name = execution.name;
    this.className = execution.className;
    this.execution = execution;
    this.error = execution.errorDetails || execution.stderr;
    this.errorStackTrace = execution.errorStackTrace;
    this.stderr = execution.stderr;
    this.stdout = execution.stdout;
    this.duration = execution.duration;
    this.build = build;
    //
    this.id = (build.url + this.className + this.name + execution.duration.toString()).hashCode();

    var urlComps = this.execution.className.split('.');
    var packageName = urlComps.splice(0, urlComps.length - 1).join('.') || '(root)';
    var className = urlComps[urlComps.length - 1];

    this.url = this.build.url + 'testReport/' + packageName + '/' + className.replace(/\//g, '_').replace(/^$/, '(empty)') + "/" + testUrlName(this.execution.name);
    this.passing = (this.execution.status === 'PASSED' || this.execution.status === 'FIXED');
    this.skipped = this.execution.status === 'SKIPPED';
  }

  function TestCase(testCase, build, job) {
    this.job = job;
    this.name = testCase.name;
    this.className = testCase.className;
    this.urlName = testUrlName(this.name);

    var urlComps = testCase.className.split('.');
    var packageName = urlComps.splice(0, urlComps.length - 1).join('.') || '(root)';
    var className = urlComps[urlComps.length - 1];
{'fraction_non_alphanumeric': 0.16574585635359115, 'fraction_numerical': 0.005985267034990792, 'mean_word_length': 2.632943143812709, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '6176040', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1402, 'n_words': 301}