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

Fix test of DigestSize #110

Merged
merged 1 commit into from
Sep 22, 2024
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
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
Loading