(left, right, rules, scope, opt, stringOpt)
| 6 | const expLibrary = [] |
| 7 | // eslint-disable-next-line mocha/no-exports |
| 8 | export function simplifyAndCompare (left, right, rules, scope, opt, stringOpt) { |
| 9 | expLibrary.push(left) |
| 10 | let simpLeft |
| 11 | try { |
| 12 | if (Array.isArray(rules)) { |
| 13 | if (opt) { |
| 14 | simpLeft = math.simplify(left, rules, scope, opt) |
| 15 | } else if (scope) { |
| 16 | simpLeft = math.simplify(left, rules, scope) |
| 17 | } else { |
| 18 | simpLeft = math.simplify(left, rules) |
| 19 | } |
| 20 | } else { |
| 21 | if (opt) stringOpt = opt |
| 22 | if (scope) opt = scope |
| 23 | if (rules) scope = rules |
| 24 | if (opt) { |
| 25 | simpLeft = math.simplify(left, scope, opt) |
| 26 | } else if (scope) { |
| 27 | simpLeft = math.simplify(left, scope) |
| 28 | } else { |
| 29 | simpLeft = math.simplify(left) |
| 30 | } |
| 31 | } |
| 32 | } catch (err) { |
| 33 | if (err instanceof Error) { |
| 34 | console.log(err.stack) |
| 35 | } else { |
| 36 | console.log(new Error(err)) |
| 37 | } |
| 38 | throw err |
| 39 | } |
| 40 | assert.strictEqual( |
| 41 | simpLeft.toString(stringOpt), math.parse(right).toString(stringOpt)) |
| 42 | } |
| 43 | |
| 44 | describe('simplify', function () { |
| 45 | function simplifyAndCompareEval (left, right, scope) { |
no test coverage detected
searching dependent graphs…