text: // Generated by CoffeeScript 1.4.0
  var engine, fs, minimized_engine, path, regular_engine, run_all_case_dirs, run_case_dir, run_multiple_runs;
  
  engine = require('../lib/engine').engine;
  
  fs = require('fs');
  
  path = require('path');
  
  regular_engine = new engine({
    verbose: false,
    prettyPrintErrors: false
  });
  
  minimized_engine = new engine({
    verbose: false,
    prettyPrintErrors: false,
    minimize: true
  });
  
  run_case_dir = function(eng, dir, cb) {
    var d, existsSync, expected, vars;
    expected = fs.readFileSync("" + dir + "/output.toffee", "utf8");
    existsSync = path.existsSync != null ? path.existsSync : fs.existsSync;
    if (existsSync("" + dir + "/vars.js")) {
      vars = fs.readFileSync("" + dir + "/vars.js", "utf8");
      vars = eval("(" + vars + ")");
    } else {
      vars = {};
    }
    d = Date.now();
    return eng.run("" + dir + "/input.toffee", vars, function(err, res) {
      var time_ms;
      time_ms = Date.now() - d;
      if (err) {
        return cb(err, time_ms);
      } else {
        if (res !== expected) {
          return cb(("Failure in case " + dir + ".") + ("\n\nExpected\n=====\n" + expected + "\n=====") + ("\nGot\n=====\n" + res + "\n=====\n"), time_ms);
        } else {
          return cb(null, time_ms);
        }
      }
    });
  };
  
  run_all_case_dirs = function(eng, cb) {
    var case_dirs, countdown, dir, time_ms, _i, _len, _results;
    time_ms = 0;
    case_dirs = fs.readdirSync("" + __dirname + "/cases/");
    countdown = case_dirs.length;
    _results = [];
    for (_i = 0, _len = case_dirs.length; _i < _len; _i++) {
      dir = case_dirs[_i];
      _results.push(run_case_dir(eng, "" + __dirname + "/cases/" + dir, function(err, ms) {
        countdown--;
        time_ms += ms;
        if (err) {
          console.log(err);
          process.exit(1);
        }
        if (countdown === 0) {
          return cb(null, time_ms, case_dirs.length);
        }
      }));
    }
    return _results;
  };
  
  run_multiple_runs = function(eng, num_runs, cb) {
    var countdown, i, times, total_tests, total_time, _i, _results;
    times = [];
    countdown = num_runs;
    total_time = 0;
    total_tests = 0;
    _results = [];
    for (i = _i = 0; 0 <= num_runs ? _i < num_runs : _i > num_runs; i = 0 <= num_runs ? ++_i : --_i) {
      _results.push(run_all_case_dirs(regular_engine, function(err, time, tests_run) {
        countdown--;
        total_time += time;
        total_tests += tests_run;
        if (countdown === 0) {
          return cb(null, total_time, total_tests);
        }
      }));
    }
    return _results;
  };
  
  run_all_case_dirs(regular_engine, function(err, time, tests_run) {
    console.log("Regular Engine: SUCCESS for " + tests_run + " cold tests in " + time + "ms (" + ((time / tests_run).toFixed(2)) + "ms/test)");
    return run_multiple_runs(regular_engine, 30, function(err, time, tests_run) {
      console.log("Regular Engine: SUCCESS for " + tests_run + " hot tests in " + time + "ms (" + ((time / tests_run).toFixed(2)) + "ms/test)");
      return run_all_case_dirs(minimized_engine, function(err, time, tests_run) {
        console.log("Minimized (browser) Engine: SUCCESS for " + tests_run + " cold tests in " + time + "ms (" + ((time / tests_run).toFixed(2)) + "ms/test)");
        return run_multiple_runs(minimized_engine, 30, function(err, time, tests_run) {
          console.log("Minimized (browser) Engine: SUCCESS for " + tests_run + " hot tests in " + time + "ms (" + ((time / tests_run).toFixed(2)) + "ms/test)");
          return process.exit(0);
        });
      });
    });
  });
  