This commit is contained in:
Mike Hearn 2016-03-21 16:35:46 +00:00
commit a624ef7ff5
4 changed files with 12 additions and 6 deletions

View File

@ -58,7 +58,7 @@ data class Amount(val pennies: Long, val currency: Currency) : Comparable<Amount
operator fun div(other: Int): Amount = Amount(pennies / other, currency)
operator fun times(other: Int): Amount = Amount(Math.multiplyExact(pennies, other.toLong()), currency)
override fun toString(): String = currency.currencyCode + " " + (BigDecimal(pennies) / BigDecimal(100)).toPlainString()
override fun toString(): String = currency.currencyCode + " " + (BigDecimal(pennies).divide(BigDecimal(100))).setScale(2).toPlainString()
override fun compareTo(other: Amount): Int {
checkCurrency(other)

View File

@ -10,9 +10,17 @@ package core
import org.junit.Test
import java.time.LocalDate
import java.util.*
class FinanceTypesTest {
@Test
fun `make sure Amount has decimal places`() {
var x = Amount(1, Currency.getInstance("USD"))
assert("0.01" in x.toString())
}
@Test
fun `schedule generator 1`() {
var ret = BusinessCalendar.createGenericSchedule(startDate = LocalDate.of(2014, 11, 25), period = Frequency.Monthly, noOfAdditionalPeriods = 3)

View File

@ -162,7 +162,7 @@
then clicking &#8220;Install JetBrains plugin&#8221;, then searching for Kotlin, then hitting &#8220;Upgrade&#8221; and then &#8220;Restart&#8221;.</p>
<p>Choose &#8220;Check out from version control&#8221; and use this git URL</p>
<blockquote>
<div><a class="reference external" href="https://your_username&#64;bitbucket.org/R3-CEV/r3repository.git">https://your_username&#64;bitbucket.org/R3-CEV/r3repository.git</a></div></blockquote>
<div><a class="reference external" href="https://your_username&#64;bitbucket.org/R3-CEV/r3prototyping.git">https://your_username&#64;bitbucket.org/R3-CEV/r3prototyping.git</a></div></blockquote>
<p>Agree to the defaults for importing a Gradle project. Wait for it to think and download the dependencies.</p>
<p>Right click on the tests directory, click &#8220;Run -&gt; All Tests&#8221; (note: NOT the first item in the submenu that has the
gradle logo next to it).</p>
@ -260,4 +260,4 @@ found at something like</p>
</body>
</html>
</html>

View File

@ -7,9 +7,7 @@ if [ ! -e ./gradlew ]; then
exit 1
fi
if [ ! -d build/install/r3prototyping ]; then
./gradlew installDist
fi
./gradlew installDist
if [[ "$mode" == "buyer" ]]; then
if [ ! -d buyer ]; then