Skip to content

Commit

Permalink
more .toBytes and .toBits tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Nov 11, 2024
1 parent a87bfb3 commit 77be8a6
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,24 @@ class BasicOpsSpecification extends CompilerTestingCommons
}
}

property("UnsignedBigInt.toBits - 2") {
def toBitsTest() = test("UnsignedBigInt.toBits", env, ext,
s"""{
| val b = unsignedBigInt("5")
| val ba = b.toBits
| ba.size == 8 && ba == Coll(false, false, false, false, false, true, false, true)
|}""".stripMargin,
null
)

if (VersionContext.current.isV6SoftForkActivated) {
toBitsTest()
} else {
an[ValidationException] shouldBe thrownBy(toBitsTest())
}
}


property("BigInt.bitwiseInverse") {
def bitwiseInverseTest(): Assertion = test("BigInt.bitwiseInverse", env, ext,
s"""{
Expand Down Expand Up @@ -1548,6 +1566,22 @@ class BasicOpsSpecification extends CompilerTestingCommons
}
}

property("UnsignedBigInt.toBytes - 2") {
val script = s"""{
| val l = unsignedBigInt("5")
| val bs = l.toBytes
| bs.size == 1 && bs == Coll(5.toByte)
| }""".stripMargin

def toBytesTest() = test("UnsignedBigInt.toBytes", env, ext, script, null)

if (VersionContext.current.isV6SoftForkActivated) {
toBytesTest()
} else {
an[ValidationException] shouldBe thrownBy(toBytesTest())
}
}

property("serialize - byte array") {
def deserTest() = test("serialize", env, ext,
s"""{
Expand Down

0 comments on commit 77be8a6

Please sign in to comment.