<commit_before>const EPSILON = 0.00001;
const assert = require('assert');


global.expect = function(e) {
    
    function expected(e, message, a) {
        assert.fail(e, a, `expected ${JSON.stringify(e)} ${message} ${JSON.stringify(a)}`);
    }
    
    return {
        toBe: function(a) {
            assert.strictEqual(e, a);
        },
        toEqual: function(a) {
            assert.strictEqual(e,a);
        },
        toBeDefined: function() {
            assert.notStrictEqual(e, undefined);
        },
        toBeTruthy: function() {
            assert(e);
        },
        toBeFalsy: function() {
            assert(!e);
        },
        toBeNull: function() {
            assert.strictEqual(e, null);
        },
        not: {
            toBe: function(a) {
                assert.notStrictEqual(e, a);
            },
            
            toBeEqualish: function(a) {
                if (typeof(e) == 'number')
                    assert(Math.abs(e - a) >= EPSILON);

                if (e.length != a.length)
                    return;
                for (let i = 0; i < e.length; i++) {
                    if (isNaN(e[i]) !== isNaN(a[i]))
                        return;
                    if (Math.abs(e[i] - a[i]) >= EPSILON)
                        return;
                }
                
                assert.fail(e, a);
            }
            
        },
        toBeGreaterThan: function(a) {
            assert(e > a);
        },
        toBeLessThan: function(a) {
            assert(e < a);
        },
        /*
           Returns true if `actual` has the same length as `expected`, and
           if each element of both arrays is within 0.000001 of each other.
           This is a way to check for "equal enough" conditions, as a way
           of working around floating point imprecision.
         */
        toBeEqualish: function(a) {

            if (typeof(e) == 'number')
                if(Math.abs(e - a) >= EPSILON)
                    expected(e, "to be equalish to", a);

            if (e.length != a.length)
                assert.fail(e.length, a.length, "length mismatch");<commit_msg>fix test toBeEqualish bug when has NaN value<commit_after>const EPSILON = 0.00001;
const assert = require('assert');


global.expect = function(e) {
    
    function expected(e, message, a) {
        assert.fail(e, a, `expected ${JSON.stringify(e)} ${message} ${JSON.stringify(a)}`);
    }
    
    return {
        toBe: function(a) {
            assert.strictEqual(e, a);
        },
        toEqual: function(a) {
            assert.strictEqual(e,a);
        },
        toBeDefined: function() {
            assert.notStrictEqual(e, undefined);
        },
        toBeTruthy: function() {
            assert(e);
        },
        toBeFalsy: function() {
            assert(!e);
        },
        toBeNull: function() {
            assert.strictEqual(e, null);
        },
        not: {
            toBe: function(a) {
                assert.notStrictEqual(e, a);
            },
            
            toBeEqualish: function(a) {
                if (typeof(e) == 'number')
                    assert(Math.abs(e - a) >= EPSILON);

                if (e.length != a.length)
                    return;
                for (let i = 0; i < e.length; i++) {
                    if (isNaN(e[i]) !== isNaN(a[i]))
                        return;
                    if (Math.abs(e[i] - a[i]) >= EPSILON)
                        return;
                }
                
                assert.fail(e, a);
            }
            
        },
        toBeGreaterThan: function(a) {
            assert(e > a);
        },
        toBeLessThan: function(a) {
            assert(e < a);
        },
        /*
           Returns true if `actual` has the same length as `expected`, and
           if each element of both arrays is within 0.000001 of each other.
           This is a way to check for "equal enough" conditions, as a way
           of working around floating point imprecision.
         */
        toBeEqualish: function(a) {

            if (typeof(e) == 'number'){
                if(isNaN(e) !== isNaN(a))
                    expected(e, "to be equalish to", a);
                if(Math.abs(e - a) >= EPSILON)
                    expected(e, "to be equalish to", a);

            if (e.length != a.length)
                assert.fail(e.length, a.length, "length mismatch");
{'fraction_non_alphanumeric': 0.12778904665314403, 'fraction_numerical': 0.006310570205093531, 'mean_word_length': 1.2516489091831557, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1654816', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1239, 'n_words': 306}