<commit_before>exports.add_tests_to = function( suite ) {
  var assert = require('assert');

  suite.addBatch({
    'tools tests' : {
      'Array\'s methods' : {
        topic : [ 1,2,3,2 ],
        'Array diff' : {
          'argument to diff is not an array' : function( ar ){
            assert.throws( function() {
              ar.diff(3);
            }, TypeError );
          },
          'normal work' : function( ar ){
            assert.deepEqual( ar.diff( [2]        ), [1,3]  );
            assert.deepEqual( ar.diff( []         ), ar     );
            assert.deepEqual( ar.diff( [4]        ), ar     );
            assert.deepEqual( ar.diff( [1,2]      ), [3]    );
            assert.deepEqual( ar.diff( [1,2,3]    ), []     );
            assert.deepEqual( ar.diff( [4,4,2,2]  ), [1,3]  );
          }
        },
        'Array merge' : {
          'argument to merge is not an array' : function( ar ){
            assert.throws( function() {
              ar.merge(3);
            }, TypeError );
          },
          'normal work' : function( ar ){
            assert.deepEqual( ar.merge( [2]       ), [1,2,3]      );
            assert.deepEqual( ar.merge( [2,3,4]   ), [1,2,3,4]    );
            assert.deepEqual( ar.merge( []        ), [1,2,3]      );
            assert.deepEqual( ar.merge( [5]       ), [1,2,3,5]    );
            assert.deepEqual( ar.merge( [5,7,5,1] ), [1,2,3,5,7]  );
          }
        }
      },
      'Object\'s methods' : {
        topic : {
          p1 : 42,
          p2 : null,
          p3 : undefined,
          p4 : false,
          p5 : true,
          p6 : 'just string'
        },
        'Object merge' : {
        }
      }
    }
  });
}<commit_msg>issue#41 - тесты на tools.js<commit_after>exports.add_tests_to = function( suite ) {
  var assert = require('assert');

  suite.addBatch({
    'tools tests' : {
      'Array\'s methods' : {
        topic : [ 1,2,3,2 ],
        'Array diff' : {
          'argument to diff is not an array' : function( ar ){
            assert.throws( function() {
              ar.diff(3);
            }, TypeError );
          },
          'normal work' : function( ar ){
            assert.deepEqual( ar.diff( [2]        ), [1,3]  );
            assert.deepEqual( ar.diff( []         ), ar     );
            assert.deepEqual( ar.diff( [4]        ), ar     );
            assert.deepEqual( ar.diff( [1,2]      ), [3]    );
            assert.deepEqual( ar.diff( [1,2,3]    ), []     );
            assert.deepEqual( ar.diff( [4,4,2,2]  ), [1,3]  );
          }
        },
        'Array merge' : {
          'argument to merge is not an array' : function( ar ){
            assert.throws( function() {
              ar.merge(3);
            }, TypeError );
          },
          'normal work' : function( ar ){
            assert.deepEqual( ar.merge( [2]       ), [1,2,3]      );
            assert.deepEqual( ar.merge( [2,3,4]   ), [1,2,3,4]    );
            assert.deepEqual( ar.merge( []        ), [1,2,3]      );
            assert.deepEqual( ar.merge( [5]       ), [1,2,3,5]    );
            assert.deepEqual( ar.merge( [5,7,5,1] ), [1,2,3,5,7]  );
          }
        }
      },
      'Object\'s methods' : {
        topic : {
          p1 : 42,
          p2 : null,
          p3 : undefined,
          p4 : false,
          p5 : true,
          p6 : 'just string',
          p7 : {
            v : 8
          }
        },
        'Object merge' : {
          'bad arguments' : function( obj ){
            assert.throws( function() {
              Object.merge( {}, 'not object' );
            }, TypeError );
            assert.throws( function() {
              Object.merge( [], undefined );
            }, TypeError );
            assert.throws( function() {
              Object.merge( [], [] );
            }, TypeError );
            assert.throws( function() {
              Object.merge( false, {} );
            }, TypeError );
          },
          'normal work' : function( obj ) {
            assert.deepEqual( Object.merge( obj, {
              p1 : false,
              p2 : 12,
              p3 : undefined,
              p7 : {
                v : 7
              }
            } ), {
              p1 : false,
              p2 : 12,
              p3 : undefined,
              p4 : false,
              p5 : true,
              p6 : 'just string',
              p7 : {
                v : 7
              }
            } );
          }
        },
        'Object recursive merge' : {
          topic : {

          },
          'bad arguments' : function( obj ){
            assert.throws( function() {
              Object.recursive_merge( {}, 'not object' );
            }, TypeError );
            assert.throws( function() {
              Object.recursive_merge( [], undefined );
            }, TypeError );
            assert.throws( function() {
              Object.recursive_merge( [], [] );
            }, TypeError );
            assert.throws( function() {
              Object.recursive_merge( false, {} );
            }, TypeError );
          },
          'normal work' : function( obj ){

          }
        }
      }
    }
  });
}
{'fraction_non_alphanumeric': 0.15632850241545893, 'fraction_numerical': 0.02647342995169082, 'mean_word_length': 1.1265406737880033, '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': '3939986', 'n_tokens_mistral': 1580, 'n_tokens_neox': 1554, 'n_words': 314}