dcapwell commented on code in PR #196: URL: https://github.com/apache/cassandra-accord/pull/196#discussion_r2112912394
########## accord-core/src/test/java/accord/utils/README.md: ########## @@ -0,0 +1,318 @@ +# Fuzz Testing + +There are multiple ways to do fuzz testing, and this package provides different utilities to aid in writing tests. + +# Gen + +The `Gen` class is the core abstraction for generating random test values in our property-based testing framework. A `Gen<T>` instance defines how to produce random values of type `T` using a provided `RandomSource`. + +## Core Concepts + +### The `Gen` Interface + +`Gen<T>` is a functional interface with a single method: + +```java +T generate(RandomSource random); +``` + +This method produces a random value of type `T` using the given random source. + +### Using `Gens` Utility Class + +The `Gens` class provides a comprehensive set of pre-defined generators for common types: + +#### Primitive Types +- `Gens.bools()`: Generates random boolean values based off a pattern +- `Gens.ints()`, `Gens.longs()`: Generates random integer/long values based off a pattern +- `Gens.enum()`: Generates enum values based off a pattern +- `Gens.strings()`: Generates strings based off a pattern + +#### Collection Generators +- `Gens.lists(itemGen)`, `Gens.arrays(class, itemGen)`: Lists/arrays of random items based off a pattern + +#### Advanced Generators +- `Gens.oneOf(T... values)`: Selects randomly from provided values +- `Gens.constant(value)`: Always generates the same value + +#### Meta-Randomness Generators + +To put it simply: a generator of generators. These generators define how to generate randomness itself! Review Comment: not really sure what to say to "go deeper"... I talked about this at CoC 2024 and argue that changing the distribution can improve coverage; should i basically say that here? or something else? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org