Releases: nth-commit/GalaxyCheck
0.8.0-preview.16
What's Changed
- 🌍 Lots of simplifications to the Property model by @nth-commit in #327
- 🌍 Add API for creating
AsyncProperty
s, without ability to check them yet by @nth-commit in #328 - 🌍 Initial CheckAsync implementation by @nth-commit in #329
- 🌍 Add
AssertAsync
andPrintAsync
by @nth-commit in #331 - 🌍 First end-to-end async implementation with GalaxyCheck.Xunit by @nth-commit in #332
- 🌍 Fix up Nullary properties by @nth-commit in #333
- 🌍 Add exhaustion to
CheckAsync
by @nth-commit in #334 - 🌍 Downgrade analyzers to netstandard2.0 by @nth-commit in #335
- 🌍 Delete API
Property.Precondition
by @nth-commit in #336 - 🌍 Improve reflected generator stability by @nth-commit in #337
- 🌍 Fix nuget version by @nth-commit in #338
- 🌍 #339 Add methods to support self-referencing gen factories by @nth-commit in #340
- 🌍 #341 Add
Gen.NullableStruct
andgen.OrNullStruct
by @nth-commit in #342 - 🌍 #343 Support generating nullable structs via reflection! by @nth-commit in #344
- 🌍 Revert: Improve reflected generator stability by @nth-commit in #345
- 🌍 #343 Error on unsupported override :( by @nth-commit in #348
- 🌍 #349 Performance improvements by @nth-commit in #350
- 🌍 #349 Gen performance enhancements by @nth-commit in #351
- 🌍 #352 Return execution time in run summary by @nth-commit in #353
- 🌍 #349 Improve integer generator run performance by 30-35% by @nth-commit in #354
- 🌍 #349 Add bespoke Zip implementation, improves performance by 25% over SelectMany derivation by @nth-commit in #355
- 🌍 Fix synchronous properties printing by @nth-commit in #356
- 🌍 Fix crashes when something is accessing concurrently by @nth-commit in #357
- 🌍 Fix crashes when something is accessing concurrently (part 2) by @nth-commit in #358
- 🌍 #343 Enable generating nullable types by reflection by @nth-commit in #359
- 🌍 #343 Nullability enhancements I had in a dream by @nth-commit in #360
- 🌍 #361 Generator stability V2 by @nth-commit in #362
- 🌍 #363 Add static/global configuration mechanism by @nth-commit in #364
- 🌍 #365 Delete pure properties by @nth-commit in #366
- 🌍 #367 First implementation of [GenSnapshot] by @nth-commit in #368
- 🌍 #367 Support analyzers for GenSnapshot by @nth-commit in #369
- 🌍 #363 Look for global config only in test assembly, not the entire app domain by @nth-commit in #370
- 🌍 #371 Support structs! by @nth-commit in #372
- 🌍 #373 Add default gen support for more primitives by @nth-commit in #374
- 🌍 #376 Tidy up: remove unnecessary diagnostics by @nth-commit in #377
- 🌍 #376 Catch exceptions thrown during generation and turn them into errors by @nth-commit in #378
- 🌍 #376 Simplify internals of error iterations by removing NextParameters from common interface (errors are terminal, next params are meaningless) by @nth-commit in #379
- 🌍 #371 Fix infinite rendering loop on static properties by @nth-commit in #381
- 🌍 #376 Refactor - combine the sync and async check state machines by @nth-commit in #382
- 🚧 Rename
NebulaCheck
=>GalaxyCheck.Stable
by @nth-commit in #383 - 🚧 Use
GalaxyCheck.Stable
in new test suite by @nth-commit in #384 - 🌍 #385 Allow properties to be generated from
InlineData
/MemberData
by @nth-commit in #386 - 🌍 #387 Add support for creating generators of the given
Type
(non-generic) by @nth-commit in #388 - 📖 Sample: "control" data and dynamic generation by @nth-commit in #389
- 🌍 #376 Fix conversion exception when a generator error couldn't be resolved by @nth-commit in #391
Full Changelog: 0.7.0...0.8.0-preview.16
0.8.0-preview.15
What's Changed
- 🌍 Lots of simplifications to the Property model by @nth-commit in #327
- 🌍 Add API for creating
AsyncProperty
s, without ability to check them yet by @nth-commit in #328 - 🌍 Initial CheckAsync implementation by @nth-commit in #329
- 🌍 Add
AssertAsync
andPrintAsync
by @nth-commit in #331 - 🌍 First end-to-end async implementation with GalaxyCheck.Xunit by @nth-commit in #332
- 🌍 Fix up Nullary properties by @nth-commit in #333
- 🌍 Add exhaustion to
CheckAsync
by @nth-commit in #334 - 🌍 Downgrade analyzers to netstandard2.0 by @nth-commit in #335
- 🌍 Delete API
Property.Precondition
by @nth-commit in #336 - 🌍 Improve reflected generator stability by @nth-commit in #337
- 🌍 Fix nuget version by @nth-commit in #338
- 🌍 #339 Add methods to support self-referencing gen factories by @nth-commit in #340
- 🌍 #341 Add
Gen.NullableStruct
andgen.OrNullStruct
by @nth-commit in #342 - 🌍 #343 Support generating nullable structs via reflection! by @nth-commit in #344
- 🌍 Revert: Improve reflected generator stability by @nth-commit in #345
- 🌍 #343 Error on unsupported override :( by @nth-commit in #348
- 🌍 #349 Performance improvements by @nth-commit in #350
- 🌍 #349 Gen performance enhancements by @nth-commit in #351
- 🌍 #352 Return execution time in run summary by @nth-commit in #353
- 🌍 #349 Improve integer generator run performance by 30-35% by @nth-commit in #354
- 🌍 #349 Add bespoke Zip implementation, improves performance by 25% over SelectMany derivation by @nth-commit in #355
- 🌍 Fix synchronous properties printing by @nth-commit in #356
- 🌍 Fix crashes when something is accessing concurrently by @nth-commit in #357
- 🌍 Fix crashes when something is accessing concurrently (part 2) by @nth-commit in #358
- 🌍 #343 Enable generating nullable types by reflection by @nth-commit in #359
- 🌍 #343 Nullability enhancements I had in a dream by @nth-commit in #360
- 🌍 #361 Generator stability V2 by @nth-commit in #362
- 🌍 #363 Add static/global configuration mechanism by @nth-commit in #364
- 🌍 #365 Delete pure properties by @nth-commit in #366
- 🌍 #367 First implementation of [GenSnapshot] by @nth-commit in #368
- 🌍 #367 Support analyzers for GenSnapshot by @nth-commit in #369
- 🌍 #363 Look for global config only in test assembly, not the entire app domain by @nth-commit in #370
- 🌍 #371 Support structs! by @nth-commit in #372
- 🌍 #373 Add default gen support for more primitives by @nth-commit in #374
- 🌍 #376 Tidy up: remove unnecessary diagnostics by @nth-commit in #377
- 🌍 #376 Catch exceptions thrown during generation and turn them into errors by @nth-commit in #378
- 🌍 #376 Simplify internals of error iterations by removing NextParameters from common interface (errors are terminal, next params are meaningless) by @nth-commit in #379
- 🌍 #371 Fix infinite rendering loop on static properties by @nth-commit in #381
- 🌍 #376 Refactor - combine the sync and async check state machines by @nth-commit in #382
- 🚧 Rename
NebulaCheck
=>GalaxyCheck.Stable
by @nth-commit in #383 - 🚧 Use
GalaxyCheck.Stable
in new test suite by @nth-commit in #384 - 🌍 #385 Allow properties to be generated from
InlineData
/MemberData
by @nth-commit in #386 - 🌍 #387 Add support for creating generators of the given
Type
(non-generic) by @nth-commit in #388 - 📖 Sample: "control" data and dynamic generation by @nth-commit in #389
Full Changelog: 0.7.0...0.8.0-preview.15
0.8.0-preview.14
What's Changed
- 🌍 Lots of simplifications to the Property model by @nth-commit in #327
- 🌍 Add API for creating
AsyncProperty
s, without ability to check them yet by @nth-commit in #328 - 🌍 Initial CheckAsync implementation by @nth-commit in #329
- 🌍 Add
AssertAsync
andPrintAsync
by @nth-commit in #331 - 🌍 First end-to-end async implementation with GalaxyCheck.Xunit by @nth-commit in #332
- 🌍 Fix up Nullary properties by @nth-commit in #333
- 🌍 Add exhaustion to
CheckAsync
by @nth-commit in #334 - 🌍 Downgrade analyzers to netstandard2.0 by @nth-commit in #335
- 🌍 Delete API
Property.Precondition
by @nth-commit in #336 - 🌍 Improve reflected generator stability by @nth-commit in #337
- 🌍 Fix nuget version by @nth-commit in #338
- 🌍 #339 Add methods to support self-referencing gen factories by @nth-commit in #340
- 🌍 #341 Add
Gen.NullableStruct
andgen.OrNullStruct
by @nth-commit in #342 - 🌍 #343 Support generating nullable structs via reflection! by @nth-commit in #344
- 🌍 Revert: Improve reflected generator stability by @nth-commit in #345
- 🌍 #343 Error on unsupported override :( by @nth-commit in #348
- 🌍 #349 Performance improvements by @nth-commit in #350
- 🌍 #349 Gen performance enhancements by @nth-commit in #351
- 🌍 #352 Return execution time in run summary by @nth-commit in #353
- 🌍 #349 Improve integer generator run performance by 30-35% by @nth-commit in #354
- 🌍 #349 Add bespoke Zip implementation, improves performance by 25% over SelectMany derivation by @nth-commit in #355
- 🌍 Fix synchronous properties printing by @nth-commit in #356
- 🌍 Fix crashes when something is accessing concurrently by @nth-commit in #357
- 🌍 Fix crashes when something is accessing concurrently (part 2) by @nth-commit in #358
- 🌍 #343 Enable generating nullable types by reflection by @nth-commit in #359
- 🌍 #343 Nullability enhancements I had in a dream by @nth-commit in #360
- 🌍 #361 Generator stability V2 by @nth-commit in #362
- 🌍 #363 Add static/global configuration mechanism by @nth-commit in #364
- 🌍 #365 Delete pure properties by @nth-commit in #366
- 🌍 #367 First implementation of [GenSnapshot] by @nth-commit in #368
- 🌍 #367 Support analyzers for GenSnapshot by @nth-commit in #369
- 🌍 #363 Look for global config only in test assembly, not the entire app domain by @nth-commit in #370
- 🌍 #371 Support structs! by @nth-commit in #372
- 🌍 #373 Add default gen support for more primitives by @nth-commit in #374
- 🌍 #376 Tidy up: remove unnecessary diagnostics by @nth-commit in #377
- 🌍 #376 Catch exceptions thrown during generation and turn them into errors by @nth-commit in #378
- 🌍 #376 Simplify internals of error iterations by removing NextParameters from common interface (errors are terminal, next params are meaningless) by @nth-commit in #379
Full Changelog: 0.7.0...0.8.0-preview.14
0.8.0-preview.13
What's Changed
- 🌍 Lots of simplifications to the Property model by @nth-commit in #327
- 🌍 Add API for creating
AsyncProperty
s, without ability to check them yet by @nth-commit in #328 - 🌍 Initial CheckAsync implementation by @nth-commit in #329
- 🌍 Add
AssertAsync
andPrintAsync
by @nth-commit in #331 - 🌍 First end-to-end async implementation with GalaxyCheck.Xunit by @nth-commit in #332
- 🌍 Fix up Nullary properties by @nth-commit in #333
- 🌍 Add exhaustion to
CheckAsync
by @nth-commit in #334 - 🌍 Downgrade analyzers to netstandard2.0 by @nth-commit in #335
- 🌍 Delete API
Property.Precondition
by @nth-commit in #336 - 🌍 Improve reflected generator stability by @nth-commit in #337
- 🌍 Fix nuget version by @nth-commit in #338
- 🌍 #339 Add methods to support self-referencing gen factories by @nth-commit in #340
- 🌍 #341 Add
Gen.NullableStruct
andgen.OrNullStruct
by @nth-commit in #342 - 🌍 #343 Support generating nullable structs via reflection! by @nth-commit in #344
- 🌍 Revert: Improve reflected generator stability by @nth-commit in #345
- 🌍 #343 Error on unsupported override :( by @nth-commit in #348
- 🌍 #349 Performance improvements by @nth-commit in #350
- 🌍 #349 Gen performance enhancements by @nth-commit in #351
- 🌍 #352 Return execution time in run summary by @nth-commit in #353
- 🌍 #349 Improve integer generator run performance by 30-35% by @nth-commit in #354
- 🌍 #349 Add bespoke Zip implementation, improves performance by 25% over SelectMany derivation by @nth-commit in #355
- 🌍 Fix synchronous properties printing by @nth-commit in #356
- 🌍 Fix crashes when something is accessing concurrently by @nth-commit in #357
- 🌍 Fix crashes when something is accessing concurrently (part 2) by @nth-commit in #358
- 🌍 #343 Enable generating nullable types by reflection by @nth-commit in #359
- 🌍 #343 Nullability enhancements I had in a dream by @nth-commit in #360
- 🌍 #361 Generator stability V2 by @nth-commit in #362
- 🌍 #363 Add static/global configuration mechanism by @nth-commit in #364
- 🌍 #365 Delete pure properties by @nth-commit in #366
- 🌍 #367 First implementation of [GenSnapshot] by @nth-commit in #368
- 🌍 #367 Support analyzers for GenSnapshot by @nth-commit in #369
- 🌍 #363 Look for global config only in test assembly, not the entire app domain by @nth-commit in #370
- 🌍 #371 Support structs! by @nth-commit in #372
Full Changelog: 0.7.0...0.8.0-preview.13
0.8.0-preview.12
What's Changed
- 🌍 Lots of simplifications to the Property model by @nth-commit in #327
- 🌍 Add API for creating
AsyncProperty
s, without ability to check them yet by @nth-commit in #328 - 🌍 Initial CheckAsync implementation by @nth-commit in #329
- 🌍 Add
AssertAsync
andPrintAsync
by @nth-commit in #331 - 🌍 First end-to-end async implementation with GalaxyCheck.Xunit by @nth-commit in #332
- 🌍 Fix up Nullary properties by @nth-commit in #333
- 🌍 Add exhaustion to
CheckAsync
by @nth-commit in #334 - 🌍 Downgrade analyzers to netstandard2.0 by @nth-commit in #335
- 🌍 Delete API
Property.Precondition
by @nth-commit in #336 - 🌍 Improve reflected generator stability by @nth-commit in #337
- 🌍 Fix nuget version by @nth-commit in #338
- 🌍 #339 Add methods to support self-referencing gen factories by @nth-commit in #340
- 🌍 #341 Add
Gen.NullableStruct
andgen.OrNullStruct
by @nth-commit in #342 - 🌍 #343 Support generating nullable structs via reflection! by @nth-commit in #344
- 🌍 Revert: Improve reflected generator stability by @nth-commit in #345
- 🌍 #343 Error on unsupported override :( by @nth-commit in #348
- 🌍 #349 Performance improvements by @nth-commit in #350
- 🌍 #349 Gen performance enhancements by @nth-commit in #351
- 🌍 #352 Return execution time in run summary by @nth-commit in #353
- 🌍 #349 Improve integer generator run performance by 30-35% by @nth-commit in #354
- 🌍 #349 Add bespoke Zip implementation, improves performance by 25% over SelectMany derivation by @nth-commit in #355
- 🌍 Fix synchronous properties printing by @nth-commit in #356
- 🌍 Fix crashes when something is accessing concurrently by @nth-commit in #357
- 🌍 Fix crashes when something is accessing concurrently (part 2) by @nth-commit in #358
- 🌍 #343 Enable generating nullable types by reflection by @nth-commit in #359
- 🌍 #343 Nullability enhancements I had in a dream by @nth-commit in #360
- 🌍 #361 Generator stability V2 by @nth-commit in #362
- 🌍 #363 Add static/global configuration mechanism by @nth-commit in #364
- 🌍 #365 Delete pure properties by @nth-commit in #366
- 🌍 #367 First implementation of [GenSnapshot] by @nth-commit in #368
- 🌍 #367 Support analyzers for GenSnapshot by @nth-commit in #369
- 🌍 #363 Look for global config only in test assembly, not the entire app domain by @nth-commit in #370
Full Changelog: 0.7.0...0.8.0-preview.12
0.7.0
.NET 6.0 Support
GalaxyCheck was initially built when netstandard was a thing. It's not anymore.
Only support .NET 6.0 for now. .NET 5.0 support may be retroactively added if required. .NET 7.0 support coming soon.
Full Changelog: 0.6.1...0.7.0
0.6.1
After a hiatus from .NET development I'm back and ready to chip away at the final features/bugs required to get GalaxyCheck stable.
What's Changed
- 🌍 Add GalaxyCheck.Xunit.CodeAnalysis to publishable packages by @nth-commit in #313
- 🌍 #314 Code refactoring suggestions now also apply to SampleAttribute by @nth-commit in #315
- 🌍 #316 Shrink string/char gens to 'a' instead of whitespace by @nth-commit in #317
- 🌍 #318 Optimize shrinking for "any list over count" counterexample by @nth-commit in #319
- 🌍 #318 Count all iterations after the initial counterexample as shrinks by @nth-commit in #321
Full Changelog: 0.6.0...0.6.1
0.6.1-alpha.1
What's Changed
- 🌍 Add GalaxyCheck.Xunit.CodeAnalysis to publishable packages by @nth-commit in #313
- 🌍 #314 Code refactoring suggestions now also apply to SampleAttribute by @nth-commit in #315
- 🌍 #316 Shrink string/char gens to 'a' instead of whitespace by @nth-commit in #317
- 🌍 #318 Optimize shrinking for "any list over count" counterexample by @nth-commit in #319
- 🌍 #318 Count all iterations after the initial counterexample as shrinks by @nth-commit in #321
Full Changelog: 0.6.0...0.6.1-alpha.1
0.6.0
New package: GalaxyCheck.Xunit.CodeAnalysis
It's installed automatically when you install GalaxyCheck.Xunit
, and will be the home of Roslyn analyzers and code refactoring providers.
Add MemberGenAttribute
This new attribute mirrors MemberData
in xunit, but allows parameter-level configuration of data generation. It allows you to quickly configure generators without using a custom GenFactory
, or switching to LINQ-properties.
using GalaxyCheck;
using Xunit;
public class FizzBuzzTests
{
private static IGen<int> MultipleOfThree => Gen.Int32().Select(x => x * 3);
[Property]
public void ItFizzes([MemberGen(nameof(MultipleOfThree))] int n)
{
Assert.Contains("Fizz", FizzBuzz(n));
}
}
MemberGenAttribute
is optional on parameters. If omitted, it will fall back to the default generation strategy.
Add Roslyn analyzers for statically checking the validity of a MemberGenAttribute
- GalaxyCheckXunit1000: MemberGen must reference an existing member - (the member must exist in the test class)
- GalaxyCheckXunit1001: MemberGen must reference a valid member type - (the member must be a field or a property)
- GalaxyCheckXunit1002: MemberGen must reference a member providing a suitable data type - (the member must be of type
IGen<T>
, whereT
is the parameter type the attribute is decorating)
Add Roslyn code-refactoring provider for generating MemberGenAttributes
The code refactor will interpret the type of parameter that the cursor is over, and produce a generator inside the class that'll provide a good starting point for further configuration.
Improves Property.Precondition
Property.Precondition
is a quick and dirty way to filter input to a property that you can add inside it's body. It's similar to Gen.Where
, but it has a few limitations. However, a lot of the time, it's just what you need.
For example, consider the property:
[Property]
public void DifferentIntegersHashDifferently(int x, int y)
{
Assert.NotEqual(Hash(x), Hash(y));
}
This property will almost certainly fail, as early on in testing a property, GalaxyCheck has a high chance of generating the minimum value (e.g. 0
), and later on, it has a reasonably chance of generating the maximum value (e.g. int.MaxValue
). The chance of collision over a 100 iterations of a test becomes extremely high. One way to fix that is to couple the generation of the integers together, like so:
private static IGen<(int x, int y)> TwoDistinctIntegers =>
from x in Gen.Int32()
from y in Gen.Int32()
where x != y
select (x, y);
[Property]
public void DifferentIntegersHashDifferently([MemberGen(nameof(TwoDistinctIntegers))] (int x, int y) tupleOfInts)
{
Assert.NotEqual(Hash(tupleOfInts.x), Hash(tupleOfInts.y));
}
This is reasonably verbose - and quite a disruptive iteration on the test.
Property.Precondition
allows you augment the existing test slightly to provide that filter, rather than modifying the whole generation:
[Property]
public void DifferentIntegersHashDifferently(int x, int y)
{
Property.Precondition(x != y);
Assert.NotEqual(Hash(x), Hash(y));
}
This release improves Property.Precondition
so it behaves slightly more like Gen.Where
. Whilst some of the limitations between it and Gen.Where
are impossible to resolve (mostly, because GalaxyCheck has no insight into what and why the values are filtered), it improves the usability a fair bit, such that:
- GalaxyCheck will give up after a certain amount of effort trying to generate parameters that don't seem to ever fulfil the precondition.
- GalaxyCheck will try and generate "bigger" data, if smaller data is not fulfilling the precondition. That means it can retry its way out of preconditions like
x > 100
.
BREAKING: Simplified some of the information returned by Property.Check
This change has a very low-chance of being breaking in reality, but some of the properties on the CheckResult
were trimmed down, somewhat.
0.5.0
BREAKING: Fix Gen.Byte().GreaterThan() types
This method was erroneously accepting an int
, rather than a byte
. Fixed now.
Add Gen.Nullable<T>()
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.Nullable(Gen.String()); // "a", "aa", "a ", null, "ab" ...
Gen.String().OrNull(); // alternative syntax
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 leverage Gen.Infinite<T>
- the generator which produces IEnumerable<T>
s of infinite size.
That means that we can generate structures like this:
public class House
{
public Address Address { get; set; }
public IEnumerable<Room> Rooms { get; set; } // Previously this property was unsupported
}
Gen.Create<House>();
It also means IEnumerables
are now supported in injected properties:
[Property]
public void SortIdempotency(IEnumerable<int> xs)
{
Assert.Equal(xs.Sort(), xs.Sort().Sort());
}
GreaterThan()
/LessThan()
integer-generating builder methods now error on numeric overflow
Previously, a generator defined as Gen.Int32().GreaterThan(int.MaxValue)
would silently cause a numeric overflow, and create a generator equivalent to Gen.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 as Gen.String().WithCountGreaterThan()
.
Protect the inferred maximum count of the List<T>
generator from overflowing
When 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 error Error while running generator ListGen: 'maxCount' cannot be negative
. This is because, if unspecified, internally in the generator, we infer the maxCount
to be minCount + 20
, and we weren't checking for integer overflow.
Now, we clamp the maxCount
to int.MaxValue
to prevent overflow. Out-of-the-box, this will result in a much clearer error message:
GalaxyCheck.Exceptions+GenErrorException : Error while running generator ListGen: Count limit exceeded. This is a built-in safety mechanism to prevent hanging tests. If generating a list with over 1000 elements was intended, relax this constraint by calling IListGen.DisableCountLimitUnsafe().
Generating a list with int.MaxValue
items is probably not intended, so the error now gives a better hint towards what has gone wrong.