<commit_before>/*jshint node: true, -W106 */
'use strict';

/*
* Name : functionHelperSpec.js
* Module : UnitTest
* Location : /test/helpers
*
* History :
* 
* Version   Date         Programmer         Description
* =========================================================
* 0.0.1     2015-05-14   <NAME>    Initial code
* =========================================================
*/

var FH = require('../../lib/helpers/functionHelper.js');
var assert = require('assert');

describe('FunctionHelper', function() {
    describe('#isHEX', function() {
        it('returns false when passed a non-string', function() {
            assert.strictEqual(FH.isHEX(12), false);
        });
        it('returns false when passed a non-string', function() {
            assert.strictEqual(FH.isHEX(true), false);
        });
        it('returns false when passed AbA9A0 without #', function() {
            assert.strictEqual(FH.isHEX('AbA9A0'), false);
        });
        it('returns TRUE when passed #AbA9A0', function() {
            assert.strictEqual(FH.isHEX('#AbA9A0'), true);
        });
        it('returns TRUE when passed #FFF', function() {
            assert.strictEqual(FH.isHEX('#FFF'), true);
        });
        it('returns FALSE when passed #AbA9AG', function() {
            assert.strictEqual(FH.isHEX('#AbA9AG'), false);
        });
        it('returns FALSE when passed #FGF', function() {
            assert.strictEqual(FH.isHEX('#FGF'), false);
        });
    });
    describe('#getCorrectType', function() {
        it('returns a string from string notation', function() {
            assert.strictEqual(FH.getCorrectType('\'hello\''), 'hello');
        });
        it('returns a string from malformed string notation', function() {
            assert.strictEqual(FH.getCorrectType('\'hello'), 'hello');
        });
        it('returns a string from string notation', function() {
            assert.strictEqual(FH.getCorrectType('-3.98'), -3.98);
        });
    });
    describe('#parseCondition', function() {
        it('returns 701 when passed a non-condition', function() {
            assert.strictEqual(FH.parseCondition(''), 701);
        });
        it('returns 701 when passed a semi-condition', function() {
            assert.strictEqual(FH.parseCondition('temperatura>'), 701);
        });
        it('returns correct object when passed temp>=0', function() {
            assert.deepEqual(JSON.parse(FH.parseCondition('temp>=0')),'{key:"temp",operator:">=",value:0}');
        });
        it('returns correct object when passed temp>=\'0\'', function() {
            assert.deepEqual(JSON.parse(FH.parseCondition('temp>=0')),'{key:"temp",operator:">=",value:"0"}');
        });
        it('returns correct object when passed temp>-1', function() {
            assert.deepEqual(JSON.parse(FH.parseCondition('temp>-1')),'{key:"temp",operator:">",value:-1}');
        });
        it('returns correct object when passed temp>=0', function() {
            assert.deepEqual(JSON.parse(FH.parseCondition('temp<=0')),'{key:"temp",operator:"<=",value:0}');
        });
        it('returns correct object when passed temp>=\'56\'', function() {
            assert.deepEqual(JSON.parse(FH.parseCondition('temp<\'56\'')),'{key:"temp",operator:"<",value:56}');
        });
        it('returns correct object when passed temp==10', function() {
            assert.deepEqual(JSON.parse(FH.parseCondition('temp==10')),'{key:"temp",operator:"==",value:10}');
        });
        it('returns correct object when passed temp!=100', function() {
            assert.deepEqual(JSON.parse(FH.parseCondition('temp!=100')),'{key:"temp",operator:"!=",value:100}');
        });
    });
});<commit_msg>please pass test<commit_after>/*jshint node: true, -W106 */
'use strict';

/*
* Name : functionHelperSpec.js
* Module : UnitTest
* Location : /test/helpers
*
* History :
* 
* Version   Date         Programmer         Description
* =========================================================
* 0.0.1     2015-05-14   <NAME>    Initial code
* =========================================================
*/

var FH = require('../../lib/helpers/functionHelper.js');
var assert = require('assert');

describe('FunctionHelper', function() {
    describe('#isHEX', function() {
        it('returns false when passed a non-string', function() {
            assert.strictEqual(FH.isHEX(12), false);
        });
        it('returns false when passed a non-string', function() {
            assert.strictEqual(FH.isHEX(true), false);
        });
        it('returns false when passed AbA9A0 without #', function() {
            assert.strictEqual(FH.isHEX('AbA9A0'), false);
        });
        it('returns TRUE when passed #AbA9A0', function() {
            assert.strictEqual(FH.isHEX('#AbA9A0'), true);
        });
        it('returns TRUE when passed #FFF', function() {
            assert.strictEqual(FH.isHEX('#FFF'), true);
        });
        it('returns FALSE when passed #AbA9AG', function() {
            assert.strictEqual(FH.isHEX('#AbA9AG'), false);
        });
        it('returns FALSE when passed #FGF', function() {
            assert.strictEqual(FH.isHEX('#FGF'), false);
        });
    });
    describe('#getCorrectType', function() {
        it('returns a string from string notation', function() {
            assert.strictEqual(FH.getCorrectType('\'hello\''), 'hello');
        });
        it('returns a string from malformed string notation', function() {
            assert.strictEqual(FH.getCorrectType('\'hello'), 'hello');
        });
        it('returns a string from string notation', function() {
            assert.strictEqual(FH.getCorrectType('-3.98'), -3.98);
        });
    });
    describe('#parseCondition', function() {
        it('returns 701 when passed a non-condition', function() {
            assert.strictEqual(FH.parseCondition(''), 701);
        });
        it('returns 701 when passed a semi-condition', function() {
            assert.strictEqual(FH.parseCondition('temperatura>'), 701);
        });
        it('returns correct object when passed temp>=0', function() {
            assert.deepEqual(JSON.stringify(FH.parseCondition('temp>=0')),'{key:"temp",operator:">=",value:0}');
        });
        it('returns correct object when passed temp>=\'0\'', function() {
            assert.deepEqual(JSON.stringify(FH.parseCondition('temp>=0')),'{key:"temp",operator:">=",value:"0"}');
        });
        it('returns correct object when passed temp>-1', function() {
            assert.deepEqual(JSON.stringify(FH.parseCondition('temp>-1')),'{key:"temp",operator:">",value:-1}');
        });
        it('returns correct object when passed temp>=0', function() {
            assert.deepEqual(JSON.stringify(FH.parseCondition('temp<=0')),'{key:"temp",operator:"<=",value:0}');
        });
        it('returns correct object when passed temp>=\'56\'', function() {
            assert.deepEqual(JSON.stringify(FH.parseCondition('temp<\'56\'')),'{key:"temp",operator:"<",value:56}');
        });
        it('returns correct object when passed temp==10', function() {
            assert.deepEqual(JSON.stringify(FH.parseCondition('temp==10')),'{key:"temp",operator:"==",value:10}');
        });
        it('returns correct object when passed temp!=100', function() {
            assert.deepEqual(JSON.stringify(FH.parseCondition('temp!=100')),'{key:"temp",operator:"!=",value:100}');
        });
    });
});
{'fraction_non_alphanumeric': 0.21174257691790946, 'fraction_numerical': 0.020690581754668817, 'mean_word_length': 2.9659030367607886, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 29, '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': '1061744', 'n_tokens_mistral': 2198, 'n_tokens_neox': 2068, 'n_words': 396}