All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.circe.testing.IntegralString.scala Maven / Gradle / Ivy

There is a newer version: 0.9.3
Show newest version
package io.circe.testing

import org.scalacheck.{ Arbitrary, Gen }

case class IntegralString(value: String)

object IntegralString {
  implicit val arbitraryIntegralString: Arbitrary[IntegralString] =
    Arbitrary(
      for {
        sign    <- Gen.oneOf("", "-")
        nonZero <- Gen.choose(1, 9).map(_.toString)
        count   <- Gen.chooseNum(0, 24, 17, 18, 19)
        rest    <- Gen.buildableOfN[String, Char](count, Gen.numChar)
      } yield IntegralString(s"$sign$nonZero$rest")
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy