Skip to content

Commit

Permalink
release 3.2.0, SampleConcurrent Task Operation overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLloyd committed Apr 27, 2024
1 parent b43cf77 commit 3146886
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions CsCheck/CsCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ CsCheck also makes concurrency, performance and regression testing simple and fa
<PackageProjectUrl>http://github.com/AnthonyLloyd/CsCheck</PackageProjectUrl>
<PackageIcon>CsCheck.png</PackageIcon>
<PackageTags>quickcheck;random;model-based;metamorphic;concurrency;performance;causal-profiling;regression;testing</PackageTags>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
<PackageReleaseNotes>
More obvious stack trace for exceptions in user code.
Added Faster IInvoke overload and 100 unrolling for IInvokes.
Increased Faster % to two decimal places and added times ratios.
Added SampleConcurrent Task Operation overloads.
</PackageReleaseNotes>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>preview</LangVersion>
Expand Down
8 changes: 4 additions & 4 deletions CsCheck/Gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public abstract class Gen<T> : IGen<T>
public abstract T Generate(PCG pcg, Size? min, out Size size);

public GenOperation<S> Operation<S>(Func<T, string> name, Action<S, T> action) => GenOperation.Create(this, name, action);
public GenOperation<S> Operation<S>(Func<T, string> name, Func<S, T, Task> async) => GenOperation.Create(this, name, (S s, T t) => async(s, t).Wait());
public GenOperation<S> Operation<S>(Func<T, string> name, Func<S, T, Task> async) => GenOperation.Create(this, name, (S s, T t) => async(s, t).GetAwaiter().GetResult());
public GenOperation<S> Operation<S>(Action<S, T> action) => GenOperation.Create(this, action);
public GenOperation<S> Operation<S>(Func<S, T, Task> async) => GenOperation.Create(this, (S s, T t) => async(s, t).Wait());
public GenOperation<S> Operation<S>(Func<S, T, Task> async) => GenOperation.Create(this, (S s, T t) => async(s, t).GetAwaiter().GetResult());
public GenOperation<Actual, Model> Operation<Actual, Model>(Func<T, string> name, Action<Actual, Model, T> action) => GenOperation.Create(this, name, action);
public GenOperation<Actual, Model> Operation<Actual, Model>(Action<Actual, Model, T> action) => GenOperation.Create(this, action);
public GenMetamorphic<S> Metamorphic<S>(Func<T, string> name, Action<S, T> action1, Action<S, T> action2) => GenOperation.Create(this, name, action1, action2);
Expand Down Expand Up @@ -1453,9 +1453,9 @@ sealed class GenNull<T>(Gen<T> gen, uint nullLimit) : Gen<T?> where T : class
}

public static GenOperation<T> Operation<T>(string name, Action<T> action) => GenOperation.Create(name, action);
public static GenOperation<T> Operation<T>(string name, Func<T, Task> async) => GenOperation.Create(name, (T t) => async(t).Wait());
public static GenOperation<T> Operation<T>(string name, Func<T, Task> async) => GenOperation.Create(name, (T t) => async(t).GetAwaiter().GetResult());
public static GenOperation<T> Operation<T>(Action<T> action) => GenOperation.Create(action);
public static GenOperation<T> Operation<T>(Func<T, Task> async) => GenOperation.Create((T t) => async(t).Wait());
public static GenOperation<T> Operation<T>(Func<T, Task> async) => GenOperation.Create((T t) => async(t).GetAwaiter().GetResult());
public static GenOperation<Actual, Model> Operation<Actual, Model>(string name, Action<Actual, Model> action) => GenOperation.Create(name, action);
public static GenOperation<Actual, Model> Operation<Actual, Model>(Action<Actual, Model> action) => GenOperation.Create(action);

Expand Down
2 changes: 1 addition & 1 deletion CsCheck/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static partial class Check
static string SampleErrorMessage(string seed, string minT, int shrinks, long skipped, long total)
{
const int MAX_LENGTH = 5000;
if (minT.Length > MAX_LENGTH) minT = string.Concat(minT.AsSpan(0, MAX_LENGTH), " ...");
if (minT.Length > MAX_LENGTH) minT = $"{minT.AsSpan(0, MAX_LENGTH)} ...";
return $"Set seed: \"{seed}\" or -e CsCheck_Seed={seed} to reproduce ({shrinks:#,0} shrinks, {skipped:#,0} skipped, {total:#,0} total).\n{minT}";
}

Expand Down

0 comments on commit 3146886

Please sign in to comment.