Skip to content

Commit d2d632a

Browse files
Merge pull request #66 from jsuarezb/master
Uses Integer values when creating BigDecimal values to avoid the decimal point when calling toString
2 parents 7fb03f1 + 437e083 commit d2d632a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/scala/stdlib/Implicits.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ object Implicits extends FlatSpec with Matchers with org.scalaexercises.definiti
103103
def asDefaultImplicits(res0: BigDecimal) {
104104
def howMuchCanIMake_?(hours: Int)(implicit dollarsPerHour: BigDecimal) = dollarsPerHour * hours
105105

106-
implicit val hourlyRate = BigDecimal(34.00)
106+
implicit val hourlyRate = BigDecimal(34)
107107

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

117-
implicit val hourlyRate = BigDecimal(34.00)
117+
implicit val hourlyRate = BigDecimal(34)
118118
implicit val currencyName = "Dollars"
119119

120120
howMuchCanIMake_?(30) should be(res0)

src/test/scala/stdlib/ImplicitsSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ImplicitsSpec extends Spec with Checkers {
3535
}
3636

3737
def `implicits for default parameters` = {
38-
val fstAnswer: BigDecimal = 1020.0f
38+
val fstAnswer: BigDecimal = 1020
3939

4040
check(
4141
Test.testSuccess(
@@ -49,7 +49,7 @@ class ImplicitsSpec extends Spec with Checkers {
4949
check(
5050
Test.testSuccess(
5151
Implicits.listOfImplicitsImplicits _,
52-
"1020.0 Dollars" :: HNil
52+
"1020 Dollars" :: HNil
5353
)
5454
)
5555
}

0 commit comments

Comments
 (0)