-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ 【第13章 実装を導くテスト】 reduce メソッドで為替の変更ができるようにする
・plus の結果を確かめるために Sum クラスの被加算数と加数が一致することのテストを追加している
- Loading branch information
1 parent
9717542
commit 6b434b2
Showing
3 changed files
with
10 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { Expression } from './expression'; | ||
import { Money } from './money'; | ||
import { Sum } from './sum'; | ||
|
||
export class Bank { | ||
reduce(sum: Expression, currency: string):Money { | ||
return Money.dollar(10); | ||
reduce(source: Expression, to: string):Money { | ||
const sum = source as Sum | ||
const amount = sum.augend.amount + sum.addend.amount; | ||
return new Money(amount, to); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters