0.5.0 #286
nth-commit
announced in
Announcements
0.5.0
#286
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
BREAKING: Fix Gen.Byte().GreaterThan() types
This method was erroneously accepting an
int
, rather than abyte
. Fixed now.Add
Gen.Nullable<T>()
and extension variantgen.OrNull()
Added a higher-order generator which takes a generator of any reference type, and returns a generator that produces values from the source generator, or produces
null
s.Gen.Create() now handles IEnumerables
IEnumerable<T>
is now wired up to the reflection-based generator,Gen.Create<T>()
. At the moment, it produces values that are lists of a limited size, but in the future, we may decide to leverageGen.Infinite<T>
- the generator which producesIEnumerable<T>
s of infinite size.That means that we can generate structures like this:
It also means
IEnumerables
are now supported in injected properties:GreaterThan()
/LessThan()
integer-generating builder methods now error on numeric overflowPreviously, a generator defined as
Gen.Int32().GreaterThan(int.MaxValue)
would silently cause a numeric overflow, and create a generator equivalent toGen.Int32().GreaterThanEqual(int.MinValue)
.Now, GalaxyCheck detects overflow in these methods, and will produce an error instead.
This is currently supported for the generators
Gen.Byte()
,Gen.Int16()
,Gen.Int32()
,Gen.Int64()
. In the future, other (less likely to overflow) methods will have similar checks, such asGen.String().WithCountGreaterThan()
.Protect the inferred maximum count of the
List<T>
generator from overflowingWhen you provide the list generator a really big minimum, and an unconstrained maximum e.g.
Gen.List().WithCountGreaterThanEqual(int.MaxValue)
, it would previously return the errorError while running generator ListGen: 'maxCount' cannot be negative
. This is because, if unspecified, internally in the generator, we infer themaxCount
to beminCount + 20
, and we weren't checking for integer overflow.Now, we clamp the
maxCount
toint.MaxValue
to prevent overflow. Out-of-the-box, this will result in a much clearer error message:Generating a list with
int.MaxValue
items is probably not intended, so the error now gives a better hint towards what has gone wrong.This discussion was created from the release 0.5.0.
Beta Was this translation helpful? Give feedback.
All reactions