<commit_before>/*global describe:true, beforeEach:true, it:true */

var assert = require("assert"),
    load = require('load'),
    jsdom = require("jsdom"),
    _ = require("underscore")._;

var libDChart = load(process.cwd()+'/dist/dchart.min.js',{_:_});
var dChart = libDChart.dChart;

describe('dChart.Point', function(){

    var elements = jsdom.jsdom("<div stroke='#ffff00' stroke-width='0.2' stroke-opacity='0.95' fill-opacity='0.8' fill='#ff00ff'></div>"),
        element = elements.children[0],
        normalizeElement = {stroke:'#ffff00', strokeWidth:0.2, strokeOpacity:0.95, fillOpacity:0.8, fill:'#ff00ff'},
        customMap = {stroke:'customStroke', strokeWidth:'customStrokeWidth', strokeOpacity:'customStrokeOpacity', fillOpacity:'customFillOpacity', fill:'customFill'},
        mapElement = {customStroke:'#ffff00', customStrokeWidth:0.2, customStrokeOpacity:0.95, customFillOpacity:0.8, customFill:'#ff00ff'};

    describe('#parse()', function(){

        var p = new dChart.Point();

        it('should create a LineStyle', function(){

            p.parse(element);

            var line = new dChart.Utils.LineStyle();
            line.stroke = new dChart.Utils.Color('#ffff00');
            line.strokeWidth = new dChart.Utils.Size(0.2);
            line.strokeOpacity = 0.95;

            assert.deepEqual(line, p.lineStyle);
        })

        it('should create an AreaStyle', function(){

            p.parse(element);

            var area = new dChart.Utils.AreaStyle();
            area.fill = new dChart.Utils.Color('#ff00ff');
            area.fillOpacity = 0.8;

            assert.deepEqual(area, p.areaStyle);
        })
    })

    describe('#map()', function(){

        var p = new dChart.Point();

        it('should create a LineStyle', function(){

            p.map(mapElement, customMap);

            var line = new dChart.Utils.LineStyle();
            line.stroke = new dChart.Utils.Color('#ffff00');
            line.strokeWidth = new dChart.Utils.Size(0.2);
            line.strokeOpacity = 0.95;

            assert.deepEqual(line, p.lineStyle);
        })

        it('should create an AreaStyle', function(){

            p.map(mapElement, customMap);

            var area = new dChart.Utils.AreaStyle();
            area.fill = new dChart.Utils.Color('#ff00ff');
            area.fillOpacity = 0.8;

            assert.deepEqual(area, p.areaStyle);
        })
    })

    describe('#normalize()', function(){

        var p = new dChart.Point();

        it('should create a LineStyle', function(){

            p.normalize(normalizeElement);

            var line = new dChart.Utils.LineStyle();
            line.stroke = new dChart.Utils.Color('#ffff00');
            line.strokeWidth = new dChart.Utils.Size(0.2);
            line.strokeOpacity = 0.95;

            assert.deepEqual(line, p.lineStyle);
        })

        it('should create an AreaStyle', function(){

            p.normalize(normalizeElement);

            var area = new dChart.Utils.AreaStyle();
            area.fill = new dChart.Utils.Color('#ff00ff');
            area.fillOpacity = 0.8;

            assert.deepEqual(area, p.areaStyle);
        })
    })
})<commit_msg>Added tests<commit_after>/*global describe:true, beforeEach:true, it:true */

var assert = require("assert"),
    load = require('load'),
    jsdom = require("jsdom"),
    _ = require("underscore")._;

var libDChart = load(process.cwd()+'/dist/dchart.min.js',{_:_});
var dChart = libDChart.dChart;

describe('dChart.Point', function(){

    var elements = jsdom.jsdom("<div stroke='#ffff00' stroke-width='0.2' stroke-opacity='0.95' fill-opacity='0.8' fill='#ff00ff'></div>"),
        element = elements.children[0],
        normalizeElement = {stroke:'#ffff00', strokeWidth:0.2, strokeOpacity:0.95, fillOpacity:0.8, fill:'#ff00ff'},
        customMap = {stroke:'customStroke', strokeWidth:'customStrokeWidth', strokeOpacity:'customStrokeOpacity', fillOpacity:'customFillOpacity', fill:'customFill'},
        mapElement = {customStroke:'#ffff00', customStrokeWidth:0.2, customStrokeOpacity:0.95, customFillOpacity:0.8, customFill:'#ff00ff'};

    describe('#parse()', function(){

        var p = new dChart.Point();

        it('should create a LineStyle', function(){

            p.parse(element);

            var line = new dChart.Utils.LineStyle();
            line.stroke = new dChart.Utils.Color('#ffff00');
            line.strokeWidth = new dChart.Utils.Size(0.2);
            line.strokeOpacity = 0.95;

            assert.deepEqual(line, p.lineStyle);
        })

        it('should create an AreaStyle', function(){

            p.parse(element);

            var area = new dChart.Utils.AreaStyle();
            area.fill = new dChart.Utils.Color('#ff00ff');
            area.fillOpacity = 0.8;

            assert.deepEqual(area, p.areaStyle);
        })
    })

    describe('#map()', function(){

        var p = new dChart.Point();

        it('should create a LineStyle', function(){

            p.map(mapElement, customMap);

            var line = new dChart.Utils.LineStyle();
            line.stroke = new dChart.Utils.Color('#ffff00');
            line.strokeWidth = new dChart.Utils.Size(0.2);
            line.strokeOpacity = 0.95;

            assert.deepEqual(line, p.lineStyle);
        })

        it('should create an AreaStyle', function(){

            p.map(mapElement, customMap);

            var area = new dChart.Utils.AreaStyle();
            area.fill = new dChart.Utils.Color('#ff00ff');
            area.fillOpacity = 0.8;

            assert.deepEqual(area, p.areaStyle);
        })
    })

    describe('#normalize()', function(){

        var p = new dChart.Point();

        it('should create a LineStyle', function(){

            p.normalize(normalizeElement);

            var line = new dChart.Utils.LineStyle();
            line.stroke = new dChart.Utils.Color('#ffff00');
            line.strokeWidth = new dChart.Utils.Size(0.2);
            line.strokeOpacity = 0.95;

            assert.deepEqual(line, p.lineStyle);
        })

        it('should create an AreaStyle', function(){

            p.normalize(normalizeElement);

            var area = new dChart.Utils.AreaStyle();
            area.fill = new dChart.Utils.Color('#ff00ff');
            area.fillOpacity = 0.8;

            assert.deepEqual(area, p.areaStyle);
        })
    })
})

describe('dChart.Point1D', function(){

    var elements = jsdom.jsdom("<div x='5.25'></div><div y='4.25'></div><div val='3.25'></div><div value='2.25'></div>"),
        element = [elements.children[0],elements.children[1],elements.children[2],elements.children[3]],
        normalizeElement = [{x:6.25},{y:5.25},{val:4.25},{value:3.25}],
        customMap = {x:'customX'},
        mapElement = {customX:7.25};

    describe('#parse()', function(){

        var p = new dChart.Point1D();

        it ('should create 1D Point',function() {

            p.parse(element[0]);
            assert.deepEqual(new dChart.Point1D(5.25), p);

            p.parse(element[1]);
            assert.deepEqual(new dChart.Point1D(4.25), p);

            p.parse(element[2]);
            assert.deepEqual(new dChart.Point1D(3.25), p);

            p.parse(element[3]);
            assert.deepEqual(new dChart.Point1D(2.25), p);
        })
    })

    describe('#map()', function(){

        var p = new dChart.Point1D();

        it ('should create 1D Point',function() {

            p.map(mapElement,customMap);
            assert.deepEqual(new dChart.Point1D(7.25), p);
        })
    })

    describe('#normalize()', function(){

        var p = new dChart.Point1D();

        it ('should create 1D Point',function() {

            p.normalize(normalizeElement[0]);
            assert.deepEqual(new dChart.Point1D(6.25), p);

            p.normalize(normalizeElement[1]);
            assert.deepEqual(new dChart.Point1D(5.25), p);

            p.normalize(normalizeElement[2]);
            assert.deepEqual(new dChart.Point1D(4.25), p);

            p.normalize(normalizeElement[3]);
            assert.deepEqual(new dChart.Point1D(3.25), p);
        })
    })
})

describe('dChart.Point2D', function(){

    var elements = jsdom.jsdom("<div x='5.25' y='12.14'></div><div x='5.25' val='13.14'></div><div x='5.25' value='14.14'></div>"),
        element = [elements.children[0],elements.children[1],elements.children[2]],
        normalizeElement = [{x:6.25,y:13.14},{x:6.25,val:14.14},{x:6.25,value:15.14}],
        customMap = {x:'customX',y:'customY'},
        mapElement = {customX:7.25,customY:14.14};

    describe('#parse()', function(){

        var p = new dChart.Point2D();

        it ('should create 2D Point',function() {

            p.parse(element[0]);
            assert.deepEqual(new dChart.Point2D(5.25,12.14), p);

            p.parse(element[1]);
            assert.deepEqual(new dChart.Point2D(5.25,13.14), p);

            p.parse(element[2]);
            assert.deepEqual(new dChart.Point2D(5.25,14.14), p);
        })
    })

    describe('#map()', function(){

        var p = new dChart.Point2D();

        it ('should create 2D Point',function() {

            p.map(mapElement,customMap);
            assert.deepEqual(new dChart.Point2D(7.25,14.14), p);
        })
    })

    describe('#normalize()', function(){

        var p = new dChart.Point2D();

        it ('should create 2D Point',function() {

            p.normalize(normalizeElement[0]);
            assert.deepEqual(new dChart.Point2D(6.25,13.14), p);

            p.normalize(normalizeElement[1]);
            assert.deepEqual(new dChart.Point2D(6.25,14.14), p);

            p.normalize(normalizeElement[2]);
            assert.deepEqual(new dChart.Point2D(6.25,15.14), p);
        })
    })
})
{'fraction_non_alphanumeric': 0.16422947131608548, 'fraction_numerical': 0.03446160139073525, 'mean_word_length': 2.3700895933838733, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '4403485', 'n_tokens_mistral': 3225, 'n_tokens_neox': 3006, 'n_words': 525}