<commit_before>'use strict';

var expect = require("chai").expect,
    fs = require('fs'),
    Data = require(__dirname + "/../lib/util/Data.js");

describe("Data.arrayAllEqual", function() {
  
  it("should return true when all array elements are numbers and equal to one another", function(){
    var actual = Data.arrayAllEqual([12,12,12,12])
    expect(actual).to.equal(true);
  });
 
  it("should return true when all array elements are strings and equal to one another", function(){
    var actual = Data.arrayAllEqual(["foo","foo","foo","foo"])
    expect(actual).to.equal(true);
  });
  
  it("should return true when all array elements are nulls and equal to one another", function(){
    var actual = Data.arrayAllEqual([null,null,null,null])
    expect(actual).to.equal(true);
  });
  
  it("should return true when the array only contains 1 element", function(){
    var actual = Data.arrayAllEqual([12])
    expect(actual).to.equal(true);
  });
  
  it("should return false when the array only contains no elements", function(){
    var actual = Data.arrayAllEqual([])
    expect(actual).to.equal(false);
  });
  
});

describe("Data.getMaxOfArray", function() {
  it("should return the maximum number in the array", function(){
    var actual = Data.getMaxOfArray([1,3,50,7,9]);
    expect(actual).to.equal(50);
  })
});<commit_msg>Add normalize 2d array test<commit_after>'use strict';

var expect = require("chai").expect,
    fs = require('fs'),
    Data = require(__dirname + "/../lib/util/Data.js");

describe("Data.arrayAllEqual", function() {
  
  it("should return true when all array elements are numbers and equal to one another", function(){
    var actual = Data.arrayAllEqual([12,12,12,12])
    expect(actual).to.equal(true);
  });
 
  it("should return true when all array elements are strings and equal to one another", function(){
    var actual = Data.arrayAllEqual(["foo","foo","foo","foo"])
    expect(actual).to.equal(true);
  });
  
  it("should return true when all array elements are nulls and equal to one another", function(){
    var actual = Data.arrayAllEqual([null,null,null,null])
    expect(actual).to.equal(true);
  });
  
  it("should return true when the array only contains 1 element", function(){
    var actual = Data.arrayAllEqual([12])
    expect(actual).to.equal(true);
  });
  
  it("should return false when the array only contains no elements", function(){
    var actual = Data.arrayAllEqual([])
    expect(actual).to.equal(false);
  });
  
});

describe("Data.getMaxOfArray", function() {
  it("should return the maximum number in the array", function(){
    var actual = Data.getMaxOfArray([1,3,50,7,9]);
    expect(actual).to.equal(50);
  })
});

describe("Data.normalize2dArrayLength", function(){
  it("should return a 2d array where sub arrays are equal length.", function(){
    var normalized2dArray = Data.normalize2dArrayLength([[1,2],[1],[2,3,4]]);
    
    var expectedLenth = 3;
    
    expect(normalized2dArray[0].length).to.equal(expectedLenth);
    expect(normalized2dArray[1].length).to.equal(expectedLenth);
    expect(normalized2dArray[2].length).to.equal(expectedLenth);
  });
});
{'fraction_non_alphanumeric': 0.15827793605571383, 'fraction_numerical': 0.017727128838239948, 'mean_word_length': 4.2579034941763725, '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': '3900316', 'n_tokens_mistral': 982, 'n_tokens_neox': 950, 'n_words': 255}