Brackets Function #25
Labels
No labels
blocked
duplicate
high priority
needs
approval
needs
criteria
needs
estimate
needs
tests
question
step
doing
step
review
step
testing
step
todo
step
uat
type
admin
type
alert
type
bug
type
change
type
defect
type
dependencies
type
development
type
documentation
type
epic
type
idea
type
incident
type
investigation
type
spike
type
story
type
tests
won't fix
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
RabbitLabs/calculator#25
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Epic: #21
Story Points: 5
AS a user, I want expressions with brackets to be evaluated correctly
SO THAT I can control the order of operations in multi-operation expressions
Acceptance Criteria
GIVEN #22 (multiple operations in one expression) is complete
WHEN I evaluate an expression containing brackets in CLI interactive mode
THEN bracketed sub-expressions are solved before the surrounding operations
GIVEN #22 is complete
WHEN I evaluate
(2 + 3) * 4THEN the result is
20GIVEN #22 is complete
WHEN I evaluate
2 + (3 * 4)THEN the result is
14GIVEN #22 is complete
WHEN I evaluate a nested bracketed expression such as
((2 + 3) * 2) - 1THEN each inner bracketed group is solved before outer operations and the result is
9GIVEN #22 is complete
WHEN I evaluate an expression with optional spaces such as
( 2 + 3 ) * 4THEN spaces are ignored and the result matches
(2 + 3) * 4GIVEN #22 is complete
WHEN I evaluate an expression with unclosed or unmatched brackets such as
(2 + 3or2 + 3)or((2 + 3)THEN a clear error message is shown and no result is produced
GIVEN #22 is complete
WHEN I run
calculator cli "(2 + 3) * 4"(single-expression mode)THEN
20is printed to stdoutGIVEN I am in GUI mode
WHEN I evaluate an expression containing brackets
THEN bracketed sub-expressions are solved before the surrounding operations, consistent with CLI behaviour
Subtasks
()Notes
Blocked by #22
@Smithy-bot This should have GUI controls also
Planning: criteria → estimate
Acceptance criteria on the issue body look complete (including GUI parity from your comment). needs/criteria is done; moving to needs/estimate for story points.
Note: Still blocked on #22 for implementation — that does not block sizing once #22 is assumed complete.
Story point estimate (needs/estimate)
Estimate: 5
Acceptance criteria are clear (CLI + single-expression + GUI parity, nesting, spacing, bracket errors). Implementation assumes #22 is done; the existing blocked label reflects delivery order, not sizing uncertainty.
()groups, nested evaluation before outer opsComparable to #22 (5 points) and other calculator 5-point engine stories (#30, #31). Square brackets remain out of scope per notes.
Advancing needs/estimate → needs/tests. Story Points set to 5 on the issue body.
QA test scripts (needs/tests)
Precondition: #22 (multiple operations in one expression) is merged and available in the build under test. This story remains blocked for implementation until then; run these scripts after the brackets feature ships.
Scope: Round brackets
()only. Operator precedence outside brackets follows #22 (left-to-right). Square brackets are out of scope.CLI — interactive mode
(2 + 3) * 4and submit.(2 + 3)evaluated before* 4.2 + (3 * 4)and submit.(3 * 4)evaluated before+ 2.((2 + 3) * 2) - 1and submit.( 2 + 3 ) * 4(extra spaces) and submit.(2 + 3) * 4.(2 + 3(unclosed) and submit.2 + 3)(unmatched close) and submit.((2 + 3)(extra open) and submit.CLI — single-expression mode
calculator cli "(2 + 3) * 4".calculator cli "((2 + 3) * 2) - 1".calculator cli "(2 + 3".GUI mode
(2 + 3) * 4using the same expression entry as other multi-op expressions.2 + (3 * 4)in GUI.((2 + 3) * 2) - 1in GUI.(2 + 3in GUI and attempt evaluate.Regression / parity
(2 + 3) * 4,2 + (3 * 4),( 2 + 3 ) * 4.2 + 3 * 4) still behaves per #22.Sign-off checklist
Advancing needs/tests → needs/approval for human sign-off before implementation work begins (delivery still ordered behind #22).