Testing: Fix the wallet filler code.

This commit is contained in:
Mike Hearn 2016-06-24 14:57:24 +02:00
parent 8b24acf69e
commit 2dfcff1f31
2 changed files with 3 additions and 2 deletions

View File

@ -71,11 +71,12 @@ private fun calculateRandomlySizedAmounts(howMuch: Amount<Currency>, min: Int, m
if (i < numStates - 1) {
// Adjust the amount a bit up or down, to give more realistic amounts (not all identical).
amounts[i] = baseSize + (baseSize / 2 * (rng.nextDouble() - 0.5)).toLong()
filledSoFar += baseSize
filledSoFar += amounts[i]
} else {
// Handle inexact rounding.
amounts[i] = howMuch.quantity - filledSoFar
}
}
check(amounts.sum() == howMuch.quantity)
return amounts
}

View File

@ -58,7 +58,7 @@ class WalletWithCashTest {
assertEquals(29.01.DOLLARS `issued by` myPartyRef, state.amount)
assertEquals(ALICE_PUBKEY, state.owner)
assertEquals(33.34.DOLLARS `issued by` myPartyRef, (w.states[2].state.data as Cash.State).amount)
assertEquals(35.38.DOLLARS `issued by` myPartyRef, (w.states[2].state.data as Cash.State).amount)
assertEquals(35.61.DOLLARS `issued by` myPartyRef, (w.states[1].state.data as Cash.State).amount)
}