<commit_before>// -----------------------------------------------------------------------
//  gama
//  Copyright 2015 <NAME>. All Rights Reserved.
//
//  This program is free software. You can redistribute and/or modify it
//  in accordance with the terms of the accompanying license agreement.
// -----------------------------------------------------------------------

var assert = require('assert');
var asserts = exports;

asserts.points = function(expected, actual) {
  var d = .00000000001;

  if (Math.abs(expected.x - actual.x) > d
    || Math.abs(expected.y - actual.y) > d) {
    assert.fail(actual, expected, 'Points do not match.');
  }
}

asserts.vectors = asserts.points;

asserts.polygons = function(expected, actual) {
  for (var i = 0; i < expected.vertices.length; i++) {
    asserts.points(expected.vertices[i], actual.vertices[i]);
  }
}<commit_msg>improve custom asserts<commit_after>// -----------------------------------------------------------------------
//  gama
//  Copyright 2015 <NAME>. All Rights Reserved.
//
//  This program is free software. You can redistribute and/or modify it
//  in accordance with the terms of the accompanying license agreement.
// -----------------------------------------------------------------------

var assert = require('assert');
var asserts = exports;

var d = .00000000001;

asserts.almostEqual = function(expected, actual) {
  if (Math.abs(expected - actual) > d) {
    assert.fail(actual, expected, 'Numbers are not almost equal.');
  }
};

asserts.points = function(expected, actual) {
  asserts.almostEqual(expected.x, actual.x);
  asserts.almostEqual(expected.y, actual.y);
}

asserts.vectors = asserts.points;

asserts.polygons = function(expected, actual) {
  for (var i = 0; i < expected.vertices.length; i++) {
    asserts.points(expected.vertices[i], actual.vertices[i]);
  }
}
{'fraction_non_alphanumeric': 0.2726781857451404, 'fraction_numerical': 0.017278617710583154, 'mean_word_length': 1.9695512820512822, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '4576973', 'n_tokens_mistral': 540, 'n_tokens_neox': 498, 'n_words': 143}