Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Fixtures for Kotlin providing generated values for unit testing
| Date | Stars |
|---|---|
| 2026-07-24 | 291 |
| 2026-07-25 | 291 |
| 2026-07-28 | 291 |
| 2026-07-30 | 291 |
| 2026-08-06 | 291 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
= KotlinFixture Appmattus Limited <[email protected]> :toc: preamble :toc-title: Contents :homepage: https://github.com/appmattus/kotlinfixture ifdef::env-github[] :tip-caption: :bulb: :note-caption: :information_source: :important-caption: :heavy_exclamation_mark: :caution-caption: :fire: :warning-caption: :warning: endif::[] :link-appmattus: https://github.com/appmattus/kotlinfixture[KotlinFixture] https://search.maven.org/search?q=g:com.appmattus.fixture[image:https://img.shields.io/maven-central/v/com.appmattus.fixture/fixture[Maven Central]] https://github.com/appmattus/kotlinfixture/actions[image:https://github.com/appmattus/kotlinfixture/workflows/CI/badge.svg[CI status]] https://codecov.io/gh/appmattus/kotlinfixture[image:https://codecov.io/gh/appmattus/kotlinfixture/branch/main/graph/badge.svg[Coverage status]] link:LICENSE.md[image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[License]] A tool to generate well-defined, but essentially random, input following the idea of constrained non-determinism. == Getting started Include the following dependency in your `build.gradle.kts` file: [source,kotlin] ._build.gradle.kts_ ---- testImplementation("com.appmattus.fixture:fixture:<latest-version>") ---- Simply create a fixture and invoke it with the type to be generated: [source,kotlin] ---- val fixture = kotlinFixture() // Generate a list of strings val aListOfStrings = fixture<List<String>>() // Nulls are supported val sometimesNull = fixture<Int?>() // Create instances of classes // Optional parameters will be randomly used or overridden data class ADataClass(val value: String = "default") val aClass = fixture<ADataClass>() // Abstract classes will pick a sub-class at random // This could be a Byte, Double, Long, Float, Int or Short val anyNumber = fixture<Number>() // Pick randomly from a list val randomStringFromTheList = fixture(listOf("Cat", "Dog", "Horse")) val anotherRandomIntFromAList = fixture(1..5) ---- You can also generate an infinite sequence of a type, which you can then filter: [source,kotlin] ---- val fixture = kotlinFixture() val intSequence = fixture.asSequence<Int>() // Standard Kotlin sequence functions can then be applied before using // the sequence through an iterator for access to the next() function. // For example, you can filter values val oddIterator = intSequence.filter { it.absoluteValue.rem(2) == 1 }.iterator() val oddNumber = oddIterator.next() val anotherOddNumber = oddIterator.next() // Or, ensure it returns only distinct values enum class XYZ { X, Y, Z } val enumIterator = fixture.asSequence<XYZ>().distinct().iterator() val aDistinctValue = enumIterator.next() val anotherDistinctValue = enumIterator.next() ---- [WARNING] ==== The sequence can hang indefinitely if the applied operators prevent the generation of new values. For example: * `distinct` will hang if we exhaust all available values. A good practice is to add a `take(count)` which will throw a `NoSuchElementException` if we try to generate more values. * `filter` that can never be fulfilled e.g. `filter { false }` ==== == Configuration options Everything can be customised, see link:fixture/configuration-options.adoc[configuration options] for more details. link:fixture/advanced-customisation.adoc[Advanced engine customisation] is also possible if the above options are not enough. == Kotest integration: property based testing The library provides {link-appmattus} powered property based testing for https://github.com/kotest/kotest/[Kotest]. See link:fixture-kotest/README.adoc[Kotest integration] for more details. == Java Faker integration: pretty data Generate values with a closer match to real data using http://dius.github.io/java-faker/[Java Faker]. See link:fixture-javafaker/README.adoc[Java Faker integration] for more details. == Generex integration: regex to random string To generate a random string from a regular expression, look no further than the Generex integration. See link:fi
Excerpt of 5,446 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:37f8f9bc8c98c16b, topic:testing