<commit_before>(function(window) {

  module('Benchmark');

  test('Benchmark.platform', function() {
    equals(navigator.userAgent, String(Benchmark.platform), 'default value');
  });

  if (window.require != null) {
    test('require("benchmark")', function() {
      equals((Benchmark2 || { }).version, Benchmark2.version, 'require("benchmark")');
    });

    test('require("platform")', function() {
      var bench = Benchmark2 || { },
          platform = bench.platform || { };
      equals(typeof platform.name, 'string', 'auto required');
    });
  }

  /*--------------------------------------------------------------------------*/

  module('Benchmark.indexOf');

  test('basic', function() {
    var o = ['a', 'b', 'c'];<commit_msg>benchmark: Add Benchmark.each unit tests. [jddalton]<commit_after>(function(window) {

  module('Benchmark');

  test('Benchmark.platform', function() {
    equals(navigator.userAgent, String(Benchmark.platform), 'default value');
  });

  if (window.require != null) {
    test('require("benchmark")', function() {
      equals((Benchmark2 || { }).version, Benchmark2.version, 'require("benchmark")');
    });

    test('require("platform")', function() {
      var bench = Benchmark2 || { },
          platform = bench.platform || { };
      equals(typeof platform.name, 'string', 'auto required');
    });
  }

  /*--------------------------------------------------------------------------*/

  module('Benchmark.each');

  test('basic', function() {
    var args,
        values = [],
        slice = [].slice,
        o = ['a', 'b', 'c'];

    var result = Benchmark.each(o, function(value, index) {
      args || (args = slice.call(arguments));
      values.push(value);
    });

    ok(o === result, 'object returned');
    deepEqual(values, ['a', 'b', 'c'], 'values');
    deepEqual(args, ['a', 0, o], 'passed arguments to callback');
    values.length = 0;

    Benchmark.each(o, function(value, index) {
      return index == 2 ? false : values.push(value);
    });

    deepEqual(values, ['a', 'b'], 'exit early');
  });

  test('array-like-object', function() {
    var values = [],
        o = { '1': 'b', '2': 'c', 'length': 3 };

    Benchmark.each(o, function(value) {
      values.push(value);
    });

    deepEqual(values, ['b', 'c'], 'basic');
  });

  /*--------------------------------------------------------------------------*/

  module('Benchmark.indexOf');

  test('basic', function() {
    var o = ['a', 'b', 'c'];
{'fraction_non_alphanumeric': 0.284967845659164, 'fraction_numerical': 0.00482315112540193, 'mean_word_length': 2.2451108213820077, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6109295', 'n_tokens_mistral': 759, 'n_tokens_neox': 723, 'n_words': 149}