<commit_before>/*jslint node: true */
"use strict";

var H = require('../index').EventEmitter;
var _ = require('underscore');
var assert = require('assert');

describe('HevEmitter on synchronous listener ', function () {

    it('should trigger synchronous ** events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['**'], function () {
            called = true;
        });
        h.emit(['ventaxi']);
        assert(called);
    });

    it('should trigger synchronous * events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*'], function () {
            called = true;
        });
        h.emit(['bridge']);
        assert(called);
    });


    it('should trigger synchronous "name" events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['laforge'], function () {
            called = true;
        });
        h.emit(['laforge']);
        assert(called);
    });


    it('should trigger synchronous */"name" events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*', 'worf'], function () {
            called = true;
        });
        h.emit(['data', 'worf']);
        assert(called);
    });


    it('should trigger synchronous */** events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*', '**'], function () {
            called = true;
        });
        h.emit(['klingon', 'clansmen', 'culture']);
        assert(called);
    });


    it('should trigger synchronous */* events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*', '*'], function () {
            called = true;
        });
        h.emit(['well', 'done']);
        assert(called);
    });


    it('should trigger synchronous */"name" events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*', 'shuttle'], function () {
            called = true;
        });
        h.emit(['enterprise', 'shuttle']);
        assert(called);
    });


    it('should trigger synchronous "name"/** events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['come', '**'], function () {
            called = true;
        });
        h.emit(['come', 'in', 'enterprise']);
        assert(called);
    });


    it('should trigger synchronous "name"/* events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['locate', '*'], function () {
            called = true;
        });
        h.emit(['locate', '*']);
        assert(called);
    });


    it('should trigger synchronous "name"/"name" events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['jump', 'particle'], function () {
            called = true;
        });
        h.emit(['*', '*']);
        assert(called);
    });


});<commit_msg>Add sequential synchronous functions counter example.<commit_after>/*jslint node: true */
"use strict";

var H = require('../index').EventEmitter;
var _ = require('underscore');
var assert = require('assert');

describe('HevEmitter on synchronous listener ', function () {

    it('should trigger synchronous ** events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['**'], function () {
            called = true;
        });
        h.emit(['ventaxi']);
        assert(called);
    });

    it('should trigger synchronous * events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*'], function () {
            called = true;
        });
        h.emit(['bridge']);
        assert(called);
    });


    it('should trigger synchronous "name" events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['laforge'], function () {
            called = true;
        });
        h.emit(['laforge']);
        assert(called);
    });


    it('should trigger synchronous */"name" events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*', 'worf'], function () {
            called = true;
        });
        h.emit(['data', 'worf']);
        assert(called);
    });


    it('should trigger synchronous */** events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*', '**'], function () {
            called = true;
        });
        h.emit(['klingon', 'clansmen', 'culture']);
        assert(called);
    });


    it('should trigger synchronous */* events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*', '*'], function () {
            called = true;
        });
        h.emit(['well', 'done']);
        assert(called);
    });


    it('should trigger synchronous */"name" events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['*', 'shuttle'], function () {
            called = true;
        });
        h.emit(['enterprise', 'shuttle']);
        assert(called);
    });


    it('should trigger synchronous "name"/** events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['come', '**'], function () {
            called = true;
        });
        h.emit(['come', 'in', 'enterprise']);
        assert(called);
    });


    it('should trigger synchronous "name"/* events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['locate', '*'], function () {
            called = true;
        });
        h.emit(['locate', '*']);
        assert(called);
    });


    it('should trigger synchronous "name"/"name" events synchronously', function () {
        var h = new H();
        var called = false;
        h.on(['jump', 'particle'], function () {
            called = true;
        });
        h.emit(['*', '*']);
        assert(called);
    });

    it('should trigger sequential synchronous "name" events synchronously', function () {
        var h = new H();
        var called = 0;
        h.on(['laforge'], function () {
            called++; 
        });
        h.on(['laforge'], function () {
            called++;
        });
        h.emit(['laforge']);
        assert.equal(2, called);
    });



});
{'fraction_non_alphanumeric': 0.18218125960061443, 'fraction_numerical': 0.00030721966205837174, 'mean_word_length': 1.8569548047389206, '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': '1415556', 'n_tokens_mistral': 1834, 'n_tokens_neox': 1740, 'n_words': 477}