mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
2019 12 10 scalatest 3.1.0 (#933)
* Update scalatest to 3.1.0 * Modify code to support scalatest 3.1.0
This commit is contained in:
parent
a61e1e5068
commit
388becbc6b
@ -2,7 +2,6 @@ package org.bitcoins.core.crypto
|
||||
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalatest.prop.PropertyChecks
|
||||
import scodec.bits._
|
||||
|
||||
class ECPublicKeyTest extends BitcoinSUnitTest {
|
||||
@ -30,7 +29,7 @@ class ECPublicKeyTest extends BitcoinSUnitTest {
|
||||
}
|
||||
|
||||
it must "have serialization symmetry from ECPublicKey -> ECPoint -> ECPublicKey" in {
|
||||
PropertyChecks.forAll(CryptoGenerators.publicKey) { pubKey =>
|
||||
forAll(CryptoGenerators.publicKey) { pubKey =>
|
||||
val p = pubKey.toPoint
|
||||
val pub2 = ECPublicKey.fromPoint(p, pubKey.isCompressed)
|
||||
assert(pubKey == pub2)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.bitcoins.core.number
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalatest.prop.PropertyChecks
|
||||
|
||||
class BasicArithmeticSpec extends BitcoinSUnitTest {
|
||||
|
||||
@ -30,7 +29,7 @@ class BasicArithmeticSpec extends BitcoinSUnitTest {
|
||||
behavior of "BasicArithmetic"
|
||||
|
||||
it must "multiply safely and unsafely with an int" in {
|
||||
PropertyChecks.forAll(NumberGenerator.bigInts, numWrapperGen) { (i, num) =>
|
||||
forAll(NumberGenerator.bigInts, numWrapperGen) { (i, num) =>
|
||||
val unsafe = num * i
|
||||
val safe = num.multiplySafe(i)
|
||||
assert(safe.toOption.contains(unsafe))
|
||||
@ -38,7 +37,7 @@ class BasicArithmeticSpec extends BitcoinSUnitTest {
|
||||
}
|
||||
|
||||
it must "multiply safely and unsafely with itself" in {
|
||||
PropertyChecks.forAll(numWrapperGen, numWrapperGen) { (first, second) =>
|
||||
forAll(numWrapperGen, numWrapperGen) { (first, second) =>
|
||||
val unsafe = first * second
|
||||
val safe = first.multiplySafe(second)
|
||||
assert(safe.toOption.contains(unsafe))
|
||||
@ -46,7 +45,7 @@ class BasicArithmeticSpec extends BitcoinSUnitTest {
|
||||
}
|
||||
|
||||
it must "add safely and unsafely" in {
|
||||
PropertyChecks.forAll(numWrapperGen, numWrapperGen) { (first, second) =>
|
||||
forAll(numWrapperGen, numWrapperGen) { (first, second) =>
|
||||
val unsafe = first + second
|
||||
val safe = first.addSafe(second)
|
||||
assert(safe.toOption.contains(unsafe))
|
||||
@ -54,7 +53,7 @@ class BasicArithmeticSpec extends BitcoinSUnitTest {
|
||||
}
|
||||
|
||||
it must "subtract safely and unsafely" in {
|
||||
PropertyChecks.forAll(numWrapperGen, numWrapperGen) { (first, second) =>
|
||||
forAll(numWrapperGen, numWrapperGen) { (first, second) =>
|
||||
val unsafe = first - second
|
||||
val safe = first.subtractSafe(second)
|
||||
assert(safe.toOption.contains(unsafe))
|
||||
|
@ -1,13 +1,10 @@
|
||||
package org.bitcoins.core.number
|
||||
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.scalatest.prop.PropertyChecks
|
||||
import org.scalatest.{FlatSpec, MustMatchers}
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
class UInt5Test extends FlatSpec with MustMatchers with PropertyChecks {
|
||||
|
||||
private val logger = LoggerFactory.getLogger(this.getClass)
|
||||
class UInt5Test extends BitcoinSUnitTest {
|
||||
|
||||
behavior of "UInt5"
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
package org.bitcoins.core.protocol.ln.currency
|
||||
|
||||
import org.bitcoins.testkit.core.gen.{CurrencyUnitGenerator, NumberGenerator}
|
||||
import org.bitcoins.testkit.core.gen.ln.LnCurrencyUnitGen
|
||||
import org.bitcoins.testkit.core.gen.{CurrencyUnitGenerator, NumberGenerator}
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalatest.prop.PropertyChecks
|
||||
import org.scalacheck.Gen
|
||||
|
||||
class MilliSatoshisTest extends BitcoinSUnitTest {
|
||||
|
@ -10,17 +10,13 @@ import org.bitcoins.core.script.locktime.OP_CHECKLOCKTIMEVERIFY
|
||||
import org.bitcoins.core.script.reserved.{OP_NOP, OP_RESERVED}
|
||||
import org.bitcoins.core.script.result.ScriptErrorWitnessPubKeyType
|
||||
import org.bitcoins.testkit.core.gen.ScriptGenerators
|
||||
import org.scalatest.prop.PropertyChecks
|
||||
import org.scalatest.{FlatSpec, MustMatchers}
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
/**
|
||||
* Created by chris on 3/2/16.
|
||||
*/
|
||||
class BitcoinScriptUtilTest
|
||||
extends FlatSpec
|
||||
with MustMatchers
|
||||
with PropertyChecks {
|
||||
class BitcoinScriptUtilTest extends BitcoinSUnitTest {
|
||||
|
||||
//from b30d3148927f620f5b1228ba941c211fdabdae75d0ba0b688a58accbf018f3cc
|
||||
val asm = TestUtil.p2pkhScriptPubKey.asm
|
||||
|
@ -6,7 +6,9 @@ object Deps {
|
||||
val bouncyCastle = "1.55"
|
||||
val logback = "1.2.3"
|
||||
val scalacheck = "1.14.2"
|
||||
val scalaTest = "3.0.8"
|
||||
val scalaTest = "3.1.0"
|
||||
|
||||
val scalaTestPlus = "3.1.0.0" //super annoying... https://oss.sonatype.org/content/groups/public/org/scalatestplus/
|
||||
val slf4j = "1.7.29"
|
||||
val spray = "1.3.5"
|
||||
val zeromq = "0.5.1"
|
||||
@ -97,6 +99,7 @@ object Deps {
|
||||
|
||||
val scalacheck = "org.scalacheck" %% "scalacheck" % V.scalacheck withSources () withJavadoc ()
|
||||
val scalaTest = "org.scalatest" %% "scalatest" % V.scalaTest withSources () withJavadoc ()
|
||||
val scalaTestPlus = "org.scalatestplus" %% "scalacheck-1-14" % V.scalaTestPlus withSources() withJavadoc()
|
||||
}
|
||||
|
||||
object Test {
|
||||
@ -231,6 +234,7 @@ object Deps {
|
||||
Compile.slf4j,
|
||||
Compile.scalacheck,
|
||||
Compile.scalaTest,
|
||||
Compile.scalaTestPlus,
|
||||
Test.akkaTestkit
|
||||
)
|
||||
|
||||
|
@ -2,6 +2,7 @@ package org.bitcoins.testkit.fixtures
|
||||
|
||||
import org.bitcoins.testkit.wallet.BitcoinSWalletTest
|
||||
import org.scalatest._
|
||||
import org.scalatest.flatspec.FixtureAsyncFlatSpec
|
||||
import org.bitcoins.wallet.models._
|
||||
import org.bitcoins.wallet.config.WalletAppConfig
|
||||
import org.bitcoins.wallet.db.WalletDbManagement
|
||||
@ -11,7 +12,7 @@ case class WalletDAOs(
|
||||
addressDAO: AddressDAO,
|
||||
utxoDAO: SpendingInfoDAO)
|
||||
|
||||
trait WalletDAOFixture extends fixture.AsyncFlatSpec with BitcoinSWalletTest {
|
||||
trait WalletDAOFixture extends FixtureAsyncFlatSpec with BitcoinSWalletTest {
|
||||
|
||||
private lazy val daos: WalletDAOs = {
|
||||
val account = AccountDAO()
|
||||
|
@ -9,6 +9,9 @@ import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.scalacheck.{Gen, Shrink}
|
||||
import org.scalactic.anyvals.PosInt
|
||||
import org.scalatest._
|
||||
import org.scalatest.flatspec.FixtureAsyncFlatSpec
|
||||
import org.scalatest.flatspec.AsyncFlatSpec
|
||||
import org.scalatest.matchers.must.Matchers
|
||||
import org.scalatest.concurrent.AsyncTimeLimitedTests
|
||||
import org.scalatest.time.Span
|
||||
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
|
||||
@ -23,7 +26,7 @@ import scala.concurrent.duration.DurationInt
|
||||
trait BaseAsyncTest
|
||||
extends BeforeAndAfter
|
||||
with BeforeAndAfterAll
|
||||
with MustMatchers
|
||||
with Matchers
|
||||
with ScalaCheckPropertyChecks
|
||||
with AsyncTimeLimitedTests
|
||||
with BitcoinSLogger { this: AsyncTestSuite =>
|
||||
@ -197,16 +200,16 @@ trait BaseAsyncTest
|
||||
/** A trait that uses [[AsyncFlatSpec]] to execute tests
|
||||
* This is different than [[BitcoinsBaseAsyncTest]] in the sense that
|
||||
* it extends [[AsyncFlatSpec]]. Some test cases in bitcoin-s we want
|
||||
* to provide fixtures, which means that suite needs to extend [[org.scalatest.fixture.AsyncFlatSpec fixture.AsyncFlatSpec]]
|
||||
* to provide fixtures, which means that suite needs to extend [[FixtureAsyncFlatSpec FixtureAsyncFlatSpec]]
|
||||
* to be able to use that fixture
|
||||
*
|
||||
* This test trait should be used for async tests that do NOT use a fixture.
|
||||
* */
|
||||
trait BitcoinSAsyncTest extends AsyncFlatSpec with BaseAsyncTest
|
||||
|
||||
/** A trait that uses [[fixture.AsyncFlatSpec fixture.AsyncFlatSpec]] to execute tests
|
||||
/** A trait that uses [[FixtureAsyncFlatSpec AsyncFlatSpec]] to execute tests
|
||||
* This is different than [[BitcoinSAsyncTest BitcoinSAsyncTest]] as you can use a fixture
|
||||
* with this test suite.
|
||||
*
|
||||
* */
|
||||
trait BitcoinSAsyncFixtureTest extends fixture.AsyncFlatSpec with BaseAsyncTest
|
||||
trait BitcoinSAsyncFixtureTest extends FixtureAsyncFlatSpec with BaseAsyncTest
|
||||
|
@ -6,14 +6,15 @@ import org.scalactic.anyvals.PosInt
|
||||
import org.scalatest.concurrent.TimeLimitedTests
|
||||
import org.scalatest.time.Span
|
||||
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
|
||||
import org.scalatest.{FlatSpec, MustMatchers}
|
||||
import org.scalatest.matchers.must.Matchers
|
||||
import org.scalatest.flatspec.AnyFlatSpec
|
||||
|
||||
import scala.concurrent.duration.DurationInt
|
||||
|
||||
/** A wrapper for boiler plate testing procesures in bitcoin-s */
|
||||
/** A wrapper for boi ler plate testing procesures in bitcoin-s */
|
||||
abstract class BitcoinSUnitTest
|
||||
extends FlatSpec
|
||||
with MustMatchers
|
||||
extends AnyFlatSpec
|
||||
with Matchers
|
||||
with ScalaCheckPropertyChecks
|
||||
with TimeLimitedTests
|
||||
with BitcoinSLogger {
|
||||
|
Loading…
Reference in New Issue
Block a user