<commit_before>"use strict";

function getTests(){
  var tests = [];
  tests = tests.concat(getArenaTests());
  document.getElementById("testResults").innerHTML = "found " + tests.length + " tests";
  return tests;
}

function runTests(tests, results){
  if(tests === undefined){
    tests = getTests();
  }
  if(results === undefined){
    results = [];
  }
  if(tests.length == 0){
    showTestResults(results);
    return;
  }

  var result;
  try{
    result = tests[0].call(null);
  }catch(err){
    result = tests[0].toString().split("(")[0] + " caused error: " + err.message;
  }
  var newResults = results.slice(0);
  if(result != true){
    newResults.push(result);
  }
  return runTests(tests.slice(1), newResults);
}

function isFunction(fun){
  var obj = {};
  return fun && obj.toString.call(fun) === '[object Function]';
}

function showTestResults(results){
  testDiv = document.getElementById("testResults");
  if(results.length == 0){
    testDiv.innerHTML += "<br>All Tests Passed";
  }else{
    testDiv.innerHTML += "<br>Test failures:<br>";
    showTestFailures(testDiv, results);
  }
}

function showTestFailures(div, failures){
  if(failures.length == 0){
    return;
  }
  div.innerHTML += failures[0] + "<br>";
  showTestFailures(div, failures.slice(1));
}

function arraysEqual(array1, array2){
  if(array1.length == 0 && array2.length == 0){
    return true;
  }else if(array1.length == 0 || array2.length == 0){
    return false;
  }else if(array1[0] == array2[0]){
    return arraysEqual(array1.slice(1), array2.slice(1));
  }else{
    return false;
  }
}

function pointsEqual(point1, point2){
  return point1.x == point2.x && point1.y == point2.y;
}

function pointToString(point){
  return "{" + point.x + "," + point.y "}";
}

function randomInt(min, max){
  if(max === undefined){
    max = min;
    min = 0;
  }
  return Math.round(Math.random() * max);
}<commit_msg>Fix bugs in test module<commit_after>"use strict";

function getTests(){
  var tests = [];
  tests = tests.concat(getArenaTests());
  document.getElementById("testResults").innerHTML = "found " + tests.length + " tests";
  return tests;
}

function runTests(tests, results){
  if(tests === undefined){
    tests = getTests();
  }
  if(results === undefined){
    results = [];
  }
  if(tests.length == 0){
    showTestResults(results);
    return;
  }

  var result;
  try{
    result = tests[0].call(null);
  }catch(err){
    result = tests[0].toString().split("(")[0] + " caused error: " + err.message;
  }
  var newResults = results.slice(0);
  if(result != true){
    newResults.push(result);
  }
  return runTests(tests.slice(1), newResults);
}

function isFunction(fun){
  var obj = {};
  return fun && obj.toString.call(fun) === '[object Function]';
}

function showTestResults(results){
  var testDiv = document.getElementById("testResults");
  if(results.length == 0){
    testDiv.innerHTML += "<br>All Tests Passed";
  }else{
    testDiv.innerHTML += "<br>Test failures:<br>";
    showTestFailures(testDiv, results);
  }
}

function showTestFailures(div, failures){
  if(failures.length == 0){
    return;
  }
  div.innerHTML += failures[0] + "<br>";
  showTestFailures(div, failures.slice(1));
}

function arraysEqual(array1, array2){
  if(array1.length == 0 && array2.length == 0){
    return true;
  }else if(array1.length == 0 || array2.length == 0){
    return false;
  }else if(array1[0] == array2[0]){
    return arraysEqual(array1.slice(1), array2.slice(1));
  }else{
    return false;
  }
}

function pointsEqual(point1, point2){
  return point1.x == point2.x && point1.y == point2.y;
}

function pointToString(point){
  return "{" + point.x + "," + point.y + "}";
}

function randomInt(min, max){
  if(max === undefined){
    max = min;
    min = 0;
  }
  return min + Math.round(Math.random() * (max - min));
}
{'fraction_non_alphanumeric': 0.17927974947807934, 'fraction_numerical': 0.01826722338204593, 'mean_word_length': 3.8032581453634084, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1227843', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1306, 'n_words': 275}