|
49 | 49 | "description": "should wrap operators with the same precedence in parenthesis when needed", |
50 | 50 | "tests": [ |
51 | 51 | { "input": ["multiply", 2, 3, 4], "output": "2 * 3 * 4" }, |
52 | | - { "input": ["multiply", ["multiply", 2, 3], 4], "output": "2 * 3 * 4" }, |
| 52 | + { "input": ["multiply", ["multiply", 2, 3], 4], "output": "(2 * 3) * 4" }, |
53 | 53 | { "input": ["multiply", 2, ["multiply", 3, 4]], "output": "2 * (3 * 4)" }, |
54 | 54 | { "input": ["divide", 2, 3, 4], "output": "2 / 3 / 4" }, |
55 | | - { "input": ["divide", ["divide", 2, 3], 4], "output": "2 / 3 / 4" }, |
| 55 | + { "input": ["divide", ["divide", 2, 3], 4], "output": "(2 / 3) / 4" }, |
56 | 56 | { "input": ["divide", 2, ["divide", 3, 4]], "output": "2 / (3 / 4)" }, |
57 | 57 | { "input": ["divide", ["multiply", 2, 3], 4], "output": "2 * 3 / 4" }, |
58 | 58 | { "input": ["divide", 2, ["multiply", 3, 4]], "output": "2 / (3 * 4)" }, |
|
63 | 63 | }, |
64 | 64 | { "input": ["multiply", ["divide", 2, 3], 4], "output": "2 / 3 * 4" }, |
65 | 65 | { "input": ["mod", 2, 3, 4], "output": "2 % 3 % 4" }, |
66 | | - { "input": ["mod", ["mod", 2, 3], 4], "output": "2 % 3 % 4" }, |
| 66 | + { "input": ["mod", ["mod", 2, 3], 4], "output": "(2 % 3) % 4" }, |
67 | 67 | { "input": ["mod", 2, ["mod", 3, 4]], "output": "2 % (3 % 4)" }, |
68 | 68 | { "input": ["mod", ["multiply", 2, 3], 4], "output": "2 * 3 % 4" }, |
69 | 69 | { "input": ["multiply", ["mod", 2, 3], 4], "output": "2 % 3 * 4" }, |
70 | 70 | { "input": ["add", 2, 3, 4], "output": "2 + 3 + 4" }, |
71 | | - { "input": ["add", ["add", 2, 3], 4], "output": "2 + 3 + 4" }, |
| 71 | + { "input": ["add", ["add", 2, 3], 4], "output": "(2 + 3) + 4" }, |
72 | 72 | { "input": ["add", 2, ["add", 3, 4]], "output": "2 + (3 + 4)" }, |
73 | 73 | { "input": ["subtract", 2, 3, 4], "output": "2 - 3 - 4" }, |
74 | | - { "input": ["subtract", ["subtract", 2, 3], 4], "output": "2 - 3 - 4" }, |
| 74 | + { "input": ["subtract", ["subtract", 2, 3], 4], "output": "(2 - 3) - 4" }, |
75 | 75 | { "input": ["subtract", 2, ["subtract", 3, 4]], "output": "2 - (3 - 4)" }, |
76 | 76 | { "input": ["subtract", ["add", 2, 3], 4], "output": "2 + 3 - 4" }, |
77 | 77 | { "input": ["subtract", 2, ["add", 3, 4]], "output": "2 - (3 + 4)" }, |
|
0 commit comments