| 2 | import type { MathJsonExpression as Expression } from '../../src/math-json/types'; |
| 3 | |
| 4 | function check( |
| 5 | latex: string, |
| 6 | expected: Expression, |
| 7 | options?: { simplify?: boolean; assume?: string[] } |
| 8 | ): void { |
| 9 | const ce = engine; |
| 10 | ce.pushScope(); |
| 11 | try { |
| 12 | if (options?.assume) { |
| 13 | for (const a of options.assume) ce.assume(ce.parse(a)); |
| 14 | } |
| 15 | const expr = ce.parse(latex); |
| 16 | const result = options?.simplify ? expr.simplify() : expr; |
| 17 | expect(result.json).toEqual(expected); |
| 18 | } finally { |
| 19 | ce.popScope(); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | describe('Power Combination (#176)', () => { |
| 24 | test('numeric base with symbolic exponent', () => { |