<commit_before>/* eslint-env browser, mocha */
/* global expect, sinon, units */
/* eslint no-unused-expressions: 0 */

'use strict';

describe('units', function() {
  var lengthUnits = ['%', 'ch', 'cm', 'em', 'ex', 'in', 'mm', 'pc', 'pt', 'px', 'rem', 'vh', 'vmax', 'vmin', 'vw'];
  var angleUnits = ['deg', 'grad', 'rad', 'turn'];
  var MAX_SAFE_INTEGER = 9007199254740991;

  it('should be defined as an object', function() {
    expect(units).to.be.an('object');
  });

  var parseValid = function(value, unit, valueNumber) {
    expect(units.parse(value + unit)).to.deep.equal({
      'value': typeof valueNumber === 'number'
        ? valueNumber
        : value,
      'unit': unit
    });
  };

  it('should parse valid length values', function() {
    for (var i = 0; i < lengthUnits.length; i++) {
      parseValid(0, lengthUnits[i]);
      parseValid(1, lengthUnits[i]);
      parseValid(-1, lengthUnits[i]);
      parseValid(MAX_SAFE_INTEGER, lengthUnits[i]);
      parseValid(-MAX_SAFE_INTEGER, lengthUnits[i]);
      parseValid(0.000001, lengthUnits[i]);
      parseValid('.000001', lengthUnits[i], 0.000001);
      parseValid(-0.000001, lengthUnits[i]);
      parseValid('-.000001', lengthUnits[i], -0.000001);
    }
  });

  it('should parse valid angle values', function() {
    for (var i = 0; i < angleUnits.length; i++) {
      parseValid(0, angleUnits[i]);
      parseValid(1, angleUnits[i]);
      parseValid(-1, angleUnits[i]);
      parseValid(MAX_SAFE_INTEGER, angleUnits[i]);
      parseValid(-MAX_SAFE_INTEGER, angleUnits[i]);
      parseValid(0.000001, angleUnits[i]);
      parseValid('.000001', angleUnits[i], 0.000001);
      parseValid(-0.000001, angleUnits[i]);
      parseValid('-.000001', angleUnits[i], -0.000001);
    }
  });
});
<commit_msg>Add sample property to parse tests<commit_after>/* eslint-env browser, mocha */
/* global expect, sinon, units */
/* eslint no-unused-expressions: 0 */

'use strict';

describe('units', function() {
  var lengthUnits = ['%', 'ch', 'cm', 'em', 'ex', 'in', 'mm', 'pc', 'pt', 'px', 'rem', 'vh', 'vmax', 'vmin', 'vw'];
  var angleUnits = ['deg', 'grad', 'rad', 'turn'];
  var MAX_SAFE_INTEGER = 9007199254740991;

  it('should be defined as an object', function() {
    expect(units).to.be.an('object');
  });

  var parseValid = function(value, unit, property, valueNumber) {
    expect(units.parse(value + unit)).to.deep.equal({
      'value': typeof valueNumber === 'number'
        ? valueNumber
        : value,
      'unit': unit
    });
  };

  it('should parse valid length values', function() {
    for (var i = 0; i < lengthUnits.length; i++) {
      parseValid(0, lengthUnits[i], 'width');
      parseValid(1, lengthUnits[i], 'width');
      parseValid(-1, lengthUnits[i], 'width');
      parseValid(MAX_SAFE_INTEGER, lengthUnits[i], 'width');
      parseValid(-MAX_SAFE_INTEGER, lengthUnits[i], 'width');
      parseValid(0.000001, lengthUnits[i], 'width');
      parseValid('.000001', lengthUnits[i], 'width', 0.000001);
      parseValid(-0.000001, lengthUnits[i], 'width');
      parseValid('-.000001', lengthUnits[i], 'width', -0.000001);
    }
  });

  it('should parse valid angle values', function() {
    for (var i = 0; i < angleUnits.length; i++) {
      parseValid(0, angleUnits[i], 'rotateX');
      parseValid(1, angleUnits[i], 'rotateX');
      parseValid(-1, angleUnits[i], 'rotateX');
      parseValid(MAX_SAFE_INTEGER, angleUnits[i], 'rotateX');
      parseValid(-MAX_SAFE_INTEGER, angleUnits[i], 'rotateX');
      parseValid(0.000001, angleUnits[i], 'rotateX');
      parseValid('.000001', angleUnits[i], 'rotateX', 0.000001);
      parseValid(-0.000001, angleUnits[i], 'rotateX');
      parseValid('-.000001', angleUnits[i], 'rotateX', -0.000001);
    }
  });
});

{'fraction_non_alphanumeric': 0.1955425842398514, 'fraction_numerical': 0.055717697001857254, 'mean_word_length': 3.6371463714637144, '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': '2050030', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1302, 'n_words': 282}