GithubHelp home page GithubHelp logo

scalaprops / scalaprops-shapeless Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 2.0 408 KB

Generation of arbitrary case classes / ADTs instances with scalaprops and shapeless

License: Apache License 2.0

Scala 100.00%
scalaprops scala scalaz testing shapeless scalajs scala-native

scalaprops-shapeless's Introduction

scalaprops-shapeless

Generation of arbitrary case classes / ADTs instances with scalaprops and shapeless ported from alexarchambault/scalacheck-shapeless.

Maven Central scaladoc Scala.js

Usage

Add to your build.sbt

libraryDependencies += "com.github.scalaprops" %% "scalaprops-shapeless" % "0.5.1"

scalaprops-shapeless depends on shapeless 2.3.

Import the content of scalaprops.ScalapropsShapeless close to where you want scalaprops.Gen type classes to be automatically available for case classes / sealed hierarchies,

import scalaprops.ScalapropsShapeless._

//  If you defined:

// case class Foo(i: Int, s: String, blah: Boolean)
// case class Bar(foo: Foo, other: String)

// sealed trait Base
// case class BaseIntString(i: Int, s: String) extends Base
// case class BaseDoubleBoolean(d: Double, b: Boolean) extends Base

//  then you can now do

Gen[Foo]
Gen[Bar]
Gen[Base]

and in particular, while writing property-based tests,

val `some property about Foo` = Property.forAll {
  (foo: Foo) =>
    // Ensure foo has the required property
}

without having to define yourself a scalaprops.Gen for Foo.

Credits

scalaprops-shapeless ported from alexarchambault/scalacheck-shapeless

License

Released under the Apache 2 license. See LICENSE file for more details.

scalaprops-shapeless's People

Contributors

alexarchambault avatar cvogt avatar densh avatar dependabot[bot] avatar gitter-badger avatar ijuma avatar scala-steward-bot avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scalaprops-shapeless's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.