LemaireEmilien / calculator-cucumber-2024

This repository is used for teaching purposes at the University of Mons. It contains Java code for computing arithmetic expressions. The code uses design patterns and is accompanied with JavaDoc, unit tests and BDD scenarios. We have also paid particular attention to code quality.
0 stars 0 forks source link

[BUG] heterogenous use of in-/post-/prefix notation #3

Closed Super-JK closed 7 months ago

Super-JK commented 7 months ago

Describe the bug The current implementation has a bug in how to output expression in prefix and postfix notation.

Expected behavior If one declares a top-level expression to be of prefix notation for example, then the subexpressions may still use a different notation (e.g. prefix or postfix). This does not make much sense. It is the expression as a whole that needs to be printed using a single notation. It should not be the intention to create expressions that contain a mix of different notations such as (( 3 + 4 + 5 ), - ( 5, 4 ), 7) /

Tests needed Alongside fixing this bug, a test should be added to detect it, as it is not currently caught by the existing tests. More generally speaking, there are currently no tests for composite expressions with a hierarchy depth higher than one. Such tests need to be added as well.

Related issues This bug issue is related to refactoring issue #4 . In principle, if issue number #4 (which is a proposal to refactor the notation code) would be implemented, this particular bug will no longer be present. (But its presence or absence still remains to be tested though...)