From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/math-expression-evaluator/LICENSE | 22 + node_modules/math-expression-evaluator/README.md | 88 +++ .../dist/browser/math-expression-evaluator.js | 636 +++++++++++++++++++++ .../dist/browser/math-expression-evaluator.min.js | 26 + .../math-expression-evaluator/package.json | 32 ++ .../src/formula_evaluator.js | 41 ++ .../math-expression-evaluator/src/lexer.js | 309 ++++++++++ .../math-expression-evaluator/src/math_function.js | 120 ++++ .../math-expression-evaluator/src/postfix.js | 50 ++ .../src/postfix_evaluator.js | 105 ++++ .../math-expression-evaluator/test/index.js | 171 ++++++ 11 files changed, 1600 insertions(+) create mode 100755 node_modules/math-expression-evaluator/LICENSE create mode 100755 node_modules/math-expression-evaluator/README.md create mode 100755 node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.js create mode 100755 node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.min.js create mode 100755 node_modules/math-expression-evaluator/package.json create mode 100755 node_modules/math-expression-evaluator/src/formula_evaluator.js create mode 100755 node_modules/math-expression-evaluator/src/lexer.js create mode 100755 node_modules/math-expression-evaluator/src/math_function.js create mode 100755 node_modules/math-expression-evaluator/src/postfix.js create mode 100755 node_modules/math-expression-evaluator/src/postfix_evaluator.js create mode 100755 node_modules/math-expression-evaluator/test/index.js (limited to 'node_modules/math-expression-evaluator') diff --git a/node_modules/math-expression-evaluator/LICENSE b/node_modules/math-expression-evaluator/LICENSE new file mode 100755 index 00000000..4fe6c913 --- /dev/null +++ b/node_modules/math-expression-evaluator/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Ankit G. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/math-expression-evaluator/README.md b/node_modules/math-expression-evaluator/README.md new file mode 100755 index 00000000..d394392b --- /dev/null +++ b/node_modules/math-expression-evaluator/README.md @@ -0,0 +1,88 @@ + + +# math-expression-evaluator +An extremely efficient, flexible and amazing evaluator for Math expression in Javascript.([Documentation](http://redhivesoftware.github.io/math-expression-evaluator/)) + +## Use cases +|Input|Result|Explanation| +|:---:|:---:| --- | +|**2+3-1**|4| Addition and Subtraction operator | +|**2\*5/10**|1| Multiplication and Division operator | +|**tan45** *or* **tan(45)**|1| Trigonometric Function ( tan in Degree mode) | +|**tan45** *or* **tan(45)**|1.619775190543862| Trigonometric Function ( tan in Radian mode) | +|**Pi1,15,n** *or* **Pi(1,15,n)**|1307674368000| Product of Sequence | +|**Sigma1,15,n** *or* **Sigma(1,15,n)**|120| Sum of Sequence( also called summation) | +|**2^3**|8| Exponent( note this operator is left associative like MS Office) | +|**5P3**|60| Permutaion Method to calculate all the permutaions | +|**sincostan90** *or* **sin(cos(tan(90)))**|0.017261434031253| Multiple functions with or without parenthesis (both works) | + +### [Fiddle Yourself](http://jsbin.com/fuyowu/1/edit?html,output) + +## Installation +### Node JS + **Using npm** + + npm install math-expression-evaluator + +### Browser + **Using bower** + + bower install math-expression-evaluator + +### How to run test + + npm test + +## Supported symbols + +|Symbol|Explanation| +|:---:|:---:| +|**+**| Addition Operator eg. 2+3 results 5 | +|**-**| Subtraction Operator eg. 2-3 results -1 | +|**/**| Division operator eg 3/2 results 1.5 | +|**\***| Multiplication Operator eg. 2\*3 results 6 | +|**Mod**| Modulus Operator eg. 3 Mod 2 results 1 | +|**(**| Opening Parenthesis | +|**)**| Closing Parenthesis | +|**Sigma**| Summation eg. Sigma(1,100,n) results 5050 | +|**Pi**| Product eg. Pi(1,10,n) results 3628800 | +|**n**| Variable for Summation or Product | +|**pi**| Math constant pi returns 3.14 | +|**e**| Math constant e returns 2.71 | +|**C**| Combination operator eg. 4C2 returns 6 | +|**P**| Permutation operator eg. 4P2 returns 12 | +|**!**| factorial operator eg. 4! returns 24 | +|**log**| logarithmic function with base 10 eg. log 1000 returns 3 | +|**ln**| natural log function with base e eg. ln 2 returns .3010 | +|**pow**| power function with two operator pow(2,3) returns 8 | +|**^**| power operator eg. 2^3 returns 8 | +|**root**| underroot function root 4 returns 2 | +|**sin**| Sine function | +|**cos**| Cosine function | +|**tan**| Tangent function | +|**asin**| Inverse Sine funtion | +|**acos**| Inverse Cosine funtion | +|**atan**| Inverse Tangent funtion | +|**sinh**| Hyperbolic Sine funtion | +|**cosh**| Hyperbolic Cosine funtion | +|**tanh**| Hyperbolic Tangent funtion | +|**asinh**| Inverse Hyperbolic Sine funtion | +|**acosh**| Inverse Hyperbolic Cosine funtion | +|**atanh**| Inverse Hyperbolic Tangent funtion | + +## Features + +### Amazing support for Sigma and Pi +This is a fantastic feature of this calculator that it is capable of evaluating expressions containing **Sigma and Pi**. +Passing `Sigma(1,100,n)` will evaluate to 5050 as n is summationed from 1 to 100. +and Pi(1,15,n) will evaluate to 1307674368000 as n is multiplied from 1 to 15 which is equal to 15! + +### Parenthesis less expression +If a expression is readable by human then it is readable by this evaluator. There is no need to wrap every function inside parenthesis. +For eg. sin90 will work totally fine instead of sin(90) + + +##Changelog + +### Removed lodash.indexof and used native Array.prototype.indexOf hence dropping suppports for IE8 and below. +This will reflect in next release named v1.2.16 diff --git a/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.js b/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.js new file mode 100755 index 00000000..74d8e672 --- /dev/null +++ b/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.js @@ -0,0 +1,636 @@ +/** math-expression-evaluator version 1.2.17 + Dated:2017-04-28 */ + +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mexp = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o"+pop2.value+""+arr[i].show+""+pop1.value+"",type:10}); + else disp.push({value:(pop2.type!=1?"(":"")+pop2.value+(pop2.type!=1?")":"")+""+pop1.value+"",type:1}); + } + else if(arr[i].type===2||arr[i].type===9){ + pop1=disp.pop(); + pop2=disp.pop(); + disp.push({value:(pop2.type!=1?"(":"")+pop2.value+(pop2.type!=1?")":"")+arr[i].show+(pop1.type!=1?"(":"")+pop1.value+(pop1.type!=1?")":""),type:arr[i].type}); + } + else if(arr[i].type===12){ + pop1=disp.pop(); + pop2=disp.pop(); + pop3=disp.pop(); + disp.push({value:arr[i].show+"("+pop3.value+","+pop2.value+","+pop1.value+")",type:12}); + } + } + return disp[0].value; +}; +module.exports=Mexp; +},{"./postfix_evaluator.js":5}],2:[function(require,module,exports){ +var Mexp=require('./math_function.js'); + function inc(arr,val){ + for(var i=0;i(newAr.length-2)?newAr.length-1:inpStr.length-i);x>0;x--){ + for(y=0;yprep)stack.push(elem); + else { + while(prep>=pre&&!flag||flag&&pre1) { + throw(new Mexp.exception("Uncaught Syntax error")); + } + return stack[0].value>1000000000000000?"Infinity":parseFloat(stack[0].value.toFixed(15)); +}; +Mexp.eval=function(str,tokens,obj){ + if (typeof tokens==="undefined") { + return this.lex(str).toPostfix().postfixEval(); + } + else if (typeof obj==="undefined") { + if (typeof tokens.length!=="undefined") + return this.lex(str,tokens).toPostfix().postfixEval(); + else + return this.lex(str).toPostfix().postfixEval(tokens); + } + else + return this.lex(str,tokens).toPostfix().postfixEval(obj); +}; +module.exports=Mexp; +},{"./postfix.js":4}]},{},[1])(1) +}); \ No newline at end of file diff --git a/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.min.js b/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.min.js new file mode 100755 index 00000000..0e4520ea --- /dev/null +++ b/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.min.js @@ -0,0 +1,26 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) Ankit + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions:

+ * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +/** math-expression-evaluator version 1.2.17 + Dated:2017-04-28 */ +!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.mexp=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g"+b.value+""+e[f].show+""+a.value+"",type:10}):d.push({value:(1!=b.type?"(":"")+b.value+(1!=b.type?")":"")+""+a.value+"",type:1})):2===e[f].type||9===e[f].type?(a=d.pop(),b=d.pop(),d.push({value:(1!=b.type?"(":"")+b.value+(1!=b.type?")":"")+e[f].show+(1!=a.type?"(":"")+a.value+(1!=a.type?")":""),type:e[f].type})):12===e[f].type&&(a=d.pop(),b=d.pop(),c=d.pop(),d.push({value:e[f].show+"("+c.value+","+b.value+","+a.value+")",type:12}));return d[0].value},b.exports=d},{"./postfix_evaluator.js":5}],2:[function(a,b,c){function d(a,b){for(var c=0;cs.length-2?s.length-1:x.length-i;t>0;t--)for(u=0;uc)h.push(a);else{for(;c>=e&&!k||k&&e1)throw new d.exception("Uncaught Syntax error");return f[0].value>1e15?"Infinity":parseFloat(f[0].value.toFixed(15))},d.eval=function(a,b,c){return"undefined"==typeof b?this.lex(a).toPostfix().postfixEval():"undefined"==typeof c?"undefined"!=typeof b.length?this.lex(a,b).toPostfix().postfixEval():this.lex(a).toPostfix().postfixEval(b):this.lex(a,b).toPostfix().postfixEval(c)},b.exports=d},{"./postfix.js":4}]},{},[1])(1)}); \ No newline at end of file diff --git a/node_modules/math-expression-evaluator/package.json b/node_modules/math-expression-evaluator/package.json new file mode 100755 index 00000000..74088c64 --- /dev/null +++ b/node_modules/math-expression-evaluator/package.json @@ -0,0 +1,32 @@ +{ + "name": "math-expression-evaluator", + "version": "1.2.17", + "description": "A flexible math expression evaluator", + "main": "src/formula_evaluator.js", + "scripts": { + "test": "mocha" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/redhivesoftware/math-expression-evaluator#readme" + }, + "keywords": [ + "math", + "expression", + "evaluator", + "parser" + ], + "author": "Ankit", + "license": "MIT", + "bugs": { + "url": "https://github.com/redhivesoftware/math-expression-evaluator/issues" + }, + "homepage": "https://github.com/redhivesoftware/math-expression-evaluator#readme", + "devDependencies": { + "grunt": "^0.4.5", + "grunt-browserify": "^3.8.0", + "grunt-contrib-jshint": "^0.11.2", + "grunt-contrib-uglify": "^0.9.1", + "mocha": "^2.2.5" + } +} diff --git a/node_modules/math-expression-evaluator/src/formula_evaluator.js b/node_modules/math-expression-evaluator/src/formula_evaluator.js new file mode 100755 index 00000000..72db4eb5 --- /dev/null +++ b/node_modules/math-expression-evaluator/src/formula_evaluator.js @@ -0,0 +1,41 @@ +var Mexp=require('./postfix_evaluator.js'); +Mexp.prototype.formulaEval = function () { + "use strict"; + var stack=[],pop1,pop2,pop3; + var disp=[]; + var temp=''; + var arr=this.value; + for(var i=0;i"+pop2.value+""+arr[i].show+""+pop1.value+"",type:10}); + else disp.push({value:(pop2.type!=1?"(":"")+pop2.value+(pop2.type!=1?")":"")+""+pop1.value+"",type:1}); + } + else if(arr[i].type===2||arr[i].type===9){ + pop1=disp.pop(); + pop2=disp.pop(); + disp.push({value:(pop2.type!=1?"(":"")+pop2.value+(pop2.type!=1?")":"")+arr[i].show+(pop1.type!=1?"(":"")+pop1.value+(pop1.type!=1?")":""),type:arr[i].type}); + } + else if(arr[i].type===12){ + pop1=disp.pop(); + pop2=disp.pop(); + pop3=disp.pop(); + disp.push({value:arr[i].show+"("+pop3.value+","+pop2.value+","+pop1.value+")",type:12}); + } + } + return disp[0].value; +}; +module.exports=Mexp; \ No newline at end of file diff --git a/node_modules/math-expression-evaluator/src/lexer.js b/node_modules/math-expression-evaluator/src/lexer.js new file mode 100755 index 00000000..14755671 --- /dev/null +++ b/node_modules/math-expression-evaluator/src/lexer.js @@ -0,0 +1,309 @@ +var Mexp=require('./math_function.js'); + function inc(arr,val){ + for(var i=0;i(newAr.length-2)?newAr.length-1:inpStr.length-i);x>0;x--){ + for(y=0;yprep)stack.push(elem); + else { + while(prep>=pre&&!flag||flag&&pre1) { + throw(new Mexp.exception("Uncaught Syntax error")); + } + return stack[0].value>1000000000000000?"Infinity":parseFloat(stack[0].value.toFixed(15)); +}; +Mexp.eval=function(str,tokens,obj){ + if (typeof tokens==="undefined") { + return this.lex(str).toPostfix().postfixEval(); + } + else if (typeof obj==="undefined") { + if (typeof tokens.length!=="undefined") + return this.lex(str,tokens).toPostfix().postfixEval(); + else + return this.lex(str).toPostfix().postfixEval(tokens); + } + else + return this.lex(str,tokens).toPostfix().postfixEval(obj); +}; +module.exports=Mexp; \ No newline at end of file diff --git a/node_modules/math-expression-evaluator/test/index.js b/node_modules/math-expression-evaluator/test/index.js new file mode 100755 index 00000000..235a30d5 --- /dev/null +++ b/node_modules/math-expression-evaluator/test/index.js @@ -0,0 +1,171 @@ +// This test is for node JS + +var assert = require('assert'); +var a=require("../src/formula_evaluator.js"); +describe('Testing Unit', function () { + it('should equal 2 to check a number', function () { + assert.equal(a.lex("2").toPostfix().postfixEval(),2); + }); + it('checks a math function', function () { + assert.equal(a.lex("tan(180)").toPostfix().postfixEval(),0); + }); + it('checks a parenthesis less function', function () { + assert.equal(a.lex("sin180").toPostfix().postfixEval(),0); + }); + it('checks a parenthesis less function after a space', function () { + assert.equal(a.lex("cos 180").toPostfix().postfixEval(),-1); + }); + it('checks a parenthesis less function after multiple spaces', function () { + assert.equal(a.lex("cos 180").toPostfix().postfixEval(),-1); + }); + it('checks consecutive operator', function () { + assert.equal(a.lex("0+-2").toPostfix().postfixEval(),-2); + }); + it('checks ^ operator', function () { + assert.equal(a.lex("2^2").toPostfix().postfixEval(),4); + }); + it('checks when * is omitted before parenthesis and after', function () { + assert.equal(a.lex("2(7-4)3").toPostfix().postfixEval(),18); + }); + it('checks multiplication and exponential in series', function () { + assert.equal(a.lex("2*7^2").toPostfix().postfixEval(),98); + }); + it('checks exponential and multiplication in series', function () { + assert.equal(a.lex("2^5*2").toPostfix().postfixEval(),64); + }); + it('-3^2=-9', function () { + assert.equal(a.lex("-3^2").toPostfix().postfixEval(),-9); + }); + it('3^2-2^2=5', function () { + assert.equal(a.lex("3^2-2^2").toPostfix().postfixEval(),5); + }); + + it('formula test', function () { + assert.equal(a.lex("2").toPostfix().formulaEval(),2); + }); + it('formula test', function () { + assert.equal(a.lex("sinpi").toPostfix().formulaEval(),"sin(π)"); + }); + it('formula test', function () { + assert.equal(a.lex("cos pi").toPostfix().formulaEval(),"cos(π)"); + }); + it('formula test', function () { + assert.equal(a.lex("tan(pi)").toPostfix().formulaEval(),"tan(π)"); + }); + it('formula test', function () { + assert.equal(a.lex("2(7-4)3").toPostfix().formulaEval(),"(2×(7-4))×3"); + }); + it('test to check the bug when number contains decimal', function () { + assert.equal(a.lex("int2.3").toPostfix().postfixEval(),"2"); + }); + it('test to check auto correct of parenthesis mismatch if opening>closing', function () { + assert.equal(a.lex("(2+(3-4").toPostfix().postfixEval(),"1"); + }); + it('check for negative of a constant', function () { + assert.equal(a.lex("-e").toPostfix().postfixEval(),-Math.E); + }); + it('check for constant inside Sigma', function () { + assert.equal(a.lex("Sigma1,3,2",[{type:3,preced:0,ev:"x",show:"x",token:"x"}]).toPostfix().postfixEval({x:2}),6); + }); + it('check when arithmetic and n are present inside sigma', function () { + assert.equal(a.lex("Sigma1,2,n").toPostfix().postfixEval(),3); + }); + it(' should check when 4C3', function () { + assert.equal(a.lex("4C3").toPostfix().postfixEval(),4); + }); + it('check when arithmetic and n are present inside sigma', function () { + assert.equal(a.lex("Sigma1,2,(n*n)").toPostfix().postfixEval(),5); + }); + + it('check when two parenthesis less functions are consecutive on one parameter', function () { + assert.equal(a.lex("sinint2.5").toPostfix().postfixEval(),a.lex("sin(int(2.5))").toPostfix().postfixEval()); + }); + + it('check eval method with single argument', function () { + assert.equal(a.eval("5*3"),"15"); + }); + it('check eval method with three argument', function () { + assert.equal(a.eval("mexp*3",[{type:3,show:"mexp",token:"mexp",value:"mexp",preced:0}],{mexp:5}),"15"); + }); + it('check eval method with two argument when second one is value of constants', function () { + a.addToken([{type:3,show:"mexp",value:"mexp",preced:0,token:"mexp"}]); + assert.equal(a.eval("mexp*3",{mexp:5}),"15"); + }); + it('check eval method with two argument when second one is value of constants', function () { + a.addToken([{type:0,show:"mexp",value:function(a){return 5*a;},preced:11,token:"mexp"}]); + assert.equal(a.lex("mexp3").toPostfix().postfixEval(),"15"); + }); + it('check eval method with two argument when second one is token list', function () { + assert.equal(a.eval("mexp(3)",[{type:0,show:"mexp(",value:function(a){return 5*a;},preced:11,token:"mexp"}]),"15"); + }); + it('Pi', function () { + assert.equal(a.eval("Pi1,5,n"),"120"); + }); + it('tan5(6+3)', function () { + assert.equal(a.eval("tan5(6+3)"),"1"); + }); + it('tan(40+5)', function () { + assert.equal(a.eval("tan(40+5)"),"1"); + }); + it('checks when a 0 is missing in a decimal number', function () { + assert.equal(a.eval("5*.8"),"4"); + }); + it('checks root function', function () { + assert.equal(a.eval("root4"),"2"); + }); + it('checks + precedence before number insise parenthesis ', function () { + assert.equal(a.eval("(-2)"),"-2"); + }); + it('checks multiple allowable operator', function () { + assert.equal(a.eval("2+++-++-+-+3"),"-1"); + assert.equal(a.eval("2*+3"),"6"); + }); +}); +describe('These expression will check for types of returned result', function () { + it('should tell to compllete expression', function () { + assert.equal(typeof a.eval('0'), 'number') + }); +}); +describe('These expression will raise error', function () { + it('should tell to compllete expression', function () { + try{ + a.eval("2*") + } + catch(e){ + assert.equal(e.message,"complete the expression") + } + }); + it('should warn about multiple operators', function () { + try{ + a.eval("2**3") + } + catch(e){ + assert.equal(e.message,"* is not allowed after *") + } + }); + it('should warn about multiple operators', function () { + try{ + a.eval("2*Mod*3") + } + catch(e){ + assert.equal(e.message,"Mod is not allowed after *") + } + }); + it('should warn about operator inside parenthesis', function () { + try{ + a.eval("(+)") + } + catch(e){ + assert.equal(e.message,") is not allowed after +") + } + }); + it('should warn about operator inside parenthesis', function () { + try{ + a.eval("(+)") + } + catch(e){ + assert.equal(e.message,") is not allowed after +") + } + }); + +}); -- cgit v1.2.3