using Barotrauma; using FsCheck; using Microsoft.Xna.Framework; namespace TestProject { public static class TestProject { public class CustomGenerators { public static Arbitrary Vector2Generator() { return Arb.From(from float x in Arb.Generate().Where(f => !float.IsNaN(f) && !float.IsInfinity(f)) from float y in Arb.Generate().Where(f => !float.IsNaN(f) && !float.IsInfinity(f)) select new Vector2(x, y)); } public static Arbitrary IdentifierGenerator() { return Arb.From(from string value in Arb.Generate().Where(static s => s != null) select new Identifier(value)); } public static Arbitrary ColorGenerator() { return Arb.From(from int r in Gen.Choose(0, 255) from int g in Gen.Choose(0, 255) from int b in Gen.Choose(0, 255) select new Color(r, g, b)); } public static Arbitrary> OptionalGenerator() { return Arb.From(from T x in Arb.Generate() from bool isNone in Arb.Generate() select x is null || isNone ? Option.None() : Option.Some(x)); } } } }