Add support for NumVariable expressions such as 2x fixes #6

This commit is contained in:
Mahdi Dibaiee
2015-06-18 16:14:13 +04:30
parent 2b3c06c413
commit c6973847aa
5 changed files with 111 additions and 22 deletions

View File

@ -23,6 +23,11 @@ describe('Equations', () => {
expect(equation).to.throw();
});
it('should work with NumVariable expressions like 2x', () => {
let equation = M.equation('2x + 6y');
expect(equation(4, 3)).to.equal(8 + 18);
});
it('Test case', () => {
let equation = M.equation('2+x*(y+4)+z^2');
expect(equation(2, 4, 3)).to.equal(27);