Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses Integer values when creating BigDecimal values to avoid the decimal point when calling toString #66

Merged
merged 1 commit into from
Dec 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/scala/stdlib/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ object Implicits extends FlatSpec with Matchers with org.scalaexercises.definiti
def asDefaultImplicits(res0: BigDecimal) {
def howMuchCanIMake_?(hours: Int)(implicit dollarsPerHour: BigDecimal) = dollarsPerHour * hours

implicit val hourlyRate = BigDecimal(34.00)
implicit val hourlyRate = BigDecimal(34)

howMuchCanIMake_?(30) should be(res0)
}
Expand All @@ -116,7 +116,7 @@ object Implicits extends FlatSpec with Matchers with org.scalaexercises.definiti
def howMuchCanIMake_?(hours: Int)(implicit amount: BigDecimal, currencyName: String) =
(amount * hours).toString() + " " + currencyName

implicit val hourlyRate = BigDecimal(34.00)
implicit val hourlyRate = BigDecimal(34)
implicit val currencyName = "Dollars"

howMuchCanIMake_?(30) should be(res0)
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/stdlib/ImplicitsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ImplicitsSpec extends Spec with Checkers {
}

def `implicits for default parameters` = {
val fstAnswer: BigDecimal = 1020.0f
val fstAnswer: BigDecimal = 1020

check(
Test.testSuccess(
Expand All @@ -49,7 +49,7 @@ class ImplicitsSpec extends Spec with Checkers {
check(
Test.testSuccess(
Implicits.listOfImplicitsImplicits _,
"1020.0 Dollars" :: HNil
"1020 Dollars" :: HNil
)
)
}
Expand Down