Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompiler tests for calculateDelay() and replaceByIndex() #3891

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import com.wavesplatform.common.utils.{Base58, EitherExt2}
import com.wavesplatform.lang.Global
import com.wavesplatform.lang.contract.DApp
import com.wavesplatform.lang.contract.DApp.*
import com.wavesplatform.lang.directives.{DirectiveDictionary, DirectiveSet}
import com.wavesplatform.lang.directives.values.{DApp as DAppType, *}
import com.wavesplatform.lang.directives.{DirectiveDictionary, DirectiveSet}
import com.wavesplatform.lang.utils.getDecompilerContext
import com.wavesplatform.lang.v1.FunctionHeader.{Native, User}
import com.wavesplatform.lang.v1.compiler.*
import com.wavesplatform.lang.v1.compiler.Terms.*
import com.wavesplatform.lang.v1.compiler.Types.*
import com.wavesplatform.lang.v1.compiler.*
import com.wavesplatform.lang.v1.evaluator.ctx.impl.*
import com.wavesplatform.lang.v1.evaluator.ctx.impl.waves.WavesContext
import com.wavesplatform.lang.v1.parser.BinaryOperation.NE_OP
import com.wavesplatform.lang.v1.parser.Parser
import com.wavesplatform.lang.v1.traits.Environment
import com.wavesplatform.lang.v1.{FunctionHeader, compiler}
import com.wavesplatform.lang.utils.getDecompilerContext
import com.wavesplatform.protobuf.dapp.DAppMeta
import com.wavesplatform.test.PropSpec
import org.scalatest.Assertion
Expand Down Expand Up @@ -1032,14 +1032,14 @@ class DecompilerTest extends PropSpec {

property("BigInt unary minus") {
assertDecompile(
s"""
|let a = -toBigInt(1)
|true
""",
s"""
|let a = -(toBigInt(1))
|true
""",
"""
|let a = -toBigInt(1)
|true
""",
"""
|let a = -(toBigInt(1))
|true
""",
V5
)
}
Expand Down Expand Up @@ -1116,4 +1116,14 @@ class DecompilerTest extends PropSpec {
.filter(_ >= V6)
.foreach(assertDecompile(script, decompiledV6, _))
}

property("calculateDelay()") {
val script = "calculateDelay(base58'aaa', 123, Address(base58'bbb'), 456)"
assertDecompile(script, script, V8)
}

property("replaceByIndex()") {
val script = """replaceByIndex(["a", "b", "c"], 1, "x")"""
assertDecompile(script, script, V8)
}
}