japgolly/nyaya
Random Data Generation and/or Property Testing in Scala & Scala.JS.
{ "createdAt": "2015-01-10T23:31:45Z", "defaultBranch": "master", "description": "Random Data Generation and/or Property Testing in Scala & Scala.JS.", "fullName": "japgolly/nyaya", "homepage": "", "language": "Scala", "name": "nyaya", "pushedAt": "2024-08-12T21:38:55Z", "stargazersCount": 187, "topics": [ "fp", "functional-programming", "property-based-testing", "property-testing", "random", "random-data-generation", "scala", "scalajs" ], "updatedAt": "2025-11-25T10:17:38Z", "url": "https://github.com/japgolly/nyaya"}Nyaya is a Scala/Scala.JS library to:
- Test properties using random data.
- Prove properties with (reasonably-sized) finite domains.
- Assert properties in real data.
- Generate random data.
- Ensure uniqueness in random data.
It is:
- Fast. Probably the fastest Scala random data gen / prop tester. (Benchmarks coming soon…)
- Has a nice, fluent API for generating random data. [(examples)]!(doc/FEATURES.md#generating-random-data)
scala> import nyaya.gen._import nyaya.gen._
scala> val g = Gen.int mapTo Gen.boolean.optiong: nyaya.gen.Gen[Map[Int,Option[Boolean]]] = Gen(<function1>)
scala> g.samples().take(1).foreach(println)Map(609117252 -> None, -339 -> Some(true), 1684851879 -> Some(false), 78379 -> None)SBT setup
Section titled “SBT setup”ver nyayaVer = "1.1.0"
// Property expression, evaluation, assertion.libraryDependencies += "com.github.japgolly.nyaya" %%% "nyaya-prop" % nyayaVer
// Random data generation.libraryDependencies += "com.github.japgolly.nyaya" %%% "nyaya-gen" % nyayaVer
// Random JSON generationlibraryDependencies += "com.github.japgolly.nyaya" %%% "nyaya-gen-circe" % nyayaVer
// Property testing with random data.// Property proving.libraryDependencies += "com.github.japgolly.nyaya" %%% "nyaya-test" % nyayaVer % Test- [Features in more detail]!(doc/FEATURES.md).
- [Changelogs]!(doc/changelog/).
Requires:
Section titled “Requires:”- Scala 2.13+
- Scala.JS 1.10+ (optional)
What does Nyaya mean?
Section titled “What does Nyaya mean?”See:
Support
Section titled “Support”If you like what I do —my OSS libraries, my contributions to other OSS libs, my programming blog— and you’d like to support me, more content, more lib maintenance, please become a patron! I do all my OSS work unpaid so showing your support will make a big difference.
Licence
Section titled “Licence”Copyright (C) 2014-2022 David Barri
This library is free software; you can redistribute it and/ormodify it under the terms of the GNU Lesser General PublicLicense as published by the Free Software Foundation; eitherversion 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNULesser General Public License for more details.