<commit_before>/*global require, describe, expect, assert, it*/
'use strict';

var chai = require('chai'),
    assert = chai.assert,
    should = chai.should(),
    expect = chai.expect;

var network = require('./network');

describe('Test', function() {
    it('works', function(done) {
        assert.equal(true, true);
        done();
    });
    it('can load network', function(done) {
        expect(network.Layer).to.be.undefined;
        expect(network.Layers).to.not.be.undefined;
        expect(network.Neurons).to.not.be.undefined;
        done();
    });
});

describe('Layer', function() {
    describe('Arguments', function() {
        it('should accept not accept odd number arguments more than 1', function(done) {
            expect( function() { 
                        return new network.Layers.Layer({}, 1, {}) 
                    } ).to.throw(Error);
            expect( function() { 
                        return new network.Layers.Layer() 
                    } ).to.throw(Error);
            expect( function() { 
                        return new network.Layers.Layer({}, 1, {}, 2, {}) 
                    } ).to.throw(Error);
            done();
        });
        
        it('should accept even arguments at least', function(done) {
            expect( function() { 
                        return new network.Layers.Layer({}, 1, {}, 2) 
                    } ).to.not.throw(Error);
            done();
        });
        
        it('can initialize neuron list with default neurons', function(done) {
            var test = new network.Layers.Layer(network.Neurons.IdentityNeuron, 10);
            expect(test.neurons.length).to.be.equal(10);
            
            test = new network.Layers.Layer(network.Neurons.BiasNeuron, 1);
            expect(test.neurons.length).to.be.equal(1);
            
            done();
        });
        
        it('can initialize neuron list', function(done) {
            var test = new network.Layers.Layer(network.Neurons.IdentityNeuron, 10);
            expect(test.neurons.length).to.be.equal(10);    
            
            var test = new network.Layers.Layer(network.Neurons.IdentityNeuron, 10, network.Neurons.BiasNeuron, 1);
            expect(test.neurons.length).to.be.equal(11);    
            
            done();
        });
        
        it('can initialize neuron list with object interface', function(done) {
            var test = new network.Layers.Layer({
                forward: function(abc) { return 12; },
                backward: function(out) { return 12; }
            }, 10);
            
            expect(test.neurons.length).to.be.equal(10);
            expect(test.neurons[0].forward()).to.be.equal(12);
            expect(test.neurons[0].backward()).to.be.equal(12);
            
            var test = new network.Layers.Layer({
                forward: function(abc) { return 12; },
                backward: function(out) { return 12; }
            }, 10, network.Neurons.BiasNeuron, 22);
            
            expect(test.neurons.length).to.be.equal(32);
            expect(test.neurons[0].forward()).to.be.equal(12);
            
            done();
        });
        
        it('each neuron has a different name', function(done) {
            
            var lookup = {};
            
            var test = new network.Layers.Layer({
                forward: function(abc) { return 12; },
                backward: function(out) { return 12; }
            }, 5, network.Neurons.BiasNeuron, 2);
            
            console.log(test);
            
            // Cute uniqueness test! :D
            test.neurons.forEach(function(n) {
                expect(lookup[n.name]).to.be.undefined;
                lookup[n.name] = 1;
            });
            
            done();
        });
    });
    
});

describe('Neurons', function() {
    describe('Basic instantiations', function() {
        it('Identity Neuron works', function() {
            expect((new network.Neurons.IdentityNeuron()).forward(1)).to.equal(1);
            expect((new network.Neurons.IdentityNeuron()).forward(5)).to.equal(5);
        });
        it('Bias Neuron works', function() {
            expect((new network.Neurons.BiasNeuron()).forward(12)).to.equal(1);
        });
    });

});<commit_msg>deleted a log msg in the test<commit_after>/*global require, describe, expect, assert, it*/
'use strict';

var chai = require('chai'),
    assert = chai.assert,
    should = chai.should(),
    expect = chai.expect;

var network = require('./network');

describe('Test', function() {
    it('works', function(done) {
        assert.equal(true, true);
        done();
    });
    it('can load network', function(done) {
        expect(network.Layer).to.be.undefined;
        expect(network.Layers).to.not.be.undefined;
        expect(network.Neurons).to.not.be.undefined;
        done();
    });
});

describe('Layer', function() {
    describe('Arguments', function() {
        it('should accept not accept odd number arguments more than 1', function(done) {
            expect( function() { 
                        return new network.Layers.Layer({}, 1, {}) 
                    } ).to.throw(Error);
            expect( function() { 
                        return new network.Layers.Layer() 
                    } ).to.throw(Error);
            expect( function() { 
                        return new network.Layers.Layer({}, 1, {}, 2, {}) 
                    } ).to.throw(Error);
            done();
        });
        
        it('should accept even arguments at least', function(done) {
            expect( function() { 
                        return new network.Layers.Layer({}, 1, {}, 2) 
                    } ).to.not.throw(Error);
            done();
        });
        
        it('can initialize neuron list with default neurons', function(done) {
            var test = new network.Layers.Layer(network.Neurons.IdentityNeuron, 10);
            expect(test.neurons.length).to.be.equal(10);
            
            test = new network.Layers.Layer(network.Neurons.BiasNeuron, 1);
            expect(test.neurons.length).to.be.equal(1);
            
            done();
        });
        
        it('can initialize neuron list', function(done) {
            var test = new network.Layers.Layer(network.Neurons.IdentityNeuron, 10);
            expect(test.neurons.length).to.be.equal(10);    
            
            var test = new network.Layers.Layer(network.Neurons.IdentityNeuron, 10, network.Neurons.BiasNeuron, 1);
            expect(test.neurons.length).to.be.equal(11);    
            
            done();
        });
        
        it('can initialize neuron list with object interface', function(done) {
            var test = new network.Layers.Layer({
                forward: function(abc) { return 12; },
                backward: function(out) { return 12; }
            }, 10);
            
            expect(test.neurons.length).to.be.equal(10);
            expect(test.neurons[0].forward()).to.be.equal(12);
            expect(test.neurons[0].backward()).to.be.equal(12);
            
            var test = new network.Layers.Layer({
                forward: function(abc) { return 12; },
                backward: function(out) { return 12; }
            }, 10, network.Neurons.BiasNeuron, 22);
            
            expect(test.neurons.length).to.be.equal(32);
            expect(test.neurons[0].forward()).to.be.equal(12);
            
            done();
        });
        
        it('each neuron has a different name', function(done) {
            
            var lookup = {};
            
            var test = new network.Layers.Layer({
                forward: function(abc) { return 12; },
                backward: function(out) { return 12; }
            }, 5, network.Neurons.BiasNeuron, 2);
            
            // Cute uniqueness test! :D
            test.neurons.forEach(function(n) {
                expect(lookup[n.name]).to.be.undefined;
                lookup[n.name] = 1;
            });
            
            done();
        });
    });
    
});

describe('Neurons', function() {
    describe('Basic instantiations', function() {
        it('Identity Neuron works', function() {
            expect((new network.Neurons.IdentityNeuron()).forward(1)).to.equal(1);
            expect((new network.Neurons.IdentityNeuron()).forward(5)).to.equal(5);
        });
        it('Bias Neuron works', function() {
            expect((new network.Neurons.BiasNeuron()).forward(12)).to.equal(1);
        });
    });

});
{'fraction_non_alphanumeric': 0.14478584729981378, 'fraction_numerical': 0.014432029795158287, 'mean_word_length': 1.631047152480098, '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': '5838776', 'n_tokens_mistral': 2537, 'n_tokens_neox': 2343, 'n_words': 451}