mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
universal: pretty print
This commit is contained in:
parent
306a3cdff7
commit
bfd7aa4fc2
@ -78,6 +78,25 @@ private class PrettyPrint(arr : Arrangement) {
|
||||
print(" or ")
|
||||
prettyPrintPerBoolean(per.right)
|
||||
}
|
||||
is PerceivableAnd -> {
|
||||
prettyPrintPerBoolean(per.left)
|
||||
print(" and ")
|
||||
prettyPrintPerBoolean(per.right)
|
||||
}
|
||||
is TimePerceivable -> {
|
||||
when (per.cmp) {
|
||||
Comparison.GT, Comparison.GTE -> {
|
||||
print("after(")
|
||||
prettyPrintPerInstant(per.instant)
|
||||
print(")")
|
||||
}
|
||||
Comparison.LT, Comparison.LTE -> {
|
||||
print("before(")
|
||||
prettyPrintPerInstant(per.instant)
|
||||
print(")")
|
||||
}
|
||||
}
|
||||
}
|
||||
is ActorPerceivable -> {
|
||||
print("signedBy(${partyMap[per.actor.owningKey]})")
|
||||
}
|
||||
@ -113,6 +132,11 @@ private class PrettyPrint(arr : Arrangement) {
|
||||
}
|
||||
prettyPrintPerBD(per.right)
|
||||
}
|
||||
is UnaryPlus -> {
|
||||
print("(")
|
||||
prettyPrintPerBD(per.arg)
|
||||
print(".).plus()")
|
||||
}
|
||||
is Const -> {
|
||||
print(per.value)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ private fun involvedPartiesVisitor(action: Action): Set<Party> =
|
||||
private fun involvedPartiesVisitor(arrangement: Arrangement): ImmutableSet<Party> =
|
||||
when (arrangement) {
|
||||
is Zero -> ImmutableSet.of<Party>()
|
||||
is Obligation -> ImmutableSet.of(arrangement.from)
|
||||
is Obligation -> ImmutableSet.of(arrangement.from, arrangement.to)
|
||||
is RollOut -> involvedPartiesVisitor(arrangement.template)
|
||||
is Continuation -> ImmutableSet.of<Party>()
|
||||
is And ->
|
||||
|
@ -314,5 +314,11 @@ class Cap {
|
||||
@Test @Ignore
|
||||
fun `pretty print`() {
|
||||
println ( prettyPrint(contractInitial) )
|
||||
|
||||
println ( prettyPrint(contractAfterFixingFirst) )
|
||||
|
||||
println ( prettyPrint(contractAfterExecutionFirst) )
|
||||
|
||||
println ( prettyPrint(contractAfterFixingFinal) )
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import net.corda.core.contracts.FixOf
|
||||
import net.corda.core.contracts.Tenor
|
||||
import net.corda.core.utilities.DUMMY_NOTARY
|
||||
import net.corda.testing.transaction
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import java.time.Instant
|
||||
import java.time.LocalDate
|
||||
@ -131,4 +132,14 @@ class Caplet {
|
||||
}
|
||||
}
|
||||
|
||||
@Test @Ignore
|
||||
fun `pretty print`() {
|
||||
println ( prettyPrint(contract) )
|
||||
|
||||
println ( prettyPrint(contractFixed) )
|
||||
|
||||
println ( prettyPrint(contractFinal) )
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package net.corda.contracts.universal
|
||||
|
||||
import net.corda.core.utilities.DUMMY_NOTARY
|
||||
import net.corda.testing.transaction
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import java.time.Instant
|
||||
|
||||
@ -132,4 +133,14 @@ class FXFwdTimeOption
|
||||
this.verifies()
|
||||
}
|
||||
}
|
||||
|
||||
@Test @Ignore
|
||||
fun `pretty print`() {
|
||||
println ( prettyPrint(initialContract) )
|
||||
|
||||
println ( prettyPrint(outContract1) )
|
||||
|
||||
println ( prettyPrint(outContract2) )
|
||||
}
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package net.corda.contracts.universal
|
||||
|
||||
import net.corda.core.utilities.DUMMY_NOTARY
|
||||
import net.corda.testing.transaction
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import java.time.Instant
|
||||
|
||||
@ -175,4 +176,10 @@ class FXSwap {
|
||||
this `fails with` "output states must match action result state"
|
||||
}
|
||||
}
|
||||
|
||||
@Test @Ignore
|
||||
fun `pretty print`() {
|
||||
println ( prettyPrint(contract) )
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import net.corda.core.contracts.Frequency
|
||||
import net.corda.core.contracts.Tenor
|
||||
import net.corda.core.utilities.DUMMY_NOTARY
|
||||
import net.corda.testing.transaction
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import java.time.Instant
|
||||
import java.time.LocalDate
|
||||
@ -213,5 +214,13 @@ class IRS {
|
||||
}
|
||||
}
|
||||
|
||||
@Test @Ignore
|
||||
fun `pretty print`() {
|
||||
println ( prettyPrint(contractInitial) )
|
||||
|
||||
println ( prettyPrint(contractAfterFixingFirst) )
|
||||
|
||||
println ( prettyPrint(contractAfterExecutionFirst) )
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user