<commit_before>var parallel = require('../')
var test = require('tape')

test('functions run in parallel', function (t) {
  t.plan(5)

  var tasks = [
    function (cb) {
      setTimeout(function () {
        t.pass('cb 1')
        cb(null)
      }, 100)
    },
    function (cb) {
      setTimeout(function () {
        t.pass('cb 2')
        cb(null)
      }, 100)
    },
    function (cb) {
      setTimeout(function () {
        t.pass('cb 3')
        cb(null)
      }, 100)
    }
  ]

  var startTime = Date.now()
  parallel(tasks, function (err) {
    t.error(err)
    t.ok(Date.now() - startTime < 300)
  })
})

test('functions that return results', function (t) {
  t.plan(4)

  var tasks = [
    function (cb) {
      t.pass('cb 1')
      cb(null, 1)
    },
    function (cb) {
      t.pass('cb 2')
      cb(null, 2)
    }
  ]

  parallel(tasks, function (err, results) {
    t.error(err)
    t.deepEqual(results, [1, 2])
  })
})

test('functions that return results preserve order', function (t) {<commit_msg>tests: don't rely on cpu speed for tests to pass<commit_after>var parallel = require('../')
var test = require('tape')

test('functions run in parallel', function (t) {
  t.plan(4)

  var tasks = [
    function (cb) {
      setTimeout(function () {
        t.pass('cb 1')
        cb(null)
      }, 100)
    },
    function (cb) {
      setTimeout(function () {
        t.pass('cb 2')
        cb(null)
      }, 100)
    },
    function (cb) {
      setTimeout(function () {
        t.pass('cb 3')
        cb(null)
      }, 100)
    }
  ]

  var startTime = Date.now()
  parallel(tasks, function (err) {
    t.error(err)
  })
})

test('functions that return results', function (t) {
  t.plan(4)

  var tasks = [
    function (cb) {
      t.pass('cb 1')
      cb(null, 1)
    },
    function (cb) {
      t.pass('cb 2')
      cb(null, 2)
    }
  ]

  parallel(tasks, function (err, results) {
    t.error(err)
    t.deepEqual(results, [1, 2])
  })
})

test('functions that return results preserve order', function (t) {
{'fraction_non_alphanumeric': 0.16797642436149313, 'fraction_numerical': 0.02111984282907662, 'mean_word_length': 2.0863636363636364, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4350694', 'n_tokens_mistral': 756, 'n_tokens_neox': 715, 'n_words': 172}