Skip to content

Commit

Permalink
Gate tests for AVX2 for Shishua
Browse files Browse the repository at this point in the history
  • Loading branch information
martinothamar committed Apr 13, 2023
1 parent e3b9348 commit a538376
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/Fast.PRNGs.Tests/ShishuaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public sealed class ShishuaTests
{
public void DoubleDistributionTest()
{
if (!Shishua.IsSupported)
return;

var baselinePrng = new Random();
using var prng = Shishua.Create();

Expand Down Expand Up @@ -44,23 +47,35 @@ public void DoubleDistributionTest()

public void InitFromNothing()
{
if (!Shishua.IsSupported)
return;

using var _ = Shishua.Create();
}

public void InitFromNew()
{
if (!Shishua.IsSupported)
return;

using var _ = Shishua.Create(new Random());
}

public void InitFromBytes()
{
if (!Shishua.IsSupported)
return;

Span<byte> seedBytes = stackalloc byte[32];
Random.Shared.NextBytes(seedBytes);
using var _ = Shishua.Create(seedBytes);
}

public void FailsWhenGivenWrongSizeSeed()
{
if (!Shishua.IsSupported)
return;

Assert.Throws<ArgumentException>(() => {
Span<byte> seedBytes = stackalloc byte[33];
using var _ = Shishua.Create(seedBytes);
Expand Down

0 comments on commit a538376

Please sign in to comment.