https://github.com/kschuetz/gauntlet
Property-based testing for Java
https://github.com/kschuetz/gauntlet
functional-programming java lambda property-based-testing testing
Last synced: 2 months ago
JSON representation
Property-based testing for Java
- Host: GitHub
- URL: https://github.com/kschuetz/gauntlet
- Owner: kschuetz
- License: mit
- Created: 2020-01-09T04:15:36.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-10-03T22:55:36.000Z (over 3 years ago)
- Last Synced: 2025-10-09T14:42:36.987Z (6 months ago)
- Topics: functional-programming, java, lambda, property-based-testing, testing
- Language: Java
- Homepage: https://kschuetz.github.io/gauntlet/
- Size: 1.61 MB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gauntlet
[](http://search.maven.org/#search%7Cga%7C1%7Csoftware.kes.gauntlet)
[](https://circleci.com/gh/kschuetz/gauntlet)
WORK IN PROGRESS
## `Prop`
## `Arbitrary`
#### Primitives and simple types
|Type|Method|Description|
|---|---|---|
|`Integer`|`ints()`|any integer|
|`Integer`|`ints(IntRange range)`|integers within a given range|
|`Integer`|`intIndices(int bound)`|integers from 0..bound (exclusive), not affected by edge-case bias|
|`Integer`|`intNaturals()`|integers >= 0|
|`Long`|`longs()`|any long|
|`Long`|`longs(LongRange range)`|longs within a given range|
|`Long`|`longIndices(int bound)`|longs from 0..bound (exclusive), not affected by edge-case bias|
|`Long`|`longNaturals()`|longs >= 0|
|`Short`|`shorts()`|any short|
|`Short`|`shorts(ShortRange range)`|shorts within a given range|
|`Short`|`shortsNaturals()`|shorts >= 0|
|`Byte`|`bytes()`|any byte|
|`Byte`|`bytes(ByteRange range)`|bytes within a given range|
|`Boolean`|`booleans()`|any boolean|
|`Character`|`characters()`|any character|
|`Character`|`characters(CharRange range)`|characters within a given range|
|`Float`|`floats()`|any float|
|`Float`|`floats(FloatRange range)`|floats within a given range|
|`Float`|`floatFractionals()`|floats between 0 and 1 (exclusive)|
|`Double`|`doubles()`|any double|
|`Double`|`doubles(DoubleRange range)`|doubles within a given range|
|`Double`|`doubleFractionals()`|doubles between 0 and 1 (exclusive)|
|`Object`|`boxedPrimitives()`|`Integer`s, `Long`s, `Short`s, `Byte`s, `Double`s, `Float`s, `Boolean`s, or `Character`s|
|`Byte[]`|`byteArrays()`|byte arrays|
|`Byte[]`|`byteArrays(int size)`|byte arrays with a given size|
|`String`|`strings()`|any string|
|`String`|`stringsOfLength(int length)`|strings with a given length|
|`String`|`stringsOfLength(IntRange lengthRange)`|strings with a length within a given range|
|`BigInteger`|`bigIntegers()`|any `BigInteger`|
|`BigInteger`|`bigIntegers(BigIntegerRange range)`|`BigInteger`s within a given range|
|`BigDecimal`|`bigDecimals()`|any `BigDecimal`|
|`BigDecimal`|`bigDecimals(BigDecimalRange range)`|`BigDecimal`s within a given range|
|`BigDecimal`|`bigDecimals(int decimalPlaces, BigDecimalRange range)`|`BigDecimals` with a given number of decimal places and in a given range|
|`BigDecimal`|`bigDecimals(IntRange decimalPlaces, BigDecimalRange range)`|`BigDecimals` with a given range of decimal places and in a given range|
|`enum`|`valuesOfEnumClass(Class enumType)`|any value from the supplied class|
|`LocalDate`|`localDates()`|any `LocalDate`|
|`LocalDate`|`localDates(LocalDateRange range)`|`LocalDate`s within a given range|
|`LocalDate`|`localDatesForYear(Year year)`|`LocalDate`s within a given year|
|`LocalDate`|`localDatesForMonth(YearMonth month)`|`LocalDate`s with in a given year and month|
|`LocalTime`|`localTimes()`|any `LocalTime`|
|`LocalTime`|`localTimes(LocalTimeRange range)`|`LocalTime`s within a given range|
|`LocalDateTime`|`localDateTimes()`|any `LocalDateTime`|
|`LocalDateTime`|`localDateTimes(LocalDateRange range)`|`LocalDateTime`s within a given range|
|`LocalDateTime`|`localDateTimes(LocalDateTimeRange range)`|`LocalDateTime`s within a given range|
|`Duration`|`durations()`|any `Duration`|
|`Duration`|`durations(DurationRange range)`|`Duration`s in a given range|
|`DayOfWeek`|`daysOfWeek()`|any day of the week|
|`Month`|`months()`|any month of the year|
|`UUID`|`uuid()`|any `UUID`|
#### Collections
|Type|Method|Description|
|---|---|---|
|`Vector>`|`vectors()`|`Vector`s of any arbitrary type|
|`Vector>`|`vectors(int size)`|`Vector`s of any arbitrary type, with a given size|
|`Vector>`|`vectors(IntRange sizeRange)`|`Vector`s of any arbitrary type, with a given size range|
|`Vector`|`vectorsOf(Arbitrary elements)`|`Vector`s with elements of a given type|
|`Vector`|`vectorsOf(int size, Arbitrary elements)`|`Vector`s with elements of a given type, with a given size|
|`Vector`|`vectorsOf(IntRange sizeRange, Arbitrary elements)`|`Vector`s with elements of a given type, with a given size range|
|`NonEmptyVector>`|`nonEmptyVectors()`|`NonEmptyVector`s of any arbitrary type|
|`NonEmptyVector>`|`nonEmptyVectors(int size)`|`NonEmptyVector`s of any arbitrary type, with a given size|
|`NonEmptyVector>`|`nonEmptyVectors(IntRange sizeRange)`|`NonEmptyVector`s of any arbitrary type, with a given size range|
|`NonEmptyVector`|`nonEmptyVectorsOf(Arbitrary elements)`|`NonEmptyVector`s with elements of a given type|
|`NonEmptyVector`|`nonEmptyVectorsOf(int size, Arbitrary elements)`|`NonEmptyVector`s with elements of a given type, with a given size|
|`NonEmptyVector`|`nonEmptyVectors(IntRange sizeRange, Arbitrary elements)`|`NonEmptyVector`s with elements of a given type, with a given size range|
|`ArrayList>`|`arrayLists()`|`ArrayList`s of any arbitrary type|
|`ArrayList>`|`arrayLists(int size)`|`ArrayList`s of any arbitrary type, with a given size|
|`ArrayList>`|`arrayLists(IntRange sizeRange)`|`ArrayList`s of any arbitrary type, with a given size range|
|`ArrayList`|`arrayListsOf(Arbitrary elements)`|`ArrayList`s with elements of a given type|
|`ArrayList`|`arrayListsOf(int size, Arbitrary elements)`|`ArrayList`s with elements of a given type, with a given size|
|`ArrayList`|`arrayListsOf(IntRange sizeRange, Arbitrary elements)`|`ArrayList`s with elements of a given type, with a given size range|
|`ArrayList`|`nonEmptyArrayListsOf(Arbitrary elements)`|`ArrayList`s with elements of a given type, and at least one element|
|`HashSet`|`hashSetsOf(Arbitrary elements)`|`HashSet`s with elements of a given type|
|`HashSet`|`nonEmptyHashSetsOf(Arbitrary elements)`|`HashSet`s with elements of a given type, and at least one element|
|`HashMap, ?>`|`hashMaps()`|`HashMap`s of any arbitrary key type and any arbitrary value type|
|`HashMap`|`hashMaps(Arbitrary keys, Arbitrary values)`|`HashMap`s of a given key type and a given value type|
|`HashMap`|`nonEmptyHashMapsOf(Arbitrary keys, Arbitrary values)`|`HashMap`s of a given key type and a given value type, with at least one entry|
#### Products
|Type|Method|Description|
|---|---|---|
|`Tuple2`..`Tuple8`|`tuple2s()`..`tuples8s()`|`Tuple`s with arbitrary component types|
|`Tuple2`..`Tuple8`|`tuplesOf(Arbitrary a, Arbitrary, `...`)`|`Tuple`s with component types of the provided `Arbitrary`s|
#### Coproducts
|Type|Method|Description|
|---|---|---|
|`Choice2`..`Choice8`|`choicesOf(Arbitrary a, Arbitrary, `...`)`|values selected and drawn from provided arbitraries, with equal probability for each|
|`Choice2`..`Choice8`|`choicesOf(Weighted> a, Weighted>, `...`)`|values selected and drawn from provided arbitraries, with custom probabilities|
|`Maybe`|`maybesOf(Arbitrary a)`|`Maybe` that is most frequently a `just`, with an occasional `nothing` thrown in|
|`Maybe`|`maybesOf(MaybeWeights weights, Arbitrary a)`|`Maybe` with custom probability of generating a `nothing` |
|`Either`|`eithersOf(Arbitrary left, Arbitrary right)`|equal probability of a `left` or a `right`|
|`Either`|`eithersOf(Weighted> left, Weighted> right)`|`Either` with custom probabilities of selecting a `left` or a `right`|
|`Either`|`eithersOf(EitherWeights weights, Arbitrary left, Arbitrary right)`|`Either` with custom probabilities of selecting a `left` or a `right`|
|`These`|`theseOf(Arbitrary a, Arbitrary b)`|equal probability of selecting an `a`, a `b`, or a `both`|
# License
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fkschuetz%2Fgauntlet?ref=badge_shield)
*gauntlet* is distributed under [The MIT License](http://choosealicense.com/licenses/mit/).
The MIT License (MIT)
Copyright (c) 2020 Kevin Schuetz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.