{"size": 3076, "ext": "js", "max_stars_repo_path": "test/comparision-expression/feel-comparision-expression.parse.spec.js", "max_stars_repo_name": "madbonez/dmn-processor", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/comparision-expression/feel-comparision-expression.parse.spec.js", "max_issues_repo_name": "madbonez/dmn-processor", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/comparision-expression/feel-comparision-expression.parse.spec.js", "max_forks_repo_name": "madbonez/dmn-processor", "max_forks_repo_forks_event_min_datetime": "2022-03-29T08:31:22.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-29T09:03:09.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 29.2952380952, "max_line_length": 87, "alphanum_fraction": 0.5458387516}
/*
*
*  ©2016-2017 EdgeVerve Systems Limited (a fully owned Infosys subsidiary),
*  Bangalore, India. All Rights Reserved.
*
*/
var chalk = require('chalk');
var chai = require('chai');
var expect = chai.expect;
var FEEL = require('../../dist/feel');

describe(chalk.blue('Comparision expression grammar test'), function () {

    it('Successfully creates ast from simple comparision expression', function (done) {
        var text = '5 in (<= 5)';

        try {
            var parsedGrammar = FEEL.parse(text);
            expect(parsedGrammar).not.to.be.undefined;
        } catch (e) {
            expect(parsedGrammar).not.to.be.undefined;
            expect(e).to.be.undefined;
        }
        done();
    });

    it('Successfully creates ast from comparision expression', function (done) {
        var text = '5 in ((5..10])';

        try {
            var parsedGrammar = FEEL.parse(text);
            expect(parsedGrammar).not.to.be.undefined;
        } catch (e) {
            expect(parsedGrammar).not.to.be.undefined;
            expect(e).to.be.undefined;
        }
        done();
    });

    it('Successfully creates ast from comparision expression', function (done) {
        var text = '5 in ([5..10])';

        try {
            var parsedGrammar = FEEL.parse(text);
            expect(parsedGrammar).not.to.be.undefined;
        } catch (e) {
            expect(parsedGrammar).not.to.be.undefined;
            expect(e).to.be.undefined;
        }
        done();
    });

    it('Successfully creates ast from comparision expression', function (done) {
        var text = '5 in (4,5,6)';

        try {
            var parsedGrammar = FEEL.parse(text);
            expect(parsedGrammar).not.to.be.undefined;
        } catch (e) {
            expect(parsedGrammar).not.to.be.undefined;
            expect(e).to.be.undefined;
        }
        done();
    });

    it('Successfully creates ast from comparision expression', function (done) {
        var text = '5 in (<5,>5)';

        try {
            var parsedGrammar = FEEL.parse(text);
            expect(parsedGrammar).not.to.be.undefined;
        } catch (e) {
            expect(parsedGrammar).not.to.be.undefined;
            expect(e).to.be.undefined;
        }
        done();
    });

    it('Successfully creates ast from comparision expression', function (done) {
        var text = '(a + 5) >= (7 + g)';

        try {
            var parsedGrammar = FEEL.parse(text);
            expect(parsedGrammar).not.to.be.undefined;
        } catch (e) {
            expect(parsedGrammar).not.to.be.undefined;
            expect(e).to.be.undefined;
        }
        done();
    });

    it('Successfully creates ast from comparision expression', function (done) {
        var text = '(a+b) between (c + d) and (e - f)';

        try {
            var parsedGrammar = FEEL.parse(text);
            expect(parsedGrammar).not.to.be.undefined;
        } catch (e) {
            expect(parsedGrammar).not.to.be.undefined;
            expect(e).to.be.undefined;
        }
        done();
    });
});
