Added core changes and docs required for simm valuation demo.

This commit is contained in:
Clinton Alexander
2016-09-22 15:22:19 +01:00
parent 6d39b71bf9
commit 73a2215747
4 changed files with 126 additions and 0 deletions

View File

@ -0,0 +1,7 @@
package com.r3corda.core.math
import java.math.BigDecimal
fun Iterable<BigDecimal>.sum(): BigDecimal {
return this.fold(BigDecimal.valueOf(0)) { a: BigDecimal, b: BigDecimal -> a + b }
}

View File

@ -0,0 +1,14 @@
package com.r3corda.core.math
import org.junit.Test
import org.junit.Assert.*
import java.math.BigDecimal
class Utils {
@Test
fun sum() {
val calculated = listOf(BigDecimal.valueOf(1.0), BigDecimal.valueOf(5.0)).sum()
assert(calculated == BigDecimal.valueOf(6.0))
}
}