<commit_before>if (typeof(require) == 'function') {
  var GridList = require('../src/gridList.js');
};

_default_size = function(items) {
  for (var i = 0; i < items.length; i++ ) {
    var item = items[i];
    item.w = item.w !== undefined ? item.w : 1;
    item.h = item.h !== undefined ? item.h : 1;
  };
};

exports.toEqualPositions = function(expected) {
  /**
    We don't care about the other fields, only the positions and that the
    indexes correspond (e.g. the h changes for items with auto height)
  */
 var _expected,
     _actual,
     actual = this.actual;
 this.message = function () {

    _default_size(expected);
    _default_size(actual);
    console.log('\n\n' +
      'Expected: ' + (new GridList(expected, {rows: 5})) +
      'Actual: ' + (new GridList(actual, {rows: 5})));

    return JSON.stringify(_actual) +
           " should be at position " +
           JSON.stringify(_expected);
  };
  for (var i = 0; i < expected.length; i++) {
    if (expected[i].x != this.actual[i].x ||
        expected[i].y != this.actual[i].y) {
      _expected = expected[i];
      _actual = this.actual[i];
      return false;
    }
  }
  return true;
};
<commit_msg>Added some comments to the jasmine custom matcher<commit_after>if (typeof(require) == 'function') {
  var GridList = require('../src/gridList.js');
};

_default_size = function(items) {
  /* Set width and height of each item if it doesn't have one */
  for (var i = 0; i < items.length; i++ ) {
    var item = items[i];
    item.w = item.w !== undefined ? item.w : 1;
    item.h = item.h !== undefined ? item.h : 1;
  };
};

exports.toEqualPositions = function(expected) {
  /**
    We don't care about the other fields, only the positions and that the
    indexes correspond (e.g. the h changes for items with auto height)
  */
 var _expected,
     _actual,
     actual = this.actual;
 this.message = function () {
    /* To avoid writing in each test fully specified items for the grid to
     * print them, we'll default sizes, allowing us to show to the developer
     * from where the widget starts atleast.*/
    // Print the grids
    _default_size(expected);
    _default_size(actual);
    console.log('\n\n' +
      'Expected: ' + (new GridList(expected, {rows: 5})) +
      'Actual: ' + (new GridList(actual, {rows: 5})));

    // Let Jasmine know which are the items that differ
    return JSON.stringify(_actual) +
           " should be at position " +
           JSON.stringify(_expected);
  };
  for (var i = 0; i < expected.length; i++) {
    if (expected[i].x != this.actual[i].x ||
        expected[i].y != this.actual[i].y) {
      _expected = expected[i];
      _actual = this.actual[i];
      return false;
    }
  }
  return true;
};

{'fraction_non_alphanumeric': 0.14886613021214337, 'fraction_numerical': 0.0043891733723482075, 'mean_word_length': 2.656417112299465, 'pattern_counts': {'":': 0, '<': 7, '<?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': '182809', 'n_tokens_mistral': 897, 'n_tokens_neox': 877, 'n_words': 264}