<commit_before>
// MODULES //

var // Expectation library:
	chai = require( 'chai' ),

	// Stream spec:
	spec = require( 'stream-spec' ),

	// Test utilities:
	utils = require( './utils' ),

	// Module to be tested:
	mStream = require( './../lib/stats/max' );


// VARIABLES //

var expect = chai.expect,
	assert = chai.assert;


// TESTS //

describe( 'stats/max', function tests() {
	'use strict';

	it( 'should export a factory function', function test() {
		expect( mStream ).to.be.a( 'function' );
	});

	it( 'should provide a method to get the initial accumulator value', function test() {
		var rStream = mStream();
		assert.strictEqual( rStream.value(), Number.NEGATIVE_INFINITY );
	});

	it( 'should provide a method to set the initial accumulator value', function test() {
		var rStream = mStream();
		rStream.value( 5 );
		assert.strictEqual( rStream.value(), 5 );
	});

	it( 'should not allow a non-numeric max value', function test() {
		var rStream = mStream();
		
		expect( badMax( '5' ) ).to.throw( Error );
		expect( badMax( [] ) ).to.throw( Error );
		expect( badMax( {} ) ).to.throw( Error );
		expect( badMax( null ) ).to.throw( Error );
		expect( badMax( undefined ) ).to.throw( Error );
		expect( badMax( NaN ) ).to.throw( Error );

		function badMax( value ) {
			return function() {
				rStream.value( value );
			};
		}
	});
<commit_msg>[UPDATE] do not assume default initial accumulator value.<commit_after>
// MODULES //

var // Expectation library:
	chai = require( 'chai' ),

	// Stream spec:
	spec = require( 'stream-spec' ),

	// Test utilities:
	utils = require( './utils' ),

	// Module to be tested:
	mStream = require( './../lib/stats/max' );


// VARIABLES //

var expect = chai.expect,
	assert = chai.assert;


// TESTS //

describe( 'stats/max', function tests() {
	'use strict';

	it( 'should export a factory function', function test() {
		expect( mStream ).to.be.a( 'function' );
	});

	it( 'should provide a method to get the initial accumulator value', function test() {
		var rStream = mStream();
		expect( rStream.value() ).to.be.a( 'number' );
	});

	it( 'should provide a method to set the initial accumulator value', function test() {
		var rStream = mStream();
		rStream.value( 5 );
		assert.strictEqual( rStream.value(), 5 );
	});

	it( 'should not allow a non-numeric max value', function test() {
		var rStream = mStream();
		
		expect( badMax( '5' ) ).to.throw( Error );
		expect( badMax( [] ) ).to.throw( Error );
		expect( badMax( {} ) ).to.throw( Error );
		expect( badMax( null ) ).to.throw( Error );
		expect( badMax( undefined ) ).to.throw( Error );
		expect( badMax( NaN ) ).to.throw( Error );

		function badMax( value ) {
			return function() {
				rStream.value( value );
			};
		}
	});

{'fraction_non_alphanumeric': 0.17345454545454544, 'fraction_numerical': 0.002181818181818182, 'mean_word_length': 3.161875945537065, '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': '6164226', 'n_tokens_mistral': 988, 'n_tokens_neox': 907, 'n_words': 284}