48 lines
1.6 KiB
Markdown
48 lines
1.6 KiB
Markdown
---
|
|
epic: 3
|
|
story: 3.5
|
|
title: "Multi-Currency Arithmetic"
|
|
status: draft
|
|
---
|
|
|
|
## Epic 3 — Currency & Cryptocurrency
|
|
**Goal:** Real-time and historical currency conversion with 180+ fiat and 50+ crypto.
|
|
|
|
### Story 3.5: Multi-Currency Arithmetic
|
|
|
|
As a CalcPad user,
|
|
I want to add and subtract amounts in different currencies within a single expression,
|
|
So that I can calculate totals across currencies without manual conversions.
|
|
|
|
**Acceptance Criteria:**
|
|
|
|
**Given** the expression `$20 + €15 + £10 in BRL`
|
|
**When** the engine evaluates it
|
|
**Then** each amount is converted to BRL using current rates
|
|
**And** the results are summed to produce a single BRL total
|
|
|
|
**Given** the expression `$100 - €30`
|
|
**When** the engine evaluates it
|
|
**Then** `€30` is converted to USD (the currency of the left-hand operand)
|
|
**And** the result is expressed in USD
|
|
|
|
**Given** the expression `$50 + $30`
|
|
**When** the engine evaluates it
|
|
**Then** no conversion is needed (same currency)
|
|
**And** the result is `$80`
|
|
|
|
**Given** the expression `$20 + €15 + £10` with no explicit target currency
|
|
**When** the engine evaluates it
|
|
**Then** all amounts are converted to the currency of the first operand (USD)
|
|
**And** the result is expressed in USD
|
|
|
|
**Given** the expression `$20 * €15`
|
|
**When** the engine evaluates it
|
|
**Then** it returns a `CalcResult::Error` because multiplying two currency values is not meaningful
|
|
**And** the error message is descriptive
|
|
|
|
**Given** the expression `($100 + €50) * 2 in GBP`
|
|
**When** the engine evaluates it
|
|
**Then** the addition is performed first (converting EUR to USD), then multiplied by 2, then converted to GBP
|
|
**And** the result is a single GBP value
|