Skip to content

Commit

Permalink
test of DigestSize
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Feb 16, 2024
1 parent 1d2db26 commit 2b2751a
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions shared/src/test/scala/scorex/crypto/hash/HashTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import org.scalatest.matchers.should.Matchers
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import scorex.util.encode.Base16

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}

trait HashTest extends AnyPropSpec
with ScalaCheckDrivenPropertyChecks
with Matchers {
Expand Down Expand Up @@ -56,15 +52,11 @@ trait HashTest extends AnyPropSpec
}


property(s"${hash.getClass.getSimpleName} should return correct Tag") {
forAll { (string: String, bytes: Array[Byte]) =>
val digest = hash(string)
digest.isInstanceOf[D] shouldBe true
if (digest.isInstanceOf[Digest32]) {
hash.DigestSize shouldBe 32
} else if (digest.isInstanceOf[Digest64]) {
hash.DigestSize shouldBe 64
}
property(s"${hash.getClass.getSimpleName} should have correct size") {
if (hash.isInstanceOf[CryptographicHash32]) {
hash.DigestSize shouldBe 32
} else {
hash.DigestSize shouldBe 64
}
}
}
Expand Down

0 comments on commit 2b2751a

Please sign in to comment.