This commit is contained in:
h z
2024-11-30 20:12:13 +00:00
parent 33e6f36841
commit 6867f06b48
3 changed files with 70 additions and 0 deletions

17
tests/BaseTest.cs Normal file
View File

@@ -0,0 +1,17 @@
using System;
using Skeleton.Algebra;
namespace Skeleton.Test;
public class BaseTest
{
protected static int Seed = 517515;
protected static class Theory<TDim, TField>
{
public static readonly Action<CategoryOf<TDim>.OnField<TField>.FMatrix> OnFail
= x => Console.WriteLine(x.CSharpRepresentation);
}
//protected static Action<TMatrix> TheoryOnFail<TMatrix>() = x => Console.WriteLine();
}

15
tests/GlobalSetUp.cs Normal file
View File

@@ -0,0 +1,15 @@
using Skeleton.Utils.RandomEngines;
namespace Skeleton.Test;
[SetUpFixture]
public class GlobalSetUp
{
private const int RandomSeed = 33659722;
/*[SetUp]
public void SetUp()
{
RandomSource.SetSeed(RandomSeed);
}*/
}

38
tests/RandomFixTest.cs Normal file
View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Skeleton.Samples;
using Skeleton.Utils.Helpers;
using Skeleton.Utils.RandomEngines;
namespace Skeleton.Test;
public class RandomFixTest : BaseTest
{
[DatapointSource] private static readonly IEnumerable<LieSU3> x =
40.WithSeed(771202).ScaleSamples(-1, 1).LieSU3LogSU3Samples().ToArray();
[Test]
public static void DatapointTest()
{
Assert.AreEqual(x.Count(), 36);
}
[Test]
public static void Test(){
Console.WriteLine(RandomSource.Rnd.Value.NextDouble());
Console.WriteLine(RandomSource.Rnd.Value.NextDouble());
Console.WriteLine(RandomSource.Rnd.Value.NextDouble());
}
[Test]
public static void SampleTest()
{
RandomSource.SetSeed(22222);
LieSU3[] a = 40.ScaleSamples(-1, 1).LieSU3LogSU3Samples().ToArray();
RandomSource.SetSeed(22222);
LieSU3[] b = 40.ScaleSamples(-1, 1).LieSU3LogSU3Samples().ToArray();
Assert.AreEqual(a.Length, b.Length);
Console.WriteLine(a.Length);
}
}