Skip to content

Commit

Permalink
tests: add test for nested function calls with exponents and units
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreminger committed Jan 8, 2025
1 parent 3643dc2 commit 0ba5eba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion public/dimensional_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,6 @@ def get_next_id(self):

global_placeholder_set = set(global_placeholder_map.keys())
dummy_var_placeholder_set = (Function('_Derivative'), Function('_Integral'))
dim_needs_values_wrapper_placeholder_set = (Function('_Pow'), Function('_IndexMatrix'))
placeholder_inverse_map = { value["sympy_func"]: key for key, value in reversed(global_placeholder_map.items()) }
placeholder_inverse_set = set(placeholder_inverse_map.keys())

Expand Down
16 changes: 16 additions & 0 deletions tests/test_basic.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,22 @@ test('Test function notation with exponents and units', async () => {

});

test('Test function notation with exponents and units and nested functions', async () => {

await page.setLatex(0, String.raw`t\left(s=y\left(x=2\left\lbrack in\right\rbrack\right)\cdot1\left\lbrack in\right\rbrack\right)=`);
await page.click('#add-math-cell');
await page.setLatex(1, String.raw`t=2^{\frac{s}{1\left\lbrack in\right\rbrack}}`);
await page.click('#add-math-cell');
await page.setLatex(2, String.raw`y=3^{\frac{x}{1\left\lbrack in\right\rbrack}}`);

await page.waitForSelector('text=Updating...', {state: 'detached'});

let content = await page.textContent('#result-value-0');
expect(parseLatexFloat(content)).toBeCloseTo(512, precision-1);
content = await page.textContent('#result-units-0');
expect(content).toBe('');
});


test('Test function notation with integrals', async () => {

Expand Down

0 comments on commit 0ba5eba

Please sign in to comment.